Fix benchmarks and adds CI to test them (#12068)

* Fix benchmarks and adds CI to test them

Instead of waiting for benchmarks failing in Polkadot CI, we also can just test them in Substrate :P

* Do not overflow
This commit is contained in:
Bastian Köcher
2022-08-19 13:07:14 +02:00
committed by GitHub
parent 13fa566590
commit 9d75f3e3e7
7 changed files with 40 additions and 9 deletions
@@ -305,7 +305,7 @@ benchmarks! {
verify {
let bond_amount: u32 = UniqueSaturatedInto::<u32>::unique_saturated_into(bond_amount::<T>());
let slash_amount = slash_fraction * bond_amount;
let reward_amount = slash_amount * (1 + n) / 2;
let reward_amount = slash_amount.saturating_mul(1 + n) / 2;
let reward = reward_amount / r;
let slash = |id| core::iter::once(
<T as StakingConfig>::Event::from(StakingEvent::<T>::Slashed(id, BalanceOf::<T>::from(slash_amount)))