mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 14:27:57 +00:00
Use proper bounded vector type for nominations (#10601)
* Use proper bounded vector type for nominations * add docs and tweak chill_other for cleanup purposes * Fix the build * remove TODO * add a bit more doc * even more docs gushc * Update frame/staking/src/pallet/mod.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Update frame/staking/src/pallet/mod.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Fix the nasty bug * also bound the Snapshot type * fix doc test * document bounded_vec * self-review * remove unused * Fix build * frame-support: repetition overload for bounded_vec Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fix * remove the need to allocate into unbounded voters etc etc * Don't expect * unbreal the build again * handle macro a bit better Co-authored-by: Zeke Mostov <z.mostov@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -24,7 +24,7 @@ mod mock;
|
||||
use sp_std::{prelude::*, vec};
|
||||
|
||||
use frame_benchmarking::{account, benchmarks};
|
||||
use frame_support::traits::{Currency, ValidatorSet, ValidatorSetWithIdentification};
|
||||
use frame_support::traits::{Currency, Get, ValidatorSet, ValidatorSetWithIdentification};
|
||||
use frame_system::{Config as SystemConfig, Pallet as System, RawOrigin};
|
||||
|
||||
use sp_runtime::{
|
||||
@@ -275,7 +275,7 @@ benchmarks! {
|
||||
let r in 1 .. MAX_REPORTERS;
|
||||
// we skip 1 offender, because in such case there is no slashing
|
||||
let o in 2 .. MAX_OFFENDERS;
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MAX_NOMINATIONS);
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MaxNominations::get());
|
||||
|
||||
// Make r reporters
|
||||
let mut reporters = vec![];
|
||||
@@ -381,7 +381,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
report_offence_grandpa {
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MAX_NOMINATIONS);
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MaxNominations::get());
|
||||
|
||||
// for grandpa equivocation reports the number of reporters
|
||||
// and offenders is always 1
|
||||
@@ -416,7 +416,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
report_offence_babe {
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MAX_NOMINATIONS);
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MaxNominations::get());
|
||||
|
||||
// for babe equivocation reports the number of reporters
|
||||
// and offenders is always 1
|
||||
|
||||
@@ -156,7 +156,7 @@ impl onchain::Config for Test {
|
||||
}
|
||||
|
||||
impl pallet_staking::Config for Test {
|
||||
const MAX_NOMINATIONS: u32 = 16;
|
||||
type MaxNominations = ConstU32<16>;
|
||||
type Currency = Balances;
|
||||
type UnixTime = pallet_timestamp::Pallet<Self>;
|
||||
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
|
||||
|
||||
Reference in New Issue
Block a user