companion for substrate/10377 (#4379)

* companion for substrate/10377

* udpate substrate (cargo update -p sp-io)

* fmt
This commit is contained in:
Kian Paimani
2021-11-28 15:21:18 +01:00
committed by GitHub
parent 659beec4c9
commit 55f58760f2
6 changed files with 351 additions and 423 deletions
+339 -422
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -41,7 +41,7 @@ pub use frame_support::weights::constants::{
}; };
use frame_support::{ use frame_support::{
parameter_types, parameter_types,
traits::{Currency, OneSessionHandler}, traits::{ConstU32, Currency, OneSessionHandler},
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, Weight}, weights::{constants::WEIGHT_PER_SECOND, DispatchClass, Weight},
}; };
use frame_system::limits; use frame_system::limits;
@@ -182,6 +182,13 @@ impl<T: pallet_session::Config> OneSessionHandler<T::AccountId>
fn on_disabled(_: u32) {} fn on_disabled(_: u32) {}
} }
/// A reasonable benchmarking config for staking pallet.
pub struct StakingBenchmarkingConfig;
impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig {
type MaxValidators = ConstU32<1000>;
type MaxNominators = ConstU32<1000>;
}
#[cfg(test)] #[cfg(test)]
mod multiplier_tests { mod multiplier_tests {
use super::*; use super::*;
+1
View File
@@ -555,6 +555,7 @@ impl pallet_staking::Config for Runtime {
type OffendingValidatorsThreshold = OffendingValidatorsThreshold; type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
// Use the nominators map to iter voters, but also keep bags-list up-to-date. // Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = BagsList; type SortedListProvider = BagsList;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>; type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
} }
+1
View File
@@ -550,6 +550,7 @@ impl pallet_staking::Config for Runtime {
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>; type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
// Use the nominators map to iter voters, but also keep bags-list up-to-date. // Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList<Runtime>; type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList<Runtime>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>; type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
} }
+1
View File
@@ -345,6 +345,7 @@ impl pallet_staking::Config for Runtime {
// Use the nominator map to iter voter AND no-ops for all SortedListProvider hooks. The migration // Use the nominator map to iter voter AND no-ops for all SortedListProvider hooks. The migration
// to bags-list is a no-op, but the storage version will be updated. // to bags-list is a no-op, but the storage version will be updated.
type SortedListProvider = pallet_staking::UseNominatorsMap<Runtime>; type SortedListProvider = pallet_staking::UseNominatorsMap<Runtime>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = (); type WeightInfo = ();
} }
+1
View File
@@ -459,6 +459,7 @@ impl pallet_staking::Config for Runtime {
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>; type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
// Use the nominators map to iter voters, but also keep bags-list up-to-date. // Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = BagsList; type SortedListProvider = BagsList;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>; type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
} }