mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 07:01:03 +00:00
Benchmark Treasury Pallet (#5287)
* Start benchmarks * try_origin or root * More benches * stuck * Custom trait functions for benchmarks * finish benchmarks * Bump impl * More comments * Bump spec * Remove import * Update frame/elections-phragmen/src/lib.rs Co-Authored-By: thiolliere <gui.thiolliere@gmail.com> * Update frame/support/src/traits.rs Co-Authored-By: thiolliere <gui.thiolliere@gmail.com> * Fix merge Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -775,6 +775,18 @@ impl<T: Trait> Contains<T::AccountId> for Module<T> {
|
||||
Self::is_member(who)
|
||||
}
|
||||
fn sorted_members() -> Vec<T::AccountId> { Self::members_ids() }
|
||||
|
||||
// A special function to populate members in this pallet for passing Origin
|
||||
// checks in runtime benchmarking.
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn add(who: &T::AccountId) {
|
||||
Members::<T>::mutate(|members| {
|
||||
match members.binary_search_by(|(a, _b)| a.cmp(who)) {
|
||||
Ok(_) => (),
|
||||
Err(pos) => members.insert(pos, (who.clone(), BalanceOf::<T>::default())),
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user