Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport fix staking benchmark (#6463) to stable 2412 #6475

Open
wants to merge 3 commits into
base: stable2412
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
8 changes: 8 additions & 0 deletions prdoc/pr_6475.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Fix staking benchmark
doc:
- audience: Runtime Dev
description: 'Fix staking benchmark, error was introduced when migrating to v2:
https://github.com/paritytech/polkadot-sdk/pull/6025'
crates:
- name: pallet-staking
bump: patch
20 changes: 11 additions & 9 deletions substrate/frame/staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -975,20 +975,22 @@ mod benchmarks {
) -> Result<(), BenchmarkError> {
// number of nominator intention.
let n = MaxNominators::<T>::get();
create_validators_with_nominators_for_era::<T>(
v,
n,
MaxNominationsOf::<T>::get() as usize,
false,
None,
)?;

let targets;

#[block]
{
create_validators_with_nominators_for_era::<T>(
v,
n,
MaxNominationsOf::<T>::get() as usize,
false,
None,
)?;
// default bounds are unbounded.
targets = <Staking<T>>::get_npos_targets(DataProviderBounds::default());
}

// default bounds are unbounded.
let targets = <Staking<T>>::get_npos_targets(DataProviderBounds::default());
assert_eq!(targets.len() as u32, v);

Ok(())
Expand Down
Loading