[Companion] Get rid of HistoryDepth storage (#5996)

* remove history depth from storage and add it as config for pallet staking

* add migration to v11 for staking pallet

* revert local substrate dependency patch

* remove history depth from storage and add it as config for pallet staking

* add migration to v11 for staking pallet

* revert local substrate dependency patch

* update substrate dependencies

* update cargo lock

* update to latest substrate

* revert all changes to Cargo.lock

* cargo update -p sp-io

* mark migration job as failable

Co-authored-by: kianenigma <kian@parity.io>
This commit is contained in:
Ankan
2022-09-21 17:24:14 +02:00
committed by GitHub
parent 937c4e76ae
commit 8d8616d656
9 changed files with 238 additions and 276 deletions
+1
View File
@@ -651,6 +651,7 @@ check-runtime-migration:
else else
echo "runtimemigration label not found. Skipping" echo "runtimemigration label not found. Skipping"
fi fi
allow_failure: true
check-no-default-features: check-no-default-features:
+230 -222
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -615,6 +615,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList; type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>; type TargetList = UseValidatorsMap<Self>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = NominationPools; type OnStakerSlash = NominationPools;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>; type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
@@ -1460,6 +1461,7 @@ pub type Executive = frame_executive::Executive<
VoterList, VoterList,
StakingMigrationV11OldPallet, StakingMigrationV11OldPallet,
>, >,
pallet_staking::migrations::v12::MigrateToV12<Runtime>,
), ),
>; >;
/// The payload being signed in the transactions. /// The payload being signed in the transactions.
@@ -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().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(8 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: System Account (r:1 w:1)
// Storage: Staking Bonded (r:1 w:1) // Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1) // Storage: Staking Ledger (r:1 w:1)
+2
View File
@@ -560,6 +560,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList; type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>; type TargetList = UseValidatorsMap<Self>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = NominationPools; type OnStakerSlash = NominationPools;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>; type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
@@ -1543,6 +1544,7 @@ pub type Executive = frame_executive::Executive<
VoterList, VoterList,
StakingMigrationV11OldPallet, StakingMigrationV11OldPallet,
>, >,
pallet_staking::migrations::v12::MigrateToV12<Runtime>,
), ),
>; >;
@@ -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().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(8 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: System Account (r:1 w:1)
// Storage: Staking Bonded (r:1 w:1) // Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1) // Storage: Staking Ledger (r:1 w:1)
+1
View File
@@ -356,6 +356,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = pallet_staking::UseNominatorsAndValidatorsMap<Runtime>; type VoterList = pallet_staking::UseNominatorsAndValidatorsMap<Runtime>;
type TargetList = pallet_staking::UseValidatorsMap<Runtime>; type TargetList = pallet_staking::UseValidatorsMap<Runtime>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = (); type OnStakerSlash = ();
type WeightInfo = (); type WeightInfo = ();
+2
View File
@@ -511,6 +511,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList; type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>; type TargetList = UseValidatorsMap<Self>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = NominationPools; type OnStakerSlash = NominationPools;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>; type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
@@ -1200,6 +1201,7 @@ pub type Executive = frame_executive::Executive<
StakingMigrationV11OldPallet, StakingMigrationV11OldPallet,
>, >,
pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>, pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>,
pallet_staking::migrations::v12::MigrateToV12<Runtime>,
), ),
>; >;
/// The payload being signed in transactions. /// The payload being signed in transactions.
@@ -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().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(8 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: System Account (r:1 w:1)
// Storage: Staking Bonded (r:1 w:1) // Storage: Staking Bonded (r:1 w:1)
// Storage: Staking Ledger (r:1 w:1) // Storage: Staking Ledger (r:1 w:1)