fix : remove _{ } syntax from benchmark macro (#7822)

* commented use of common

* hack to pass tests

* another hack

* remove all commented code

* fix the easy tests

* temp hack

* follow through comma hack until better solution

* patch macro

* missed one

* update benchmarks

* update docs

* fix docs

* removed too much

* fix changes

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Stanly Johnson
2021-01-06 07:21:02 +05:30
committed by GitHub
parent 3f629f743b
commit d2ac8bd941
28 changed files with 74 additions and 185 deletions
@@ -74,8 +74,6 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
}
benchmarks! {
_ { }
create {
let caller: T::AccountId = whitelisted_caller();
let caller_lookup = T::Lookup::unlookup(caller.clone());
-2
View File
@@ -23,8 +23,6 @@ use frame_benchmarking::benchmarks;
type Header = sp_runtime::generic::Header<u64, sp_runtime::traits::BlakeTwo256>;
benchmarks! {
_ { }
check_equivocation_proof {
let x in 0 .. 1;
@@ -33,8 +33,6 @@ const ED_MULTIPLIER: u32 = 10;
benchmarks! {
_ { }
// Benchmark `transfer` extrinsic with the worst possible conditions:
// * Transfer will kill the sender account.
// * Transfer will create the recipient account.
+23 -74
View File
@@ -88,24 +88,18 @@ pub use sp_storage::TrackedStorageKey;
/// benchmarks! {
/// where_clause { where T::A: From<u32> } // Optional line to give additional bound on `T`.
///
/// // common parameter; just one for this example.
/// // will be `1`, `MAX_LENGTH` or any value inbetween
/// _ {
/// let l in 1 .. MAX_LENGTH => initialize_l(l);
/// }
///
/// // first dispatchable: foo; this is a user dispatchable and operates on a `u8` vector of
/// // size `l`, which we allow to be initialized as usual.
/// // size `l`
/// foo {
/// let caller = account::<T>(b"caller", 0, benchmarks_seed);
/// let l = ...;
/// let l in 1 .. MAX_LENGTH => initialize_l(l);
/// }: _(Origin::Signed(caller), vec![0u8; l])
///
/// // second dispatchable: bar; this is a root dispatchable and accepts a `u8` vector of size
/// // `l`. We don't want it pre-initialized like before so we override using the `=> ()` notation.
/// // `l`.
/// // In this case, we explicitly name the call using `bar` instead of `_`.
/// bar {
/// let l = _ .. _ => ();
/// let l in 1 .. MAX_LENGTH => initialize_l(l);
/// }: bar(Origin::Root, vec![0u8; l])
///
/// // third dispatchable: baz; this is a user dispatchable. It isn't dependent on length like the
@@ -176,18 +170,11 @@ pub use sp_storage::TrackedStorageKey;
#[macro_export]
macro_rules! benchmarks {
(
$( where_clause { where $( $where_ty:ty: $where_bound:path ),* $(,)? } )?
_ {
$(
let $common:ident in $common_from:tt .. $common_to:expr => $common_instancer:expr;
)*
}
$( $rest:tt )*
) => {
$crate::benchmarks_iter!(
{ }
{ $( $( $where_ty: $where_bound ),* )? }
{ $( { $common , $common_from , $common_to , $common_instancer } )* }
{ }
( )
( )
$( $rest )*
@@ -199,18 +186,11 @@ macro_rules! benchmarks {
#[macro_export]
macro_rules! benchmarks_instance {
(
$( where_clause { where $( $where_ty:ty: $where_bound:path ),* $(,)? } )?
_ {
$(
let $common:ident in $common_from:tt .. $common_to:expr => $common_instancer:expr;
)*
}
$( $rest:tt )*
) => {
$crate::benchmarks_iter!(
{ I }
{ $( $( $where_ty: $where_bound ),* )? }
{ $( { $common , $common_from , $common_to , $common_instancer } )* }
{ }
( )
( )
$( $rest )*
@@ -221,11 +201,27 @@ macro_rules! benchmarks_instance {
#[macro_export]
#[doc(hidden)]
macro_rules! benchmarks_iter {
// detect and extract where clause:
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
where_clause { where $( $where_ty:ty: $where_bound:path ),* $(,)? }
$( $rest:tt )*
) => {
$crate::benchmarks_iter! {
{ $( $instance)? }
{ $( $where_ty: $where_bound ),* }
( $( $names )* )
( $( $names_extra )* )
$( $rest )*
}
};
// detect and extract extra tag:
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
#[extra]
@@ -235,7 +231,6 @@ macro_rules! benchmarks_iter {
$crate::benchmarks_iter! {
{ $( $instance)? }
{ $( $where_clause )* }
{ $( $common )* }
( $( $names )* )
( $( $names_extra )* $name )
$name
@@ -246,7 +241,6 @@ macro_rules! benchmarks_iter {
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* ) // This contains $( $( { $instance } )? $name:ident )*
( $( $names_extra:tt )* )
$name:ident { $( $code:tt )* }: _ ( $origin:expr $( , $arg:expr )* )
@@ -256,7 +250,6 @@ macro_rules! benchmarks_iter {
$crate::benchmarks_iter! {
{ $( $instance)? }
{ $( $where_clause )* }
{ $( $common )* }
( $( $names )* )
( $( $names_extra )* )
$name { $( $code )* }: $name ( $origin $( , $arg )* )
@@ -268,7 +261,6 @@ macro_rules! benchmarks_iter {
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
$name:ident { $( $code:tt )* }: $dispatch:ident ( $origin:expr $( , $arg:expr )* )
@@ -278,7 +270,6 @@ macro_rules! benchmarks_iter {
$crate::benchmarks_iter! {
{ $( $instance)? }
{ $( $where_clause )* }
{ $( $common )* }
( $( $names )* )
( $( $names_extra )* )
$name { $( $code )* }: {
@@ -296,7 +287,6 @@ macro_rules! benchmarks_iter {
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
$name:ident { $( $code:tt )* }: $eval:block
@@ -307,7 +297,6 @@ macro_rules! benchmarks_iter {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( $common )* }
{ }
{ $eval }
{ $( $code )* }
@@ -324,7 +313,6 @@ macro_rules! benchmarks_iter {
$crate::benchmarks_iter!(
{ $( $instance)? }
{ $( $where_clause )* }
{ $( $common )* }
( $( $names )* { $( $instance )? } $name )
( $( $names_extra )* )
$( $rest )*
@@ -334,7 +322,6 @@ macro_rules! benchmarks_iter {
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
) => {
@@ -354,7 +341,6 @@ macro_rules! benchmarks_iter {
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
$name:ident { $( $code:tt )* }: _ ( $origin:expr $( , $arg:expr )* )
@@ -363,7 +349,6 @@ macro_rules! benchmarks_iter {
$crate::benchmarks_iter! {
{ $( $instance)? }
{ $( $where_clause )* }
{ $( $common )* }
( $( $names )* )
( $( $names_extra )* )
$name { $( $code )* }: _ ( $origin $( , $arg )* )
@@ -375,7 +360,6 @@ macro_rules! benchmarks_iter {
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
$name:ident { $( $code:tt )* }: $dispatch:ident ( $origin:expr $( , $arg:expr )* )
@@ -384,7 +368,6 @@ macro_rules! benchmarks_iter {
$crate::benchmarks_iter! {
{ $( $instance)? }
{ $( $where_clause )* }
{ $( $common )* }
( $( $names )* )
( $( $names_extra )* )
$name { $( $code )* }: $dispatch ( $origin $( , $arg )* )
@@ -396,7 +379,6 @@ macro_rules! benchmarks_iter {
(
{ $( $instance:ident )? }
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
$name:ident { $( $code:tt )* }: $eval:block
@@ -405,7 +387,6 @@ macro_rules! benchmarks_iter {
$crate::benchmarks_iter!(
{ $( $instance)? }
{ $( $where_clause )* }
{ $( $common )* }
( $( $names )* )
( $( $names_extra )* )
$name { $( $code )* }: $eval
@@ -423,7 +404,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
{ $( PRE { $( $pre_parsed:tt )* } )* }
{ $eval:block }
{
@@ -436,7 +416,6 @@ macro_rules! benchmark_backend {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( $common )* }
{
$( PRE { $( $pre_parsed )* } )*
PRE { $pre_id , $pre_ty , $pre_ex }
@@ -450,7 +429,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
{ $( $parsed:tt )* }
{ $eval:block }
{
@@ -463,7 +441,6 @@ macro_rules! benchmark_backend {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( $common )* }
{
$( $parsed )*
PARAM { $param , $param_from , $param_to , $param_instancer }
@@ -478,7 +455,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( { $common:ident , $common_from:tt , $common_to:expr , $common_instancer:expr } )* }
{ $( $parsed:tt )* }
{ $eval:block }
{
@@ -491,16 +467,8 @@ macro_rules! benchmark_backend {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( { $common , $common_from , $common_to , $common_instancer } )* }
{ $( $parsed )* }
{ $eval }
{
let $param
in ({ $( let $common = $common_from; )* $param })
.. ({ $( let $common = $common_to; )* $param })
=> ({ $( let $common = || -> Result<(), &'static str> { $common_instancer ; Ok(()) }; )* $param()? });
$( $rest )*
}
$postcode
}
};
@@ -509,7 +477,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( { $common:ident , $common_from:tt , $common_to:expr , $common_instancer:expr } )* }
{ $( $parsed:tt )* }
{ $eval:block }
{
@@ -522,16 +489,8 @@ macro_rules! benchmark_backend {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( { $common , $common_from , $common_to , $common_instancer } )* }
{ $( $parsed )* }
{ $eval }
{
let $param
in ({ $( let $common = $common_from; )* $param })
.. ({ $( let $common = $common_to; )* $param })
=> $param_instancer ;
$( $rest )*
}
$postcode
}
};
@@ -540,7 +499,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
{ $( $parsed:tt )* }
{ $eval:block }
{
@@ -553,7 +511,6 @@ macro_rules! benchmark_backend {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( $common )* }
{ $( $parsed )* }
{ $eval }
{
@@ -568,7 +525,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
{ $( $parsed:tt )* }
{ $eval:block }
{
@@ -581,7 +537,6 @@ macro_rules! benchmark_backend {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( $common )* }
{ $( $parsed )* }
{ $eval }
{
@@ -596,7 +551,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( $common:tt )* }
{ $( $parsed:tt )* }
{ $eval:block }
{
@@ -609,7 +563,6 @@ macro_rules! benchmark_backend {
{ $( $instance)? }
$name
{ $( $where_clause )* }
{ $( $common )* }
{ $( $parsed )* }
{ $eval }
{
@@ -624,7 +577,6 @@ macro_rules! benchmark_backend {
{ $( $instance:ident )? }
$name:ident
{ $( $where_clause:tt )* }
{ $( { $common:ident , $common_from:tt , $common_to:expr , $common_instancer:expr } )* }
{
$( PRE { $pre_id:tt , $pre_ty:ty , $pre_ex:expr } )*
$( PARAM { $param:ident , $param_from:expr , $param_to:expr , $param_instancer:expr } )*
@@ -653,9 +605,6 @@ macro_rules! benchmark_backend {
components: &[($crate::BenchmarkParameter, u32)],
verify: bool
) -> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str> {
$(
let $common = $common_from;
)*
$(
// Prepare instance
let $param = components.iter()
+3 -8
View File
@@ -112,13 +112,8 @@ fn new_test_ext() -> sp_io::TestExternalities {
benchmarks!{
where_clause { where <T as OtherConfig>::OtherEvent: Into<<T as Config>::Event> }
_ {
// Define a common range for `b`.
let b in 1 .. 1000 => ();
}
set_value {
let b in ...;
let b in 1 .. 1000;
let caller = account::<T::AccountId>("caller", 0, 0);
}: _ (RawOrigin::Signed(caller), b.into())
verify {
@@ -126,7 +121,7 @@ benchmarks!{
}
other_name {
let b in ...;
let b in 1 .. 1000;
}: dummy (RawOrigin::None, b.into())
sort_vector {
@@ -142,7 +137,7 @@ benchmarks!{
}
bad_origin {
let b in ...;
let b in 1 .. 1000;
let caller = account::<T::AccountId>("caller", 0, 0);
}: dummy (RawOrigin::Signed(caller), b.into())
@@ -94,8 +94,6 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
const MAX_BYTES: u32 = 16384;
benchmarks! {
_ { }
propose_bounty {
let d in 0 .. MAX_BYTES;
@@ -42,8 +42,7 @@ fn assert_last_event<T: Config<I>, I: Instance>(generic_event: <T as Config<I>>:
}
benchmarks_instance! {
_{ }
set_members {
let m in 1 .. T::MaxMembers::get();
let n in 1 .. T::MaxMembers::get();
@@ -282,9 +282,6 @@ benchmarks! {
T::AccountId: AsRef<[u8]>,
}
_ {
}
// The base weight without any actual work performed apart from the setup costs.
on_initialize {}: {
Storage::<T>::process_deletion_queue_batch(Weight::max_value())
@@ -97,8 +97,6 @@ fn account_vote<T: Config>(b: BalanceOf<T>) -> AccountVote<BalanceOf<T>> {
}
benchmarks! {
_ { }
propose {
let p = T::MaxProposals::get();
@@ -167,8 +167,6 @@ fn clean<T: Config>() {
}
benchmarks! {
_ {}
// -- Signed ones
vote {
let v in 1 .. (MAXIMUM_VOTE as u32);
+2 -7
View File
@@ -655,20 +655,15 @@ mod benchmarking {
use frame_system::RawOrigin;
benchmarks!{
_ {
// Define a common range for `b`.
let b in 1 .. 1000 => ();
}
// This will measure the execution time of `accumulate_dummy` for b in [1..1000] range.
accumulate_dummy {
let b in ...;
let b in 1 .. 1000;
let caller = account("caller", 0, 0);
}: _ (RawOrigin::Signed(caller), b.into())
// This will measure the execution time of `set_dummy` for b in [1..1000] range.
set_dummy {
let b in ...;
let b in 1 .. 1000;
}: set_dummy (RawOrigin::Root, b.into())
// This will measure the execution time of `set_dummy` for b in [1..10] range.
@@ -25,8 +25,6 @@ use frame_system::RawOrigin;
use sp_core::H256;
benchmarks! {
_ { }
check_equivocation_proof {
let x in 0 .. 1;
+35 -36
View File
@@ -107,25 +107,6 @@ fn create_identity_info<T: Config>(num_fields: u32) -> IdentityInfo {
}
benchmarks! {
// These are the common parameters along with their instancing.
_ {
let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
// extra parameter for the set_subs bench for previous sub accounts
let p in 1 .. T::MaxSubAccounts::get() => ();
let s in 1 .. T::MaxSubAccounts::get() => {
// Give them s many sub accounts
let caller: T::AccountId = whitelisted_caller();
let _ = add_sub_accounts::<T>(&caller, s)?;
};
let x in 1 .. T::MaxAdditionalFields::get() => {
// Create their main identity with x additional fields
let info = create_identity_info::<T>(x);
let caller: T::AccountId = whitelisted_caller();
let caller_origin = <T as frame_system::Config>::Origin::from(RawOrigin::Signed(caller));
Identity::<T>::set_identity(caller_origin, info)?;
};
}
add_registrar {
let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;
ensure!(Registrars::<T>::get().len() as u32 == r, "Registrars not set up correctly.");
@@ -135,10 +116,8 @@ benchmarks! {
}
set_identity {
let r in ...;
// This X doesn't affect the caller ID up front like with the others, so we don't use the
// standard preparation.
let x in _ .. _ => ();
let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
let x in 1 .. T::MaxAdditionalFields::get();
let caller = {
// The target user
let caller: T::AccountId = whitelisted_caller();
@@ -204,9 +183,19 @@ benchmarks! {
let caller_lookup = <T::Lookup as StaticLookup>::unlookup(caller.clone());
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let r in ...;
let s in ...;
let x in ...;
let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
let s in 1 .. T::MaxSubAccounts::get() => {
// Give them s many sub accounts
let caller: T::AccountId = whitelisted_caller();
let _ = add_sub_accounts::<T>(&caller, s)?;
};
let x in 1 .. T::MaxAdditionalFields::get() => {
// Create their main identity with x additional fields
let info = create_identity_info::<T>(x);
let caller: T::AccountId = whitelisted_caller();
let caller_origin = <T as frame_system::Config>::Origin::from(RawOrigin::Signed(caller));
Identity::<T>::set_identity(caller_origin, info)?;
};
// User requests judgement from all the registrars, and they approve
for i in 0..r {
@@ -228,8 +217,14 @@ benchmarks! {
let caller: T::AccountId = whitelisted_caller();
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let r in ...;
let x in ...;
let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
let x in 1 .. T::MaxAdditionalFields::get() => {
// Create their main identity with x additional fields
let info = create_identity_info::<T>(x);
let caller: T::AccountId = whitelisted_caller();
let caller_origin = <T as frame_system::Config>::Origin::from(RawOrigin::Signed(caller));
Identity::<T>::set_identity(caller_origin, info)?;
};
}: _(RawOrigin::Signed(caller.clone()), r - 1, 10u32.into())
verify {
assert_last_event::<T>(Event::<T>::JudgementRequested(caller, r-1).into());
@@ -240,8 +235,14 @@ benchmarks! {
let caller_origin = <T as frame_system::Config>::Origin::from(RawOrigin::Signed(caller.clone()));
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let r in ...;
let x in ...;
let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
let x in 1 .. T::MaxAdditionalFields::get() => {
// Create their main identity with x additional fields
let info = create_identity_info::<T>(x);
let caller: T::AccountId = whitelisted_caller();
let caller_origin = <T as frame_system::Config>::Origin::from(RawOrigin::Signed(caller));
Identity::<T>::set_identity(caller_origin, info)?;
};
Identity::<T>::request_judgement(caller_origin, r - 1, 10u32.into())?;
}: _(RawOrigin::Signed(caller.clone()), r - 1)
@@ -308,8 +309,7 @@ benchmarks! {
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::<T>(r)?;
// For this x, it's the user identity that gts the fields, not the caller.
let x in _ .. _ => {
let x in 1 .. T::MaxAdditionalFields::get() => {
let info = create_identity_info::<T>(x);
Identity::<T>::set_identity(user_origin.clone(), info)?;
};
@@ -322,10 +322,9 @@ benchmarks! {
}
kill_identity {
let r in ...;
// Setting up our own account below.
let s in _ .. _ => {};
let x in _ .. _ => {};
let r in 1 .. T::MaxRegistrars::get() => add_registrars::<T>(r)?;
let s in 1 .. T::MaxSubAccounts::get();
let x in 1 .. T::MaxAdditionalFields::get();
let target: T::AccountId = account("target", 0, SEED);
let target_origin: <T as frame_system::Config>::Origin = RawOrigin::Signed(target.clone()).into();
@@ -63,8 +63,6 @@ pub fn create_heartbeat<T: Config>(k: u32, e: u32) ->
}
benchmarks! {
_{ }
#[extra]
heartbeat {
let k in 1 .. MAX_KEYS;
@@ -29,8 +29,6 @@ use crate::Module as Indices;
const SEED: u32 = 0;
benchmarks! {
_ { }
claim {
let account_index = T::AccountIndex::from(SEED);
let caller: T::AccountId = whitelisted_caller();
@@ -25,8 +25,6 @@ use frame_benchmarking::benchmarks;
use sp_std::prelude::*;
benchmarks! {
_ { }
on_initialize {
let x in 1 .. 1_000;
@@ -48,8 +48,6 @@ fn setup_multi<T: Config>(s: u32, z: u32)
}
benchmarks! {
_ { }
as_multi_threshold_1 {
// Transaction Length
let z in 0 .. 10_000;
@@ -203,8 +203,6 @@ fn check_events<T: Config, I: Iterator<Item = <T as SystemConfig>::Event>>(expec
}
benchmarks! {
_ { }
report_offence_im_online {
let r in 1 .. MAX_REPORTERS;
// we skip 1 offender, because in such case there is no slashing
+9 -13
View File
@@ -80,12 +80,8 @@ fn add_announcements<T: Config>(
}
benchmarks! {
_ {
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
}
proxy {
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
@@ -99,7 +95,7 @@ benchmarks! {
proxy_announced {
let a in 0 .. T::MaxPending::get() - 1;
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("anonymous", 0, SEED);
let delegate: T::AccountId = account("target", p - 1, SEED);
@@ -120,7 +116,7 @@ benchmarks! {
remove_announcement {
let a in 0 .. T::MaxPending::get() - 1;
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
@@ -141,7 +137,7 @@ benchmarks! {
reject_announcement {
let a in 0 .. T::MaxPending::get() - 1;
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
@@ -162,7 +158,7 @@ benchmarks! {
announce {
let a in 0 .. T::MaxPending::get() - 1;
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
@@ -177,7 +173,7 @@ benchmarks! {
}
add_proxy {
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
}: _(
RawOrigin::Signed(caller.clone()),
@@ -191,7 +187,7 @@ benchmarks! {
}
remove_proxy {
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
}: _(
RawOrigin::Signed(caller.clone()),
@@ -205,7 +201,7 @@ benchmarks! {
}
remove_proxies {
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
}: _(RawOrigin::Signed(caller.clone()))
verify {
@@ -214,7 +210,7 @@ benchmarks! {
}
anonymous {
let p in ...;
let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
}: _(
RawOrigin::Signed(caller.clone()),
@@ -52,8 +52,6 @@ fn fill_schedule<T: Config> (when: T::BlockNumber, n: u32) -> Result<(), &'stati
}
benchmarks! {
_ { }
schedule {
let s in 0 .. T::MaxScheduledPerBlock::get();
let when = BLOCK_NUMBER.into();
@@ -51,8 +51,6 @@ impl<T: Config> OnInitialize<T::BlockNumber> for Module<T> {
}
benchmarks! {
_ { }
set_keys {
let n = MAX_NOMINATIONS as u32;
let (v_stash, _) = create_validator_with_nominators::<T>(
@@ -113,8 +113,6 @@ pub fn create_validator_with_nominators<T: Config>(
const USER_SEED: u32 = 999666;
benchmarks! {
_{}
bond {
let stash = create_funded_user::<T>("stash", USER_SEED, 100);
let controller = create_funded_user::<T>("controller", USER_SEED, 100);
@@ -38,8 +38,6 @@ pub struct Module<T: Config>(System<T>);
pub trait Config: frame_system::Config {}
benchmarks! {
_ { }
remark {
let b in 0 .. *T::BlockLength::get().max.get(DispatchClass::Normal) as u32;
let remark_message = vec![1; b as usize];
@@ -30,8 +30,6 @@ use crate::Module as Timestamp;
const MAX_TIME: u32 = 100;
benchmarks! {
_ { }
set {
let t = MAX_TIME;
// Ignore write to `DidUpdate` since it transient.
-2
View File
@@ -89,8 +89,6 @@ const MAX_BYTES: u32 = 16384;
const MAX_TIPPERS: u32 = 100;
benchmarks! {
_ { }
report_awesome {
let r in 0 .. MAX_BYTES;
let (caller, reason, awesome_person) = setup_awesome::<T>(r);
+1 -2
View File
@@ -66,8 +66,7 @@ fn setup_pot_account<T: Config<I>, I: Instance>() {
}
benchmarks_instance! {
_ { }
propose_spend {
let (caller, value, beneficiary_lookup) = setup_proposal::<T, _>(SEED);
// Whitelist caller account from further DB operations.
@@ -34,8 +34,6 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
}
benchmarks! {
_ { }
batch {
let c in 0 .. 1000;
let mut calls: Vec<<T as Config>::Call> = Vec::new();
@@ -58,8 +58,6 @@ fn add_vesting_schedule<T: Config>(who: &T::AccountId) -> Result<(), &'static st
}
benchmarks! {
_ { }
vest_locked {
let l in 0 .. MaxLocksOf::<T>::get();