substrate
substrate copied to clipboard
Add a migration helper for reducing HistoryDepth config value in staking pallet
PR https://github.com/paritytech/substrate/pull/12230 introduced HistoryDepth as a config value in staking pallet which bounds several storage item in the pallet. In order to lower this value for a runtime once it has been already set, we need to handle migration of the storage items affected.
Following storage items are affected by History Depth
ErasStakers
, ErasStakersClipped
, ErasValidatorPrefs
, ErasValidatorReward
, ErasRewardPoints
, ErasTotalStake
, ErasStartSessionIndex
, StakingLedger.claimed_rewards
We should add a generic migration function fn migrate_history_depth(from: u32, to: u32) -> Weight
and put it in staking::migrations
that can be used by a future migrations to reduce the HistoryDepth gracefully.
We should also look into reducing the current HistoryDepth = 84 on Polkadot and Kusama once we have this.
cc: @kianenigma