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:
Shawn Tabrizi
2020-08-19 18:15:50 +02:00
committed by GitHub
parent 8b5ced7fa7
commit 481ad884d6
26 changed files with 421 additions and 205 deletions
@@ -24,15 +24,13 @@ use sp_std::vec;
use sp_std::prelude::*;
use sp_core::{ChangesTrieConfiguration, storage::well_known_keys};
use sp_runtime::traits::Hash;
use frame_benchmarking::{benchmarks, account};
use frame_benchmarking::{benchmarks, whitelisted_caller};
use frame_support::traits::Get;
use frame_support::storage::{self, StorageMap};
use frame_system::{Module as System, Call, RawOrigin, DigestItemOf, AccountInfo};
mod mock;
const SEED: u32 = 0;
pub struct Module<T: Trait>(System<T>);
pub trait Trait: frame_system::Trait {}
@@ -42,7 +40,7 @@ benchmarks! {
remark {
let b in 0 .. T::MaximumBlockLength::get();
let remark_message = vec![1; b as usize];
let caller = account("caller", 0, SEED);
let caller = whitelisted_caller();
}: _(RawOrigin::Signed(caller), remark_message)
set_heap_pages {
@@ -139,7 +137,7 @@ benchmarks! {
}
suicide {
let caller: T::AccountId = account("caller", 0, SEED);
let caller: T::AccountId = whitelisted_caller();
let account_info = AccountInfo::<T::Index, T::AccountData> {
nonce: 1337.into(),
refcount: 0,