diff --git a/frame/assets/src/benchmarking.rs b/frame/assets/src/benchmarking.rs index db98164023d5c..63258c2f591b6 100644 --- a/frame/assets/src/benchmarking.rs +++ b/frame/assets/src/benchmarking.rs @@ -74,8 +74,6 @@ fn assert_last_event(generic_event: ::Event) { } benchmarks! { - _ { } - create { let caller: T::AccountId = whitelisted_caller(); let caller_lookup = T::Lookup::unlookup(caller.clone()); diff --git a/frame/babe/src/benchmarking.rs b/frame/babe/src/benchmarking.rs index 4d75c36669eab..087cac2ed6cc6 100644 --- a/frame/babe/src/benchmarking.rs +++ b/frame/babe/src/benchmarking.rs @@ -23,8 +23,6 @@ use frame_benchmarking::benchmarks; type Header = sp_runtime::generic::Header; benchmarks! { - _ { } - check_equivocation_proof { let x in 0 .. 1; diff --git a/frame/balances/src/benchmarking.rs b/frame/balances/src/benchmarking.rs index 249934a61b4d7..53cf273d850de 100644 --- a/frame/balances/src/benchmarking.rs +++ b/frame/balances/src/benchmarking.rs @@ -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. diff --git a/frame/benchmarking/src/lib.rs b/frame/benchmarking/src/lib.rs index 308e5285d3f61..6db8674a3d2de 100644 --- a/frame/benchmarking/src/lib.rs +++ b/frame/benchmarking/src/lib.rs @@ -88,24 +88,18 @@ pub use sp_storage::TrackedStorageKey; /// benchmarks! { /// where_clause { where T::A: From } // 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::(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 Result<(), &'static str>>, &'static str> { - $( - let $common = $common_from; - )* $( // Prepare instance let $param = components.iter() diff --git a/frame/benchmarking/src/tests.rs b/frame/benchmarking/src/tests.rs index 7ea6bfd9afa25..2cbf4b9d1950c 100644 --- a/frame/benchmarking/src/tests.rs +++ b/frame/benchmarking/src/tests.rs @@ -112,13 +112,8 @@ fn new_test_ext() -> sp_io::TestExternalities { benchmarks!{ where_clause { where ::OtherEvent: Into<::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::("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::("caller", 0, 0); }: dummy (RawOrigin::Signed(caller), b.into()) diff --git a/frame/bounties/src/benchmarking.rs b/frame/bounties/src/benchmarking.rs index 0fe479bda7bda..f6fc11ad0bf06 100644 --- a/frame/bounties/src/benchmarking.rs +++ b/frame/bounties/src/benchmarking.rs @@ -94,8 +94,6 @@ fn assert_last_event(generic_event: ::Event) { const MAX_BYTES: u32 = 16384; benchmarks! { - _ { } - propose_bounty { let d in 0 .. MAX_BYTES; diff --git a/frame/collective/src/benchmarking.rs b/frame/collective/src/benchmarking.rs index 50fab1b3e474e..bff7dad59d891 100644 --- a/frame/collective/src/benchmarking.rs +++ b/frame/collective/src/benchmarking.rs @@ -42,8 +42,7 @@ fn assert_last_event, I: Instance>(generic_event: >: } benchmarks_instance! { - _{ } - + set_members { let m in 1 .. T::MaxMembers::get(); let n in 1 .. T::MaxMembers::get(); diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index d08f0ab5e65ec..9fa365116c7a0 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -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::::process_deletion_queue_batch(Weight::max_value()) diff --git a/frame/democracy/src/benchmarking.rs b/frame/democracy/src/benchmarking.rs index 7460249b6c393..c66ce20dab87c 100644 --- a/frame/democracy/src/benchmarking.rs +++ b/frame/democracy/src/benchmarking.rs @@ -97,8 +97,6 @@ fn account_vote(b: BalanceOf) -> AccountVote> { } benchmarks! { - _ { } - propose { let p = T::MaxProposals::get(); diff --git a/frame/elections-phragmen/src/benchmarking.rs b/frame/elections-phragmen/src/benchmarking.rs index db3a8c96023a3..3ed4af2487df3 100644 --- a/frame/elections-phragmen/src/benchmarking.rs +++ b/frame/elections-phragmen/src/benchmarking.rs @@ -167,8 +167,6 @@ fn clean() { } benchmarks! { - _ {} - // -- Signed ones vote { let v in 1 .. (MAXIMUM_VOTE as u32); diff --git a/frame/example/src/lib.rs b/frame/example/src/lib.rs index 382d67263d1b0..05526d2c7a29e 100644 --- a/frame/example/src/lib.rs +++ b/frame/example/src/lib.rs @@ -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. diff --git a/frame/grandpa/src/benchmarking.rs b/frame/grandpa/src/benchmarking.rs index d91bd223a5706..5f08a5ea4bac0 100644 --- a/frame/grandpa/src/benchmarking.rs +++ b/frame/grandpa/src/benchmarking.rs @@ -25,8 +25,6 @@ use frame_system::RawOrigin; use sp_core::H256; benchmarks! { - _ { } - check_equivocation_proof { let x in 0 .. 1; diff --git a/frame/identity/src/benchmarking.rs b/frame/identity/src/benchmarking.rs index dccef494a0e88..e916bdfa50461 100644 --- a/frame/identity/src/benchmarking.rs +++ b/frame/identity/src/benchmarking.rs @@ -107,25 +107,6 @@ fn create_identity_info(num_fields: u32) -> IdentityInfo { } benchmarks! { - // These are the common parameters along with their instancing. - _ { - let r in 1 .. T::MaxRegistrars::get() => add_registrars::(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::(&caller, s)?; - }; - let x in 1 .. T::MaxAdditionalFields::get() => { - // Create their main identity with x additional fields - let info = create_identity_info::(x); - let caller: T::AccountId = whitelisted_caller(); - let caller_origin = ::Origin::from(RawOrigin::Signed(caller)); - Identity::::set_identity(caller_origin, info)?; - }; - } - add_registrar { let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::(r)?; ensure!(Registrars::::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::(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 = ::unlookup(caller.clone()); let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); - let r in ...; - let s in ...; - let x in ...; + let r in 1 .. T::MaxRegistrars::get() => add_registrars::(r)?; + let s in 1 .. T::MaxSubAccounts::get() => { + // Give them s many sub accounts + let caller: T::AccountId = whitelisted_caller(); + let _ = add_sub_accounts::(&caller, s)?; + }; + let x in 1 .. T::MaxAdditionalFields::get() => { + // Create their main identity with x additional fields + let info = create_identity_info::(x); + let caller: T::AccountId = whitelisted_caller(); + let caller_origin = ::Origin::from(RawOrigin::Signed(caller)); + Identity::::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::::max_value()); - let r in ...; - let x in ...; + let r in 1 .. T::MaxRegistrars::get() => add_registrars::(r)?; + let x in 1 .. T::MaxAdditionalFields::get() => { + // Create their main identity with x additional fields + let info = create_identity_info::(x); + let caller: T::AccountId = whitelisted_caller(); + let caller_origin = ::Origin::from(RawOrigin::Signed(caller)); + Identity::::set_identity(caller_origin, info)?; + }; }: _(RawOrigin::Signed(caller.clone()), r - 1, 10u32.into()) verify { assert_last_event::(Event::::JudgementRequested(caller, r-1).into()); @@ -240,8 +235,14 @@ benchmarks! { let caller_origin = ::Origin::from(RawOrigin::Signed(caller.clone())); let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); - let r in ...; - let x in ...; + let r in 1 .. T::MaxRegistrars::get() => add_registrars::(r)?; + let x in 1 .. T::MaxAdditionalFields::get() => { + // Create their main identity with x additional fields + let info = create_identity_info::(x); + let caller: T::AccountId = whitelisted_caller(); + let caller_origin = ::Origin::from(RawOrigin::Signed(caller)); + Identity::::set_identity(caller_origin, info)?; + }; Identity::::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::::max_value()); let r in 1 .. T::MaxRegistrars::get() - 1 => add_registrars::(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::(x); Identity::::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::(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: ::Origin = RawOrigin::Signed(target.clone()).into(); diff --git a/frame/im-online/src/benchmarking.rs b/frame/im-online/src/benchmarking.rs index 8493f2b4c6426..ef7f66307a99d 100644 --- a/frame/im-online/src/benchmarking.rs +++ b/frame/im-online/src/benchmarking.rs @@ -63,8 +63,6 @@ pub fn create_heartbeat(k: u32, e: u32) -> } benchmarks! { - _{ } - #[extra] heartbeat { let k in 1 .. MAX_KEYS; diff --git a/frame/indices/src/benchmarking.rs b/frame/indices/src/benchmarking.rs index 51182b1047753..f83e05ee9c627 100644 --- a/frame/indices/src/benchmarking.rs +++ b/frame/indices/src/benchmarking.rs @@ -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(); diff --git a/frame/merkle-mountain-range/src/benchmarking.rs b/frame/merkle-mountain-range/src/benchmarking.rs index 4a5ff4b72965c..e6b3cf7f2172c 100644 --- a/frame/merkle-mountain-range/src/benchmarking.rs +++ b/frame/merkle-mountain-range/src/benchmarking.rs @@ -25,8 +25,6 @@ use frame_benchmarking::benchmarks; use sp_std::prelude::*; benchmarks! { - _ { } - on_initialize { let x in 1 .. 1_000; diff --git a/frame/multisig/src/benchmarking.rs b/frame/multisig/src/benchmarking.rs index a257a96cacac6..748223072b99b 100644 --- a/frame/multisig/src/benchmarking.rs +++ b/frame/multisig/src/benchmarking.rs @@ -48,8 +48,6 @@ fn setup_multi(s: u32, z: u32) } benchmarks! { - _ { } - as_multi_threshold_1 { // Transaction Length let z in 0 .. 10_000; diff --git a/frame/offences/benchmarking/src/lib.rs b/frame/offences/benchmarking/src/lib.rs index 09ac820cf5c4d..f2807ba6c7a88 100644 --- a/frame/offences/benchmarking/src/lib.rs +++ b/frame/offences/benchmarking/src/lib.rs @@ -203,8 +203,6 @@ fn check_events::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 diff --git a/frame/proxy/src/benchmarking.rs b/frame/proxy/src/benchmarking.rs index b08b47123d919..29c2e475c64ff 100644 --- a/frame/proxy/src/benchmarking.rs +++ b/frame/proxy/src/benchmarking.rs @@ -80,12 +80,8 @@ fn add_announcements( } benchmarks! { - _ { - let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::(p, None)?; - } - proxy { - let p in ...; + let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::(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::::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::(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::(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::::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::(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::::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::(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::::max_value()); @@ -177,7 +173,7 @@ benchmarks! { } add_proxy { - let p in ...; + let p in 1 .. (T::MaxProxies::get() - 1).into() => add_proxies::(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::(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::(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::(p, None)?; let caller: T::AccountId = whitelisted_caller(); }: _( RawOrigin::Signed(caller.clone()), diff --git a/frame/scheduler/src/benchmarking.rs b/frame/scheduler/src/benchmarking.rs index e45551269bc5f..defc334ba7368 100644 --- a/frame/scheduler/src/benchmarking.rs +++ b/frame/scheduler/src/benchmarking.rs @@ -52,8 +52,6 @@ fn fill_schedule (when: T::BlockNumber, n: u32) -> Result<(), &'stati } benchmarks! { - _ { } - schedule { let s in 0 .. T::MaxScheduledPerBlock::get(); let when = BLOCK_NUMBER.into(); diff --git a/frame/session/benchmarking/src/lib.rs b/frame/session/benchmarking/src/lib.rs index 89afc73b6b442..8f1911c125b85 100644 --- a/frame/session/benchmarking/src/lib.rs +++ b/frame/session/benchmarking/src/lib.rs @@ -51,8 +51,6 @@ impl OnInitialize for Module { } benchmarks! { - _ { } - set_keys { let n = MAX_NOMINATIONS as u32; let (v_stash, _) = create_validator_with_nominators::( diff --git a/frame/staking/src/benchmarking.rs b/frame/staking/src/benchmarking.rs index 0ebe1eab788cf..29e71f9539864 100644 --- a/frame/staking/src/benchmarking.rs +++ b/frame/staking/src/benchmarking.rs @@ -113,8 +113,6 @@ pub fn create_validator_with_nominators( const USER_SEED: u32 = 999666; benchmarks! { - _{} - bond { let stash = create_funded_user::("stash", USER_SEED, 100); let controller = create_funded_user::("controller", USER_SEED, 100); diff --git a/frame/system/benchmarking/src/lib.rs b/frame/system/benchmarking/src/lib.rs index f60cd94a0f628..57ae998862959 100644 --- a/frame/system/benchmarking/src/lib.rs +++ b/frame/system/benchmarking/src/lib.rs @@ -38,8 +38,6 @@ pub struct Module(System); 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]; diff --git a/frame/timestamp/src/benchmarking.rs b/frame/timestamp/src/benchmarking.rs index 27294a91c526f..024e6967826cd 100644 --- a/frame/timestamp/src/benchmarking.rs +++ b/frame/timestamp/src/benchmarking.rs @@ -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. diff --git a/frame/tips/src/benchmarking.rs b/frame/tips/src/benchmarking.rs index 6e54247cdb6d4..e05afc0b2ab20 100644 --- a/frame/tips/src/benchmarking.rs +++ b/frame/tips/src/benchmarking.rs @@ -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::(r); diff --git a/frame/treasury/src/benchmarking.rs b/frame/treasury/src/benchmarking.rs index ee462cd372f53..9cb214420ca43 100644 --- a/frame/treasury/src/benchmarking.rs +++ b/frame/treasury/src/benchmarking.rs @@ -66,8 +66,7 @@ fn setup_pot_account, I: Instance>() { } benchmarks_instance! { - _ { } - + propose_spend { let (caller, value, beneficiary_lookup) = setup_proposal::(SEED); // Whitelist caller account from further DB operations. diff --git a/frame/utility/src/benchmarking.rs b/frame/utility/src/benchmarking.rs index 068d40c399be8..24de60215799f 100644 --- a/frame/utility/src/benchmarking.rs +++ b/frame/utility/src/benchmarking.rs @@ -34,8 +34,6 @@ fn assert_last_event(generic_event: ::Event) { } benchmarks! { - _ { } - batch { let c in 0 .. 1000; let mut calls: Vec<::Call> = Vec::new(); diff --git a/frame/vesting/src/benchmarking.rs b/frame/vesting/src/benchmarking.rs index 6a61a6479b111..f65011050422b 100644 --- a/frame/vesting/src/benchmarking.rs +++ b/frame/vesting/src/benchmarking.rs @@ -58,8 +58,6 @@ fn add_vesting_schedule(who: &T::AccountId) -> Result<(), &'static st } benchmarks! { - _ { } - vest_locked { let l in 0 .. MaxLocksOf::::get();