Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
try using dynamic whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi committed Aug 5, 2020
1 parent d2be2d1 commit 9d50761
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion frame/balances/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ benchmarks! {
// * Transfer will kill the sender account.
// * Transfer will create the recipient account.
transfer {
let u in 0 .. 1000;

let existential_deposit = T::ExistentialDeposit::get();
let caller = account("caller", 0, SEED);
let caller = account("caller", u, SEED);

__whitelist.append(frame_system::Account::<T>::hashed_key_for(caller));

// Give some multiple of the existential deposit + creation fee + transfer fee
let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into());
Expand Down
5 changes: 3 additions & 2 deletions frame/benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ macro_rules! benchmark_backend {
]
}

fn instance(&self, mut _whitelist: &[Vec<u8>], components: &[($crate::BenchmarkParameter, u32)])
fn instance(&self, mut __whitelist: &[Vec<u8>], components: &[($crate::BenchmarkParameter, u32)])
-> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>
{
$(
Expand All @@ -603,14 +603,15 @@ macro_rules! benchmark_backend {

// Add whitelist to DB
#[cfg(not(test))]
$crate::benchmarking::set_whitelist(_whitelist.to_vec());
$crate::benchmarking::set_whitelist(__whitelist.to_vec());

Ok(Box::new(move || -> Result<(), &'static str> { $eval; Ok(()) }))
}

fn verify(&self, components: &[($crate::BenchmarkParameter, u32)])
-> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>
{
let mut __whitelist = Vec::<Vec<u8>>::new();
$(
let $common = $common_from;
)*
Expand Down

0 comments on commit 9d50761

Please sign in to comment.