mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
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:
Generated
+184
-184
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,8 @@ use runtime_parachains::{
|
|||||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
|
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
|
||||||
use frame_election_provider_support::{
|
use frame_election_provider_support::{
|
||||||
generate_solution_type, onchain, NposSolution, SequentialPhragmen,
|
bounds::ElectionBoundsBuilder, generate_solution_type, onchain, NposSolution,
|
||||||
|
SequentialPhragmen,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
@@ -399,11 +400,12 @@ parameter_types! {
|
|||||||
// 1 hour session, 15 minutes unsigned phase, 8 offchain executions.
|
// 1 hour session, 15 minutes unsigned phase, 8 offchain executions.
|
||||||
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 8;
|
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 8;
|
||||||
|
|
||||||
/// We take the top 12500 nominators as electing voters..
|
|
||||||
pub const MaxElectingVoters: u32 = 12_500;
|
pub const MaxElectingVoters: u32 = 12_500;
|
||||||
/// ... and all of the validators as electable targets. Whilst this is the case, we cannot and
|
/// We take the top 12500 nominators as electing voters and all of the validators as electable
|
||||||
/// shall not increase the size of the validator intentions.
|
/// targets. Whilst this is the case, we cannot and shall not increase the size of the
|
||||||
pub const MaxElectableTargets: u16 = u16::MAX;
|
/// validator intentions.
|
||||||
|
pub ElectionBounds: frame_election_provider_support::bounds::ElectionBounds =
|
||||||
|
ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build();
|
||||||
pub NposSolutionPriority: TransactionPriority =
|
pub NposSolutionPriority: TransactionPriority =
|
||||||
Perbill::from_percent(90) * TransactionPriority::max_value();
|
Perbill::from_percent(90) * TransactionPriority::max_value();
|
||||||
/// Setup election pallet to support maximum winners upto 2000. This will mean Staking Pallet
|
/// Setup election pallet to support maximum winners upto 2000. This will mean Staking Pallet
|
||||||
@@ -428,8 +430,7 @@ impl onchain::Config for OnChainSeqPhragmen {
|
|||||||
type DataProvider = Staking;
|
type DataProvider = Staking;
|
||||||
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
|
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
|
||||||
type MaxWinners = MaxActiveValidators;
|
type MaxWinners = MaxActiveValidators;
|
||||||
type VotersBound = MaxElectingVoters;
|
type Bounds = ElectionBounds;
|
||||||
type TargetsBound = MaxElectableTargets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
|
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
|
||||||
@@ -495,9 +496,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
|||||||
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
|
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
|
||||||
type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, StakingAdmin>;
|
type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, StakingAdmin>;
|
||||||
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
|
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
|
||||||
type MaxElectingVoters = MaxElectingVoters;
|
|
||||||
type MaxElectableTargets = MaxElectableTargets;
|
|
||||||
type MaxWinners = MaxActiveValidators;
|
type MaxWinners = MaxActiveValidators;
|
||||||
|
type ElectionBounds = ElectionBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -564,7 +564,6 @@ parameter_types! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_staking::Config for Runtime {
|
impl pallet_staking::Config for Runtime {
|
||||||
type MaxNominations = MaxNominations;
|
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CurrencyBalance = Balance;
|
type CurrencyBalance = Balance;
|
||||||
type UnixTime = Timestamp;
|
type UnixTime = Timestamp;
|
||||||
@@ -586,6 +585,7 @@ impl pallet_staking::Config for Runtime {
|
|||||||
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
|
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
|
||||||
type VoterList = VoterList;
|
type VoterList = VoterList;
|
||||||
type TargetList = UseValidatorsMap<Self>;
|
type TargetList = UseValidatorsMap<Self>;
|
||||||
|
type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ use runtime_parachains::{
|
|||||||
|
|
||||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
|
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
|
||||||
use frame_election_provider_support::{generate_solution_type, onchain, SequentialPhragmen};
|
use frame_election_provider_support::{
|
||||||
|
bounds::ElectionBoundsBuilder, generate_solution_type, onchain, SequentialPhragmen,
|
||||||
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{
|
traits::{
|
||||||
@@ -393,11 +395,12 @@ parameter_types! {
|
|||||||
// 4 hour session, 1 hour unsigned phase, 32 offchain executions.
|
// 4 hour session, 1 hour unsigned phase, 32 offchain executions.
|
||||||
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 32;
|
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 32;
|
||||||
|
|
||||||
/// We take the top 22500 nominators as electing voters..
|
|
||||||
pub const MaxElectingVoters: u32 = 22_500;
|
pub const MaxElectingVoters: u32 = 22_500;
|
||||||
/// ... and all of the validators as electable targets. Whilst this is the case, we cannot and
|
/// We take the top 22500 nominators as electing voters and all of the validators as electable
|
||||||
/// shall not increase the size of the validator intentions.
|
/// targets. Whilst this is the case, we cannot and shall not increase the size of the
|
||||||
pub const MaxElectableTargets: u16 = u16::MAX;
|
/// validator intentions.
|
||||||
|
pub ElectionBounds: frame_election_provider_support::bounds::ElectionBounds =
|
||||||
|
ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build();
|
||||||
/// Setup election pallet to support maximum winners upto 1200. This will mean Staking Pallet
|
/// Setup election pallet to support maximum winners upto 1200. This will mean Staking Pallet
|
||||||
/// cannot have active validators higher than this count.
|
/// cannot have active validators higher than this count.
|
||||||
pub const MaxActiveValidators: u32 = 1200;
|
pub const MaxActiveValidators: u32 = 1200;
|
||||||
@@ -420,8 +423,7 @@ impl onchain::Config for OnChainSeqPhragmen {
|
|||||||
type DataProvider = Staking;
|
type DataProvider = Staking;
|
||||||
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
|
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
|
||||||
type MaxWinners = MaxActiveValidators;
|
type MaxWinners = MaxActiveValidators;
|
||||||
type VotersBound = MaxElectingVoters;
|
type Bounds = ElectionBounds;
|
||||||
type TargetsBound = MaxElectableTargets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
|
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
|
||||||
@@ -487,9 +489,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
|||||||
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
|
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
|
||||||
type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, StakingAdmin>;
|
type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, StakingAdmin>;
|
||||||
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
|
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
|
||||||
type MaxElectingVoters = MaxElectingVoters;
|
|
||||||
type MaxElectableTargets = MaxElectableTargets;
|
|
||||||
type MaxWinners = MaxActiveValidators;
|
type MaxWinners = MaxActiveValidators;
|
||||||
|
type ElectionBounds = ElectionBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -572,7 +573,6 @@ impl pallet_staking::EraPayout<Balance> for EraPayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_staking::Config for Runtime {
|
impl pallet_staking::Config for Runtime {
|
||||||
type MaxNominations = MaxNominations;
|
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CurrencyBalance = Balance;
|
type CurrencyBalance = Balance;
|
||||||
type UnixTime = Timestamp;
|
type UnixTime = Timestamp;
|
||||||
@@ -594,6 +594,7 @@ impl pallet_staking::Config for Runtime {
|
|||||||
type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
|
type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
|
||||||
type VoterList = VoterList;
|
type VoterList = VoterList;
|
||||||
type TargetList = UseValidatorsMap<Self>;
|
type TargetList = UseValidatorsMap<Self>;
|
||||||
|
type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ use polkadot_runtime_parachains::{
|
|||||||
|
|
||||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
|
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::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{Everything, KeyOwnerProofSystem, WithdrawReasons},
|
traits::{Everything, KeyOwnerProofSystem, WithdrawReasons},
|
||||||
@@ -315,8 +318,8 @@ parameter_types! {
|
|||||||
pub storage OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
|
pub storage OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
|
||||||
pub const MaxAuthorities: u32 = 100_000;
|
pub const MaxAuthorities: u32 = 100_000;
|
||||||
pub const OnChainMaxWinners: u32 = u32::MAX;
|
pub const OnChainMaxWinners: u32 = u32::MAX;
|
||||||
pub const MaxElectingVoters: u32 = u32::MAX;
|
// Unbounded number of election targets and voters.
|
||||||
pub const MaxElectableTargets: u16 = u16::MAX;
|
pub ElectionBoundsOnChain: ElectionBounds = ElectionBoundsBuilder::default().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct OnChainSeqPhragmen;
|
pub struct OnChainSeqPhragmen;
|
||||||
@@ -325,13 +328,14 @@ impl onchain::Config for OnChainSeqPhragmen {
|
|||||||
type Solver = SequentialPhragmen<AccountId, runtime_common::elections::OnChainAccuracy>;
|
type Solver = SequentialPhragmen<AccountId, runtime_common::elections::OnChainAccuracy>;
|
||||||
type DataProvider = Staking;
|
type DataProvider = Staking;
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
|
type Bounds = ElectionBoundsOnChain;
|
||||||
type MaxWinners = OnChainMaxWinners;
|
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 {
|
impl pallet_staking::Config for Runtime {
|
||||||
type MaxNominations = frame_support::pallet_prelude::ConstU32<16>;
|
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CurrencyBalance = Balance;
|
type CurrencyBalance = Balance;
|
||||||
type UnixTime = Timestamp;
|
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.
|
// to bags-list is a no-op, but the storage version will be updated.
|
||||||
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 NominationsQuota = pallet_staking::FixedNominationsQuota<MAX_QUOTA_NOMINATIONS>;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
|
use beefy_primitives::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
|
||||||
use frame_election_provider_support::{onchain, SequentialPhragmen};
|
use frame_election_provider_support::{bounds::ElectionBoundsBuilder, onchain, SequentialPhragmen};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{
|
traits::{
|
||||||
@@ -371,11 +371,12 @@ parameter_types! {
|
|||||||
// 1 hour session, 15 minutes unsigned phase, 4 offchain executions.
|
// 1 hour session, 15 minutes unsigned phase, 4 offchain executions.
|
||||||
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 4;
|
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 4;
|
||||||
|
|
||||||
/// We take the top 22500 nominators as electing voters..
|
|
||||||
pub const MaxElectingVoters: u32 = 22_500;
|
pub const MaxElectingVoters: u32 = 22_500;
|
||||||
/// ... and all of the validators as electable targets. Whilst this is the case, we cannot and
|
/// We take the top 22500 nominators as electing voters and all of the validators as electable
|
||||||
/// shall not increase the size of the validator intentions.
|
/// targets. Whilst this is the case, we cannot and shall not increase the size of the
|
||||||
pub const MaxElectableTargets: u16 = u16::MAX;
|
/// validator intentions.
|
||||||
|
pub ElectionBounds: frame_election_provider_support::bounds::ElectionBounds =
|
||||||
|
ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build();
|
||||||
// Maximum winners that can be chosen as active validators
|
// Maximum winners that can be chosen as active validators
|
||||||
pub const MaxActiveValidators: u32 = 1000;
|
pub const MaxActiveValidators: u32 = 1000;
|
||||||
|
|
||||||
@@ -398,8 +399,7 @@ impl onchain::Config for OnChainSeqPhragmen {
|
|||||||
type DataProvider = Staking;
|
type DataProvider = Staking;
|
||||||
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
|
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
|
||||||
type MaxWinners = MaxActiveValidators;
|
type MaxWinners = MaxActiveValidators;
|
||||||
type VotersBound = MaxElectingVoters;
|
type Bounds = ElectionBounds;
|
||||||
type TargetsBound = MaxElectableTargets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
|
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
|
||||||
@@ -465,9 +465,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
|||||||
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
|
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
|
||||||
type ForceOrigin = EnsureRoot<AccountId>;
|
type ForceOrigin = EnsureRoot<AccountId>;
|
||||||
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
|
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
|
||||||
type MaxElectingVoters = MaxElectingVoters;
|
|
||||||
type MaxElectableTargets = MaxElectableTargets;
|
|
||||||
type MaxWinners = MaxActiveValidators;
|
type MaxWinners = MaxActiveValidators;
|
||||||
|
type ElectionBounds = ElectionBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -508,7 +507,6 @@ parameter_types! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_staking::Config for Runtime {
|
impl pallet_staking::Config for Runtime {
|
||||||
type MaxNominations = MaxNominations;
|
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CurrencyBalance = Balance;
|
type CurrencyBalance = Balance;
|
||||||
type UnixTime = Timestamp;
|
type UnixTime = Timestamp;
|
||||||
@@ -530,6 +528,7 @@ impl pallet_staking::Config for Runtime {
|
|||||||
type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
|
type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
|
||||||
type VoterList = VoterList;
|
type VoterList = VoterList;
|
||||||
type TargetList = UseValidatorsMap<Self>;
|
type TargetList = UseValidatorsMap<Self>;
|
||||||
|
type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
type HistoryDepth = frame_support::traits::ConstU32<84>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user