Companion for substrate#12970 (#6807)

* Runtime companion changes

* updates runtime configs

* Fixes runtime-test runtime configs

* Uses ElectionBounds and builder from own mod

* updates new bounds mod

* Fixes test-runtime mock

* update lockfile for {"substrate"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Gonçalo Pestana
2023-08-10 10:42:43 +02:00
committed by GitHub
parent 9d84998575
commit 55bc8f9f23
5 changed files with 225 additions and 220 deletions
+11 -6
View File
@@ -36,7 +36,10 @@ use polkadot_runtime_parachains::{
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
use frame_election_provider_support::{onchain, SequentialPhragmen};
use frame_election_provider_support::{
bounds::{ElectionBounds, ElectionBoundsBuilder},
onchain, SequentialPhragmen,
};
use frame_support::{
construct_runtime, parameter_types,
traits::{Everything, KeyOwnerProofSystem, WithdrawReasons},
@@ -315,8 +318,8 @@ parameter_types! {
pub storage OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const MaxAuthorities: u32 = 100_000;
pub const OnChainMaxWinners: u32 = u32::MAX;
pub const MaxElectingVoters: u32 = u32::MAX;
pub const MaxElectableTargets: u16 = u16::MAX;
// Unbounded number of election targets and voters.
pub ElectionBoundsOnChain: ElectionBounds = ElectionBoundsBuilder::default().build();
}
pub struct OnChainSeqPhragmen;
@@ -325,13 +328,14 @@ impl onchain::Config for OnChainSeqPhragmen {
type Solver = SequentialPhragmen<AccountId, runtime_common::elections::OnChainAccuracy>;
type DataProvider = Staking;
type WeightInfo = ();
type Bounds = ElectionBoundsOnChain;
type MaxWinners = OnChainMaxWinners;
type VotersBound = MaxElectingVoters;
type TargetsBound = MaxElectableTargets;
}
/// Upper limit on the number of NPOS nominations.
const MAX_QUOTA_NOMINATIONS: u32 = 16;
impl pallet_staking::Config for Runtime {
type MaxNominations = frame_support::pallet_prelude::ConstU32<16>;
type Currency = Balances;
type CurrencyBalance = Balance;
type UnixTime = Timestamp;
@@ -355,6 +359,7 @@ impl pallet_staking::Config for Runtime {
// to bags-list is a no-op, but the storage version will be updated.
type VoterList = pallet_staking::UseNominatorsAndValidatorsMap<Runtime>;
type TargetList = pallet_staking::UseValidatorsMap<Runtime>;
type NominationsQuota = pallet_staking::FixedNominationsQuota<MAX_QUOTA_NOMINATIONS>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;