Skip to content

Commit

Permalink
Fix change_signers_info benchmark (#1035)
Browse files Browse the repository at this point in the history
In #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.
  • Loading branch information
HCastano authored Aug 30, 2024
1 parent 519440e commit 624b37d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pallets/parameters/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,18 @@ benchmarks! {
change_signers_info {
let origin = T::UpdateOrigin::try_successful_origin().unwrap();
pallet_session::CurrentIndex::<T>::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::<T>::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!(
<Parameters<T>>::change_signers_info(origin, signer_info.total_signers, signer_info.threshold)
Expand Down

0 comments on commit 624b37d

Please sign in to comment.