mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +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;
|
||||
use frame_benchmarking::{benchmarks, account};
|
||||
use frame_benchmarking::{benchmarks, account, whitelisted_caller};
|
||||
use sp_runtime::traits::Bounded;
|
||||
|
||||
use crate::Module as Indices;
|
||||
@@ -35,7 +35,7 @@ benchmarks! {
|
||||
// Index being claimed
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
let caller: T::AccountId = account("caller", 0, SEED);
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
}: _(RawOrigin::Signed(caller.clone()), account_index)
|
||||
verify {
|
||||
@@ -47,7 +47,7 @@ benchmarks! {
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
// Setup accounts
|
||||
let caller: T::AccountId = account("caller", 0, SEED);
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
let recipient: T::AccountId = account("recipient", i, SEED);
|
||||
T::Currency::make_free_balance_be(&recipient, BalanceOf::<T>::max_value());
|
||||
@@ -63,7 +63,7 @@ benchmarks! {
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
// Setup accounts
|
||||
let caller: T::AccountId = account("caller", 0, SEED);
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
// Claim the index
|
||||
Indices::<T>::claim(RawOrigin::Signed(caller.clone()).into(), account_index)?;
|
||||
@@ -93,7 +93,7 @@ benchmarks! {
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
// Setup accounts
|
||||
let caller: T::AccountId = account("caller", 0, SEED);
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
// Claim the index
|
||||
Indices::<T>::claim(RawOrigin::Signed(caller.clone()).into(), account_index)?;
|
||||
|
||||
Reference in New Issue
Block a user