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

Companion for 14328 #7357

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ parameter_types! {
/// Setup election pallet to support maximum winners upto 2000. This will mean Staking Pallet
/// cannot have active validators higher than this count.
pub const MaxActiveValidators: u32 = 2000;

// Minimum untrusted score auto updates at every 10 elections.
pub const MinimumUntrustedScoreUpdateInterval: Option<u32> = Some(10);
pub const MinimumUntrustedScoreMargin: Percent = Percent::from_percent(50);
}

generate_solution_type!(
Expand Down Expand Up @@ -495,6 +499,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type MaxElectingVoters = MaxElectingVoters;
type MaxElectableTargets = MaxElectableTargets;
type MaxWinners = MaxActiveValidators;
type MinimumUntrustedScoreUpdateInterval = MinimumUntrustedScoreUpdateInterval;
type MinimumUntrustedScoreMargin = MinimumUntrustedScoreMargin;
}

parameter_types! {
Expand Down
6 changes: 6 additions & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ parameter_types! {
/// Setup election pallet to support maximum winners upto 1200. This will mean Staking Pallet
/// cannot have active validators higher than this count.
pub const MaxActiveValidators: u32 = 1200;

// Minimum untrusted score on-chain update is disabled.
pub const MinimumUntrustedScoreUpdateInterval: Option<u32> = None;
pub const MinimumUntrustedScoreMargin: Percent = Percent::from_percent(50);
}

generate_solution_type!(
Expand Down Expand Up @@ -490,6 +494,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type MaxElectingVoters = MaxElectingVoters;
type MaxElectableTargets = MaxElectableTargets;
type MaxWinners = MaxActiveValidators;
type MinimumUntrustedScoreUpdateInterval = MinimumUntrustedScoreUpdateInterval;
type MinimumUntrustedScoreMargin = MinimumUntrustedScoreMargin;
}

parameter_types! {
Expand Down
7 changes: 6 additions & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ pub use pallet_election_provider_multi_phase::Call as EPMCall;
pub use pallet_staking::StakerStatus;
use pallet_staking::UseValidatorsMap;
pub use pallet_timestamp::Call as TimestampCall;
use sp_runtime::traits::Get;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
use sp_runtime::{traits::Get, Percent};

/// Constant values used within the runtime.
use westend_runtime_constants::{currency::*, fee::*, time::*};
Expand Down Expand Up @@ -379,6 +379,9 @@ parameter_types! {
// Maximum winners that can be chosen as active validators
pub const MaxActiveValidators: u32 = 1000;

// Minimum untrusted score auto updates at every 5 elections.
pub const MinimumUntrustedScoreUpdateInterval: Option<u32> = Some(5);
pub const MinimumUntrustedScoreMargin: Percent = Percent::from_percent(25);
}

frame_election_provider_support::generate_solution_type!(
Expand Down Expand Up @@ -468,6 +471,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type MaxElectingVoters = MaxElectingVoters;
type MaxElectableTargets = MaxElectableTargets;
type MaxWinners = MaxActiveValidators;
type MinimumUntrustedScoreUpdateInterval = MinimumUntrustedScoreUpdateInterval;
type MinimumUntrustedScoreMargin = MinimumUntrustedScoreMargin;
}

parameter_types! {
Expand Down