Przeglądaj źródła

runtime: Update the chain constants.

Changes:
- SlashDeferDuration changed to the BONDING_DURATION - 1
- Staking history_depth was increased to 336
Shamil Gadelshin 4 lat temu
rodzic
commit
e99d095055
3 zmienionych plików z 4 dodań i 2 usunięć
  1. 1 0
      node/src/chain_spec/mod.rs
  2. 1 0
      runtime/src/constants.rs
  3. 2 2
      runtime/src/lib.rs

+ 1 - 0
node/src/chain_spec/mod.rs

@@ -260,6 +260,7 @@ pub fn testnet_genesis(
                 .collect(),
             invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
             slash_reward_fraction: Perbill::from_percent(10),
+            history_depth: 336,
             ..Default::default()
         }),
         pallet_sudo: Some(SudoConfig { key: root_key }),

+ 1 - 0
runtime/src/constants.rs

@@ -18,6 +18,7 @@ pub const MILLISECS_PER_BLOCK: Moment = 6000;
 pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;
 
 pub const SLOT_DURATION: Moment = 6000;
+pub const BONDING_DURATION: u32 = 24;
 
 pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
 pub const EPOCH_DURATION_IN_SLOTS: u64 = {

+ 2 - 2
runtime/src/lib.rs

@@ -296,8 +296,8 @@ parameter_types! {
 
 parameter_types! {
     pub const SessionsPerEra: sp_staking::SessionIndex = 6;
-    pub const BondingDuration: pallet_staking::EraIndex = 24;
-    pub const SlashDeferDuration: pallet_staking::EraIndex = 6; // 1/4 the bonding duration.
+    pub const BondingDuration: pallet_staking::EraIndex = BONDING_DURATION;
+    pub const SlashDeferDuration: pallet_staking::EraIndex = BONDING_DURATION - 1; // 'slightly less' than the bonding duration.
     pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
     pub const MaxNominatorRewardedPerValidator: u32 = 64;
     pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;