From 9795fa31435426137d91936a52cab8e50ebe2f50 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 20 Mar 2023 13:34:36 +0100 Subject: [PATCH] Hotfix NIS benchmark (#13651) * Hotfix NIS rounding error Signed-off-by: Oliver Tale-Yazdi * Also fix communal Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- frame/nis/src/benchmarking.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frame/nis/src/benchmarking.rs b/frame/nis/src/benchmarking.rs index 0cc9e7421d0e6..10fee2abe3ba9 100644 --- a/frame/nis/src/benchmarking.rs +++ b/frame/nis/src/benchmarking.rs @@ -164,6 +164,9 @@ benchmarks! { Nis::::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?; Nis::::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited()); frame_system::Pallet::::set_block_number(Receipts::::get(0).unwrap().expiry); + // FIXME: Ensure that the pallet has enough funding. This should already be the case, but + // a rounding error can cause it to fail. + T::Currency::set_balance(&Nis::::account_id(), BalanceOf::::max_value() / 10u32.into()); }: _(RawOrigin::Signed(caller.clone()), 0, None) verify { assert!(Receipts::::get(0).is_none()); @@ -182,6 +185,9 @@ benchmarks! { Nis::::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited()); frame_system::Pallet::::set_block_number(Receipts::::get(0).unwrap().expiry); Nis::::communify(RawOrigin::Signed(caller.clone()).into(), 0)?; + // FIXME: Ensure that the pallet has enough funding. This should already be the case, but + // a rounding error can cause it to fail. + T::Currency::set_balance(&Nis::::account_id(), BalanceOf::::max_value() / 10u32.into()); }: _(RawOrigin::Signed(caller.clone()), 0) verify { assert!(Receipts::::get(0).is_none());