Skip to content

Commit 3b8f275

Browse files
gui1117actions-user
authored andcommitted
Fix staking benchmark (paritytech#6463)
Found by @ggwpez Fix staking benchmark, error was introduced when migrating to v2: paritytech#6025 --------- Co-authored-by: GitHub Action <[email protected]>
1 parent 34807f8 commit 3b8f275

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

prdoc/pr_6463.prdoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
title: Fix staking benchmark
2+
doc:
3+
- audience: Runtime Dev
4+
description: 'Fix staking benchmark, error was introduced when migrating to v2:
5+
https://github.com/paritytech/polkadot-sdk/pull/6025'
6+
crates:
7+
- name: pallet-staking
8+
bump: patch

substrate/frame/staking/src/benchmarking.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -975,20 +975,22 @@ mod benchmarks {
975975
) -> Result<(), BenchmarkError> {
976976
// number of nominator intention.
977977
let n = MaxNominators::<T>::get();
978+
create_validators_with_nominators_for_era::<T>(
979+
v,
980+
n,
981+
MaxNominationsOf::<T>::get() as usize,
982+
false,
983+
None,
984+
)?;
985+
986+
let targets;
978987

979988
#[block]
980989
{
981-
create_validators_with_nominators_for_era::<T>(
982-
v,
983-
n,
984-
MaxNominationsOf::<T>::get() as usize,
985-
false,
986-
None,
987-
)?;
990+
// default bounds are unbounded.
991+
targets = <Staking<T>>::get_npos_targets(DataProviderBounds::default());
988992
}
989993

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

994996
Ok(())

0 commit comments

Comments
 (0)