From 4bf1b51338934ef903374af7e433af3851d29239 Mon Sep 17 00:00:00 2001 From: Toufeeq Pasha <47236805+ToufeeqP@users.noreply.github.com> Date: Thu, 3 Oct 2024 10:33:23 +0530 Subject: [PATCH] Updated phragmen bounds param (#653) * updated election bounds * added MaxOnchainElectingVoters constant --- runtime/src/constants.rs | 28 +++++++++------------------- runtime/src/impls.rs | 2 +- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/runtime/src/constants.rs b/runtime/src/constants.rs index 8d6071914..21df8abc9 100644 --- a/runtime/src/constants.rs +++ b/runtime/src/constants.rs @@ -34,16 +34,6 @@ use crate::RuntimeHoldReason; /// cannot have validators higher than this count. pub type MaxAuthorities = ConstU32<100_000>; -/// cannot have active validators higher than this count. -pub type MaxActiveValidators = ConstU32<1200>; - -parameter_types! { - /// We take the top 12500 nominators as electing voters.. - pub const MaxElectingVoters: u32 = 22_500; - /// ... and all of the validators as electable targets. Whilst this is the case, we cannot and - /// shall not increase the size of the validator intentions. - pub const MaxElectableTargets: u16 = u16::MAX; -} /// Money matters. pub mod currency { @@ -255,6 +245,13 @@ pub mod staking { } parameter_types! { + /// We take the top 22500 nominators as electing voters.. + pub const MaxElectingVoters: u32 = 22_500; + /// For onchain solutions, which are used as fallback(s), we only consider top 5K nominators as electing voters + pub const MaxOnchainElectingVoters: u32 = 5000; + /// cannot have active validators higher than this count. + pub const MaxActiveValidators: u32 = 1200; + pub const MaxNominations: u32 = ::LIMIT as u32; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; @@ -286,9 +283,9 @@ pub mod staking { // Note: the EPM in this runtime runs the election on-chain. The election bounds must be // carefully set so that an election round fits in one block. pub ElectionBoundsMultiPhase: ElectionBounds = ElectionBoundsBuilder::default() - .voters_count(10_000.into()).targets_count(1_500.into()).build(); + .voters_count(MaxElectingVoters::get().into()).build(); pub ElectionBoundsOnChain: ElectionBounds = ElectionBoundsBuilder::default() - .voters_count(5_000.into()).targets_count(1_250.into()).build(); + .voters_count(MaxOnchainElectingVoters::get().into()).build(); } pub type MaxControllersInDeprecationBatch = ConstU32<5900>; @@ -301,13 +298,6 @@ pub mod staking { pub type MaxUnlockingChunks = ConstU32<32>; pub type HistoryDepth = ConstU32<84>; - // OnChain values are lower. - pub type MaxOnChainElectingVoters = ConstU32<1_024>; - pub type MaxOnChainElectableTargets = ConstU16<512>; - // The maximum winners that can be elected by the Election pallet which is equivalent to the - // maximum active validators the staking pallet can have. - pub type MaxActiveValidators = MaxAuthorities; - // signed config pub type SignedMaxSubmissions = ConstU32<16>; pub type SignedMaxRefunds = ConstU32<4>; diff --git a/runtime/src/impls.rs b/runtime/src/impls.rs index 7af3df8d9..e757555ae 100644 --- a/runtime/src/impls.rs +++ b/runtime/src/impls.rs @@ -455,7 +455,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type Fallback = onchain::OnChainExecution; type ForceOrigin = EnsureRoot; type GovernanceFallback = onchain::OnChainExecution; - type MaxWinners = constants::MaxActiveValidators; + type MaxWinners = constants::staking::MaxActiveValidators; type MinerConfig = Self; type MinerTxPriority = constants::staking::MultiPhaseUnsignedPriority; type OffchainRepeat = constants::staking::OffchainRepeat;