mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 05:07:55 +00:00
Dynamic Benchmarking DB Whitelist (#6815)
* Add `get_whitelist` api * add whitelisted caller * Whitelist caller * remove caller 0 * initial piping of origin (not actual value yet) * remove attempt to pass origin around * Add whitelist for `DidUpdate` storage on `pallet_timestamp` * fix traits * only add to whitelist if !contains * PassBy not implemented error * Whitelist read/writes explicitly per key * update docs * reduce trait constraint * copy pasta * Apply suggestions from code review Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * rename functions @apopiak * missed some renaming * enable doc tests * Update docs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
use super::*;
|
||||
use frame_system::{RawOrigin, EventRecord};
|
||||
use frame_benchmarking::{benchmarks, account};
|
||||
use frame_benchmarking::{benchmarks, account, whitelisted_caller};
|
||||
|
||||
const SEED: u32 = 0;
|
||||
|
||||
@@ -43,7 +43,7 @@ benchmarks! {
|
||||
let call = frame_system::Call::remark(vec![]).into();
|
||||
calls.push(call);
|
||||
}
|
||||
let caller = account("caller", 0, SEED);
|
||||
let caller = whitelisted_caller();
|
||||
}: _(RawOrigin::Signed(caller), calls)
|
||||
verify {
|
||||
assert_last_event::<T>(Event::BatchCompleted.into())
|
||||
@@ -53,6 +53,9 @@ benchmarks! {
|
||||
let u in 0 .. 1000;
|
||||
let caller = account("caller", u, SEED);
|
||||
let call = Box::new(frame_system::Call::remark(vec![]).into());
|
||||
// Whitelist caller account from further DB operations.
|
||||
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller);
|
||||
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
|
||||
}: _(RawOrigin::Signed(caller), u as u16, call)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user