Skip to content

Commit

Permalink
Slight restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
olegnn authored and lovesh committed Oct 15, 2024
1 parent 69a444b commit 474053c
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Runtime>::put(Self::VALIDATOR_COUNT);
pallet_staking::MinValidatorBond::<Runtime>::put(Self::MIN_VALIDATOR_BOND);

<Runtime as frame_system::Config>::DbWeight::get().writes(2)
}
}

#[cfg(not(any(feature = "testnet", feature = "mainnet", feature = "devnet")))]
parameter_types! {
pub const SS58Prefix: u8 = 42;
Expand Down Expand Up @@ -1878,15 +1885,6 @@ type Executive = frame_executive::Executive<
ChangeValidatorsConfiguration,
>;

impl OnRuntimeUpgrade for ChangeValidatorsConfiguration {
fn on_runtime_upgrade() -> Weight {
pallet_staking::ValidatorCount::<Runtime>::put(Self::VALIDATOR_COUNT);
pallet_staking::MinValidatorBond::<Runtime>::put(Self::MIN_VALIDATOR_BOND);

<Runtime as frame_system::Config>::DbWeight::get().writes(2)
}
}

/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
Expand Down

0 comments on commit 474053c

Please sign in to comment.