Companion for Use proper bounded vector type for nominations #10601 (#4709)

* Fixing polkadot after subtrate changes
`MAX_NOMINATIONS` was changed to `MaxNominations`

* Fixing some more places

* Apply suggestions from code review

* update lockfile for {"substrate"}

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Georges
2022-01-25 19:38:47 +00:00
committed by GitHub
parent 0f4843b10c
commit 922eb606c3
5 changed files with 172 additions and 170 deletions
+163 -163
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -545,6 +545,8 @@ parameter_types! {
pub const SlashDeferDuration: sp_staking::EraIndex = 27; pub const SlashDeferDuration: sp_staking::EraIndex = 27;
pub const MaxNominatorRewardedPerValidator: u32 = 256; pub const MaxNominatorRewardedPerValidator: u32 = 256;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
// 24
pub const MaxNominations: u32 = <NposCompactSolution24 as sp_npos_elections::NposSolution>::LIMIT as u32;
} }
type SlashCancelOrigin = EnsureOneOf< type SlashCancelOrigin = EnsureOneOf<
@@ -558,8 +560,7 @@ impl frame_election_provider_support::onchain::Config for Runtime {
} }
impl pallet_staking::Config for Runtime { impl pallet_staking::Config for Runtime {
const MAX_NOMINATIONS: u32 = type MaxNominations = MaxNominations;
<NposCompactSolution24 as sp_npos_elections::NposSolution>::LIMIT as u32;
type Currency = Balances; type Currency = Balances;
type UnixTime = Timestamp; type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote; type CurrencyToVote = CurrencyToVote;
+3 -2
View File
@@ -541,6 +541,8 @@ parameter_types! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 256; pub const MaxNominatorRewardedPerValidator: u32 = 256;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
// 16
pub const MaxNominations: u32 = <NposCompactSolution16 as sp_npos_elections::NposSolution>::LIMIT as u32;
} }
type SlashCancelOrigin = EnsureOneOf< type SlashCancelOrigin = EnsureOneOf<
@@ -554,8 +556,7 @@ impl frame_election_provider_support::onchain::Config for Runtime {
} }
impl pallet_staking::Config for Runtime { impl pallet_staking::Config for Runtime {
const MAX_NOMINATIONS: u32 = type MaxNominations = MaxNominations;
<NposCompactSolution16 as sp_npos_elections::NposSolution>::LIMIT as u32;
type Currency = Balances; type Currency = Balances;
type UnixTime = Timestamp; type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote; type CurrencyToVote = CurrencyToVote;
+1 -1
View File
@@ -324,7 +324,7 @@ impl frame_election_provider_support::onchain::Config for Runtime {
} }
impl pallet_staking::Config for Runtime { impl pallet_staking::Config for Runtime {
const MAX_NOMINATIONS: u32 = 16; type MaxNominations = frame_support::pallet_prelude::ConstU32<16>;
type Currency = Balances; type Currency = Balances;
type UnixTime = Timestamp; type UnixTime = Timestamp;
type CurrencyToVote = frame_support::traits::U128CurrencyToVote; type CurrencyToVote = frame_support::traits::U128CurrencyToVote;
+2 -2
View File
@@ -442,6 +442,7 @@ parameter_types! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64; pub const MaxNominatorRewardedPerValidator: u32 = 64;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const MaxNominations: u32 = <NposCompactSolution16 as sp_npos_elections::NposSolution>::LIMIT as u32;
} }
impl frame_election_provider_support::onchain::Config for Runtime { impl frame_election_provider_support::onchain::Config for Runtime {
@@ -450,8 +451,7 @@ impl frame_election_provider_support::onchain::Config for Runtime {
} }
impl pallet_staking::Config for Runtime { impl pallet_staking::Config for Runtime {
const MAX_NOMINATIONS: u32 = type MaxNominations = MaxNominations;
<NposCompactSolution16 as sp_npos_elections::NposSolution>::LIMIT as u32;
type Currency = Balances; type Currency = Balances;
type UnixTime = Timestamp; type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote; type CurrencyToVote = CurrencyToVote;