Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[Companion] Get rid of HistoryDepth storage #5996

Merged
merged 14 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = NominationPools;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
Expand Down Expand Up @@ -1460,6 +1461,7 @@ pub type Executive = frame_executive::Executive<
VoterList,
StakingMigrationV11OldPallet,
>,
pallet_staking::migrations::v12::MigrateToV12<Runtime>,
),
>;
/// The payload being signed in the transactions.
Expand Down
18 changes: 0 additions & 18 deletions runtime/kusama/src/weights/pallet_staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,24 +297,6 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(8 as u64))
}
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking HistoryDepth (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:0 w:2)
// Storage: Staking ErasValidatorPrefs (r:0 w:2)
// Storage: Staking ErasValidatorReward (r:0 w:1)
// Storage: Staking ErasRewardPoints (r:0 w:1)
// Storage: Staking ErasStakers (r:0 w:2)
// Storage: Staking ErasTotalStake (r:0 w:1)
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
/// The range of component `e` is `[1, 100]`.
fn set_history_depth(e: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 89_000
.saturating_add(Weight::from_ref_time(21_655_000 as u64).saturating_mul(e as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
.saturating_add(T::DbWeight::get().writes((7 as u64).saturating_mul(e as u64)))
}
// Storage: System Account (r:1 w:1)
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1)
Expand Down
2 changes: 2 additions & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = NominationPools;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
Expand Down Expand Up @@ -1543,6 +1544,7 @@ pub type Executive = frame_executive::Executive<
VoterList,
StakingMigrationV11OldPallet,
>,
pallet_staking::migrations::v12::MigrateToV12<Runtime>,
),
>;

Expand Down
18 changes: 0 additions & 18 deletions runtime/polkadot/src/weights/pallet_staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,24 +297,6 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(8 as u64))
}
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking HistoryDepth (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:0 w:2)
// Storage: Staking ErasValidatorPrefs (r:0 w:2)
// Storage: Staking ErasValidatorReward (r:0 w:1)
// Storage: Staking ErasRewardPoints (r:0 w:1)
// Storage: Staking ErasStakers (r:0 w:2)
// Storage: Staking ErasTotalStake (r:0 w:1)
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
/// The range of component `e` is `[1, 100]`.
fn set_history_depth(e: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 87_000
.saturating_add(Weight::from_ref_time(21_687_000 as u64).saturating_mul(e as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
.saturating_add(T::DbWeight::get().writes((7 as u64).saturating_mul(e as u64)))
}
// Storage: System Account (r:1 w:1)
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1)
Expand Down
1 change: 1 addition & 0 deletions runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = pallet_staking::UseNominatorsAndValidatorsMap<Runtime>;
type TargetList = pallet_staking::UseValidatorsMap<Runtime>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = ();
type WeightInfo = ();
Expand Down
2 changes: 2 additions & 0 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = NominationPools;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
Expand Down Expand Up @@ -1200,6 +1201,7 @@ pub type Executive = frame_executive::Executive<
StakingMigrationV11OldPallet,
>,
pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>,
pallet_staking::migrations::v12::MigrateToV12<Runtime>,
),
>;
/// The payload being signed in transactions.
Expand Down
18 changes: 0 additions & 18 deletions runtime/westend/src/weights/pallet_staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,24 +297,6 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(8 as u64))
}
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Staking HistoryDepth (r:1 w:1)
// Storage: Staking ErasStakersClipped (r:0 w:2)
// Storage: Staking ErasValidatorPrefs (r:0 w:2)
// Storage: Staking ErasValidatorReward (r:0 w:1)
// Storage: Staking ErasRewardPoints (r:0 w:1)
// Storage: Staking ErasStakers (r:0 w:2)
// Storage: Staking ErasTotalStake (r:0 w:1)
// Storage: Staking ErasStartSessionIndex (r:0 w:1)
/// The range of component `e` is `[1, 100]`.
fn set_history_depth(e: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 86_000
.saturating_add(Weight::from_ref_time(21_617_000 as u64).saturating_mul(e as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
.saturating_add(T::DbWeight::get().writes((7 as u64).saturating_mul(e as u64)))
}
// Storage: System Account (r:1 w:1)
// Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1)
Expand Down