mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Make the number of nominations configurable (#8368)
* Base features and traits. * pallet and unsigned phase * Undo bad formattings. * some formatting cleanup. * Small self-cleanup. * Make it all build * self-review * Some doc tests. * Some changes from other PR * Fix session test * Update Cargo.lock * Update frame/election-provider-multi-phase/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Some review comments * Rename + make encode/decode * Do an assert as well, just in case. * Fix build * Update frame/election-provider-multi-phase/src/unsigned.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Las comment * fix staking fuzzer. * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs * Add one last layer of feasibility check as well. * Last fixes to benchmarks * Some more docs. * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs * Some nits * It all works * Some self cleanup * Update frame/staking/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * remove most todos. * Round of self-review. * Fix migration * clean macro * Revert wrong merge * Make the number of nominations configurable * Self reivew * renmae. Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Parity Benchmarking Bot <admin@parity.io> Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
@@ -28,7 +28,10 @@ use frame_system::{RawOrigin, Pallet as System, Config as SystemConfig};
|
||||
use frame_benchmarking::{benchmarks, account, impl_benchmark_test_suite};
|
||||
use frame_support::traits::{Currency, OnInitialize, ValidatorSet, ValidatorSetWithIdentification};
|
||||
|
||||
use sp_runtime::{Perbill, traits::{Convert, StaticLookup, Saturating, UniqueSaturatedInto}};
|
||||
use sp_runtime::{
|
||||
Perbill,
|
||||
traits::{Convert, StaticLookup, Saturating, UniqueSaturatedInto},
|
||||
};
|
||||
use sp_staking::offence::{ReportOffence, Offence, OffenceDetails};
|
||||
|
||||
use pallet_balances::Config as BalancesConfig;
|
||||
@@ -39,8 +42,8 @@ use pallet_offences::{Config as OffencesConfig, Module as Offences};
|
||||
use pallet_session::historical::{Config as HistoricalConfig, IdentificationTuple};
|
||||
use pallet_session::{Config as SessionConfig, SessionManager};
|
||||
use pallet_staking::{
|
||||
Module as Staking, Config as StakingConfig, RewardDestination, ValidatorPrefs,
|
||||
Exposure, IndividualExposure, MAX_NOMINATIONS, Event as StakingEvent
|
||||
Module as Staking, Config as StakingConfig, RewardDestination, ValidatorPrefs, Exposure,
|
||||
IndividualExposure, Event as StakingEvent,
|
||||
};
|
||||
|
||||
const SEED: u32 = 0;
|
||||
@@ -236,7 +239,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(MAX_NOMINATIONS as u32);
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MAX_NOMINATIONS);
|
||||
|
||||
// Make r reporters
|
||||
let mut reporters = vec![];
|
||||
@@ -310,7 +313,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
report_offence_grandpa {
|
||||
let n in 0 .. MAX_NOMINATORS.min(MAX_NOMINATIONS as u32);
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MAX_NOMINATIONS);
|
||||
|
||||
// for grandpa equivocation reports the number of reporters
|
||||
// and offenders is always 1
|
||||
@@ -346,7 +349,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
report_offence_babe {
|
||||
let n in 0 .. MAX_NOMINATORS.min(MAX_NOMINATIONS as u32);
|
||||
let n in 0 .. MAX_NOMINATORS.min(<T as pallet_staking::Config>::MAX_NOMINATIONS);
|
||||
|
||||
// for babe equivocation reports the number of reporters
|
||||
// and offenders is always 1
|
||||
|
||||
@@ -158,6 +158,7 @@ impl onchain::Config for Test {
|
||||
}
|
||||
|
||||
impl pallet_staking::Config for Test {
|
||||
const MAX_NOMINATIONS: u32 = 16;
|
||||
type Currency = Balances;
|
||||
type UnixTime = pallet_timestamp::Pallet<Self>;
|
||||
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
|
||||
|
||||
Reference in New Issue
Block a user