Skip to content

Commit 82d58e3

Browse files
committed
fix bench
1 parent f3c83b7 commit 82d58e3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

substrate/frame/staking/src/benchmarking.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1156,12 +1156,8 @@ mod benchmarks {
11561156

11571157
#[benchmark]
11581158
fn manual_slash() -> Result<(), BenchmarkError> {
1159-
let era = EraIndex::zero();
1160-
CurrentEra::<T>::put(era);
1161-
ErasStartSessionIndex::<T>::insert(era, 0);
1162-
ActiveEra::<T>::put(ActiveEraInfo { index: era, start: None });
1163-
11641159
// Create a validator with nominators
1160+
// This will add exposure for our validator in the current era.
11651161
let (validator_stash, _nominators) = create_validator_with_nominators::<T>(
11661162
T::MaxExposurePageSize::get() as u32,
11671163
T::MaxExposurePageSize::get() as u32,
@@ -1170,6 +1166,8 @@ mod benchmarks {
11701166
RewardDestination::Staked,
11711167
)?;
11721168

1169+
let era = CurrentEra::<T>::get().unwrap();
1170+
ActiveEra::<T>::put(ActiveEraInfo { index: era, start: None });
11731171
let slash_fraction = Perbill::from_percent(10);
11741172

11751173
#[extrinsic_call]

0 commit comments

Comments
 (0)