Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 78c99da

Browse files
authored
Fix failing offences bench test (#13712)
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
1 parent ea72382 commit 78c99da

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

frame/offences/benchmarking/src/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ benchmarks! {
335335
let balance_slash = |id| core::iter::once(
336336
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Slashed{ who: id, amount: slash_amount.into() })
337337
);
338+
let balance_locked = |id| core::iter::once(
339+
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Locked{ who: id, amount: slash_amount.into() })
340+
);
341+
let balance_unlocked = |id| core::iter::once(
342+
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Unlocked{ who: id, amount: slash_amount.into() })
343+
);
338344
let chill = |id| core::iter::once(
339345
<T as StakingConfig>::RuntimeEvent::from(StakingEvent::<T>::Chilled{ stash: id })
340346
);
@@ -349,12 +355,15 @@ benchmarks! {
349355
let slash_events = raw_offenders.into_iter()
350356
.flat_map(|offender| {
351357
let nom_slashes = offender.nominator_stashes.into_iter().flat_map(|nom| {
352-
balance_slash(nom.clone()).map(Into::into).chain(slash(nom).map(Into::into)).map(Box::new)
358+
balance_slash(nom.clone()).map(Into::into)
359+
.chain(balance_unlocked(nom.clone()).map(Into::into))
360+
.chain(slash(nom).map(Into::into)).map(Box::new)
353361
});
354362

355363
let events = chill(offender.stash.clone()).map(Into::into).map(Box::new)
356364
.chain(slash_report(offender.stash.clone()).map(Into::into).map(Box::new))
357365
.chain(balance_slash(offender.stash.clone()).map(Into::into).map(Box::new))
366+
.chain(balance_unlocked(offender.stash.clone()).map(Into::into).map(Box::new))
358367
.chain(slash(offender.stash).map(Into::into).map(Box::new))
359368
.chain(nom_slashes)
360369
.collect::<Vec<_>>();

frame/offences/benchmarking/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl frame_system::Config for Test {
6565
}
6666

6767
impl pallet_balances::Config for Test {
68-
type MaxLocks = ();
68+
type MaxLocks = ConstU32<128>;
6969
type MaxReserves = ();
7070
type ReserveIdentifier = [u8; 8];
7171
type Balance = Balance;

0 commit comments

Comments
 (0)