Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions runtimes/common/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,7 @@ pub mod staking {
#[cfg(not(feature = "fast-gov"))]
pub const DEFAULT_BLOCKS_PER_ROUND: BlockNumber = 2 * HOURS;

#[cfg(feature = "fast-gov")]
pub const STAKE_DURATION: BlockNumber = 30;
#[cfg(not(feature = "fast-gov"))]
pub const STAKE_DURATION: BlockNumber = 7 * DAYS;
pub const STAKE_DURATION: BlockNumber = 1;

#[cfg(feature = "fast-gov")]
pub const MIN_COLLATORS: u32 = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to change this too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this constant is very important. It's only used in set_max_selected_candidates as a validation parameter.
The pallet isn't used to fetch collators anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this constraints the setting determining how many candidates are selected as collators. Which has become irrelevant now, and I would want to avoid fiddling with settings where not required, given that the pallet is pretty complex and it's hard to foresee all consequences of such changes.

Expand Down Expand Up @@ -289,7 +286,7 @@ pub mod staking {
/// Minimum 16 collators selected per round, default at genesis and minimum forever after
pub const MinCollators: u32 = MIN_COLLATORS;
/// At least 4 candidates which cannot leave the network if there are no other candidates.
pub const MinRequiredCollators: u32 = 4;
pub const MinRequiredCollators: u32 = 0;
/// We only allow one delegation per round.
pub const MaxDelegationsPerRound: u32 = 1;
/// Maximum 25 delegators per collator at launch, might be increased later
Expand Down
15 changes: 12 additions & 3 deletions runtimes/peregrine/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
// If you feel like getting in touch with us, you can do so at <hello@kilt.io>

use frame_support::{
parameter_types,
traits::{AsEnsureOriginWithArg, Everything, PrivilegeCmp},
match_types, parameter_types,
traits::{AsEnsureOriginWithArg, EverythingBut, PrivilegeCmp},
weights::Weight,
};
use frame_system::EnsureRoot;
Expand Down Expand Up @@ -55,6 +55,15 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}

match_types! {
pub type IncreaseStakingCalls: impl Contains<RuntimeCall> = {
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::join_candidates { .. }) |
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::join_delegators { .. }) |
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::delegator_stake_more { .. }) |
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::candidate_stake_more { .. })
};
}

impl frame_system::Config for Runtime {
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
Expand Down Expand Up @@ -87,7 +96,7 @@ impl frame_system::Config for Runtime {
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = weights::rocksdb_weights::constants::RocksDbWeight;
type BaseCallFilter = Everything;
type BaseCallFilter = EverythingBut<IncreaseStakingCalls>;
type SystemWeightInfo = crate::weights::frame_system::WeightInfo<Runtime>;
type BlockWeights = BlockWeights;
type BlockLength = BlockLength;
Expand Down
15 changes: 12 additions & 3 deletions runtimes/spiritnet/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
// If you feel like getting in touch with us, you can do so at <hello@kilt.io>

use frame_support::{
parameter_types,
traits::{AsEnsureOriginWithArg, Everything, PrivilegeCmp},
match_types, parameter_types,
traits::{AsEnsureOriginWithArg, EverythingBut, PrivilegeCmp},
weights::Weight,
};
use frame_system::EnsureRoot;
Expand Down Expand Up @@ -55,6 +55,15 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}

match_types! {
pub type IncreaseStakingCalls: impl Contains<RuntimeCall> = {
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::join_candidates { .. }) |
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::join_delegators { .. }) |
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::delegator_stake_more { .. }) |
RuntimeCall::ParachainStaking(parachain_staking::Call::<Runtime>::candidate_stake_more { .. })
};
}

impl frame_system::Config for Runtime {
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
Expand Down Expand Up @@ -87,7 +96,7 @@ impl frame_system::Config for Runtime {
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = weights::rocksdb_weights::constants::RocksDbWeight;
type BaseCallFilter = Everything;
type BaseCallFilter = EverythingBut<IncreaseStakingCalls>;
type SystemWeightInfo = crate::weights::frame_system::WeightInfo<Runtime>;
type BlockWeights = BlockWeights;
type BlockLength = BlockLength;
Expand Down
Loading