From 7bc23276a76591d38a73ebc14498c1fec25d4b7a Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Aug 2024 15:22:35 -0400 Subject: [PATCH] Fix `change_signers_info` benchmark In https://github.com/entropyxyz/entropy-core/pull/978/ a couple of extra checks were added to ensure that parameters related to signing could only change so quickly. This ended up breaking one of the benchmarks since the benchmark setup used a difference that was larger than the allowed amount. I've fixed that by reading the current values from storage (set at Genesis) and updating those by the allowed amount. --- pallets/parameters/src/benchmarking.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pallets/parameters/src/benchmarking.rs b/pallets/parameters/src/benchmarking.rs index 0d24fa885..b6f630e31 100644 --- a/pallets/parameters/src/benchmarking.rs +++ b/pallets/parameters/src/benchmarking.rs @@ -55,7 +55,18 @@ benchmarks! { change_signers_info { let origin = T::UpdateOrigin::try_successful_origin().unwrap(); pallet_session::CurrentIndex::::put(1); - let signer_info = SignersSize { total_signers: 5, threshold: 3, last_session_change: 1 }; + + let SignersSize { + threshold: old_threshold, + total_signers: old_total_signers, + last_session_change: old_last_session_change, + } = SignersInfo::::get(); + + let signer_info = SignersSize { + total_signers: old_total_signers + 1, + threshold: old_threshold + 1, + last_session_change: old_last_session_change + 1, + }; }: { assert_ok!( >::change_signers_info(origin, signer_info.total_signers, signer_info.threshold)