diff --git a/modules/fee-market/src/benchmarking.rs b/modules/fee-market/src/benchmarking.rs index 84f0b7ff4..5289fdf35 100644 --- a/modules/fee-market/src/benchmarking.rs +++ b/modules/fee-market/src/benchmarking.rs @@ -21,14 +21,14 @@ use super::*; use crate::Pallet as FeeMarket; -use frame_benchmarking::{account, benchmarks}; +use frame_benchmarking::{account, benchmarks_instance_pallet}; use frame_support::assert_ok; use frame_system::RawOrigin; use sp_runtime::traits::Saturating; const SEED: u32 = 0; -fn fee_market_ready() { +fn fee_market_ready, I: 'static>() { let caller0: T::AccountId = account("source", 0, SEED); let caller1: T::AccountId = account("source", 1, SEED); let caller2: T::AccountId = account("source", 2, SEED); @@ -41,78 +41,78 @@ fn fee_market_ready() { assert_ne!(caller0, caller1); assert_ne!(caller1, caller2); - assert_ok!(>::enroll_and_lock_collateral( + assert_ok!(>::enroll_and_lock_collateral( RawOrigin::Signed(caller0).into(), collateral, None )); - assert_ok!(>::enroll_and_lock_collateral( + assert_ok!(>::enroll_and_lock_collateral( RawOrigin::Signed(caller1).into(), collateral, None )); - assert_ok!(>::enroll_and_lock_collateral( + assert_ok!(>::enroll_and_lock_collateral( RawOrigin::Signed(caller2).into(), collateral, None )); - assert_ok!(>::enroll_and_lock_collateral( + assert_ok!(>::enroll_and_lock_collateral( RawOrigin::Signed(caller3).into(), collateral, None )); - assert!(>::market_fee().is_some()); - assert_eq!(>::relayers().unwrap().len(), 4); + assert!(>::market_fee().is_some()); + assert_eq!(>::relayers().unwrap().len(), 4); } -benchmarks! { +benchmarks_instance_pallet! { enroll_and_lock_collateral { - fee_market_ready::(); + fee_market_ready::(); let relayer: T::AccountId = account("source", 100, SEED); T::Currency::make_free_balance_be(&relayer, T::CollateralPerOrder::get().saturating_mul(10u32.into())); let lock_collateral = T::CollateralPerOrder::get().saturating_mul(5u32.into()); }: enroll_and_lock_collateral(RawOrigin::Signed(relayer.clone()), lock_collateral, None) verify { - assert!(>::is_enrolled(&relayer)); - assert_eq!(>::relayers().unwrap().len(), 5); + assert!(>::is_enrolled(&relayer)); + assert_eq!(>::relayers().unwrap().len(), 5); } update_locked_collateral { - fee_market_ready::(); + fee_market_ready::(); let caller3: T::AccountId = account("source", 3, SEED); let new_collateral = T::CollateralPerOrder::get().saturating_mul(5u32.into()); }: update_locked_collateral(RawOrigin::Signed(caller3.clone()), new_collateral) verify { - let relayer = >::relayer(&caller3).unwrap(); + let relayer = >::relayer(&caller3).unwrap(); assert_eq!(relayer.collateral, T::CollateralPerOrder::get().saturating_mul(5u32.into())); } update_relay_fee { - fee_market_ready::(); + fee_market_ready::(); let caller3: T::AccountId = account("source", 3, SEED); let new_fee = T::CollateralPerOrder::get().saturating_mul(10u32.into()); }: update_relay_fee(RawOrigin::Signed(caller3.clone()), new_fee) verify { - let relayer = >::relayer(&caller3).unwrap(); + let relayer = >::relayer(&caller3).unwrap(); assert_eq!(relayer.fee, T::CollateralPerOrder::get().saturating_mul(10u32.into())); } cancel_enrollment { - fee_market_ready::(); + fee_market_ready::(); let caller1: T::AccountId = account("source", 1, SEED); }: cancel_enrollment(RawOrigin::Signed(caller1.clone())) verify { - assert!(!>::is_enrolled(&caller1)); - assert_eq!(>::relayers().unwrap().len(), 3); + assert!(!>::is_enrolled(&caller1)); + assert_eq!(>::relayers().unwrap().len(), 3); } set_slash_protect { }:set_slash_protect(RawOrigin::Root, T::CollateralPerOrder::get().saturating_mul(1u32.into())) set_assigned_relayers_number{ - fee_market_ready::(); + fee_market_ready::(); }: set_assigned_relayers_number(RawOrigin::Root, 1) verify { - assert_eq!(>::assigned_relayers().unwrap().len(), 1); + assert_eq!(>::assigned_relayers().unwrap().len(), 1); } }