Unverified Commit bd69f54b authored by Kian Paimani's avatar Kian Paimani Committed by GitHub
Browse files

companion for substrate/10377 (#4379)

* companion for substrate/10377

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

* fmt
parent 2256ed13
Pipeline #168339 failed with stages
in 47 minutes and 42 seconds
This diff is collapsed.
...@@ -41,7 +41,7 @@ pub use frame_support::weights::constants::{ ...@@ -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> ...@@ -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::*;
......
...@@ -555,6 +555,7 @@ impl pallet_staking::Config for Runtime { ...@@ -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>;
} }
......
...@@ -550,6 +550,7 @@ impl pallet_staking::Config for Runtime { ...@@ -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>;
} }
......
...@@ -345,6 +345,7 @@ impl pallet_staking::Config for Runtime { ...@@ -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 = ();
} }
......
...@@ -459,6 +459,7 @@ impl pallet_staking::Config for Runtime { ...@@ -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>;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment