diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 399f7a81f..e4180b10e 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -377,22 +377,29 @@ parameter_types! { pub const SS58Prefix: u8 = 22; } -#[cfg(not(feature = "mainnet"))] pub struct ChangeValidatorsConfiguration; -#[cfg(not(feature = "mainnet"))] + +#[cfg(feature = "mainnet")] impl ChangeValidatorsConfiguration { - pub const VALIDATOR_COUNT: u32 = 2; + pub const VALIDATOR_COUNT: u32 = 20; pub const MIN_VALIDATOR_BOND: Balance = 1_000_000 * DOCK; } -#[cfg(feature = "mainnet")] -pub struct ChangeValidatorsConfiguration; -#[cfg(feature = "mainnet")] +#[cfg(not(feature = "mainnet"))] impl ChangeValidatorsConfiguration { - pub const VALIDATOR_COUNT: u32 = 20; + pub const VALIDATOR_COUNT: u32 = 2; pub const MIN_VALIDATOR_BOND: Balance = 1_000_000 * DOCK; } +impl OnRuntimeUpgrade for ChangeValidatorsConfiguration { + fn on_runtime_upgrade() -> Weight { + pallet_staking::ValidatorCount::::put(Self::VALIDATOR_COUNT); + pallet_staking::MinValidatorBond::::put(Self::MIN_VALIDATOR_BOND); + + ::DbWeight::get().writes(2) + } +} + #[cfg(not(any(feature = "testnet", feature = "mainnet", feature = "devnet")))] parameter_types! { pub const SS58Prefix: u8 = 42; @@ -1878,15 +1885,6 @@ type Executive = frame_executive::Executive< ChangeValidatorsConfiguration, >; -impl OnRuntimeUpgrade for ChangeValidatorsConfiguration { - fn on_runtime_upgrade() -> Weight { - pallet_staking::ValidatorCount::::put(Self::VALIDATOR_COUNT); - pallet_staking::MinValidatorBond::::put(Self::MIN_VALIDATOR_BOND); - - ::DbWeight::get().writes(2) - } -} - /// The address format for describing accounts. pub type Address = sp_runtime::MultiAddress; /// Block header type as expected by this runtime.