Fix failing offences bench test (#13712)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2023-03-25 16:59:31 +01:00
committed by GitHub
parent 22027135eb
commit 0043ff00e2
2 changed files with 11 additions and 2 deletions
@@ -335,6 +335,12 @@ benchmarks! {
let balance_slash = |id| core::iter::once(
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Slashed{ who: id, amount: slash_amount.into() })
);
let balance_locked = |id| core::iter::once(
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Locked{ who: id, amount: slash_amount.into() })
);
let balance_unlocked = |id| core::iter::once(
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Unlocked{ who: id, amount: slash_amount.into() })
);
let chill = |id| core::iter::once(
<T as StakingConfig>::RuntimeEvent::from(StakingEvent::<T>::Chilled{ stash: id })
);
@@ -349,12 +355,15 @@ benchmarks! {
let slash_events = raw_offenders.into_iter()
.flat_map(|offender| {
let nom_slashes = offender.nominator_stashes.into_iter().flat_map(|nom| {
balance_slash(nom.clone()).map(Into::into).chain(slash(nom).map(Into::into)).map(Box::new)
balance_slash(nom.clone()).map(Into::into)
.chain(balance_unlocked(nom.clone()).map(Into::into))
.chain(slash(nom).map(Into::into)).map(Box::new)
});
let events = chill(offender.stash.clone()).map(Into::into).map(Box::new)
.chain(slash_report(offender.stash.clone()).map(Into::into).map(Box::new))
.chain(balance_slash(offender.stash.clone()).map(Into::into).map(Box::new))
.chain(balance_unlocked(offender.stash.clone()).map(Into::into).map(Box::new))
.chain(slash(offender.stash).map(Into::into).map(Box::new))
.chain(nom_slashes)
.collect::<Vec<_>>();
@@ -65,7 +65,7 @@ impl frame_system::Config for Test {
}
impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxLocks = ConstU32<128>;
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;