Skip to content

Commit

Permalink
Backport fix staking benchmark (#6463) to stable 2412 and disable fla…
Browse files Browse the repository at this point in the history
…ky tests (#6475)

Found by @ggwpez

Fix staking benchmark, error was introduced when migrating to v2:
#6025

Also disable flaky tests similar to
#6749:
* zombienet-polkadot-functional-0017-sync-backing 
*
zombienet-polkadot-elastic-scaling-0002-elastic-scaling-doesnt-break-parachains

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
gui1117 and ggwpez authored Jan 14, 2025
1 parent 243af55 commit c850707
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ zombienet-polkadot-elastic-scaling-0001-basic-3cores-6s-blocks:
--local-dir="${LOCAL_DIR}/elastic_scaling"
--test="0001-basic-3cores-6s-blocks.zndsl"

zombienet-polkadot-elastic-scaling-0002-elastic-scaling-doesnt-break-parachains:
.zombienet-polkadot-elastic-scaling-0002-elastic-scaling-doesnt-break-parachains:
extends:
- .zombienet-polkadot-common
before_script:
Expand Down Expand Up @@ -233,7 +233,7 @@ zombienet-polkadot-functional-0015-coretime-shared-core:
--local-dir="${LOCAL_DIR}/functional"
--test="0016-approval-voting-parallel.zndsl"

zombienet-polkadot-functional-0017-sync-backing:
.zombienet-polkadot-functional-0017-sync-backing:
extends:
- .zombienet-polkadot-common
script:
Expand Down
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

0 comments on commit c850707

Please sign in to comment.