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

Commit

Permalink
companion for substrate/10377 (#4379)
Browse files Browse the repository at this point in the history
* companion for substrate/10377

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

* fmt
  • Loading branch information
kianenigma authored and chevdor committed Jan 11, 2022
1 parent 2d24429 commit 94b1f8f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub use frame_support::weights::constants::{
};
use frame_support::{
parameter_types,
traits::{Currency, OneSessionHandler},
traits::{ConstU32, Currency, OneSessionHandler},
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, Weight},
};
use frame_system::limits;
Expand Down Expand Up @@ -182,6 +182,13 @@ impl<T: pallet_session::Config> OneSessionHandler<T::AccountId>
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)]
mod multiplier_tests {
use super::*;
Expand Down
1 change: 1 addition & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ impl pallet_staking::Config for Runtime {
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
// Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = BagsList;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}

Expand Down
1 change: 1 addition & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ impl pallet_staking::Config for Runtime {
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
// Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList<Runtime>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}

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 @@ -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
// to bags-list is a no-op, but the storage version will be updated.
type SortedListProvider = pallet_staking::UseNominatorsMap<Runtime>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = ();
}

Expand Down
1 change: 1 addition & 0 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ impl pallet_staking::Config for Runtime {
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
// Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = BagsList;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}

Expand Down

0 comments on commit 94b1f8f

Please sign in to comment.