Skip to content

Commit

Permalink
Fix benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed Nov 1, 2023
1 parent a61e13f commit 715712b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pallet/staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use sp_std::prelude::*;
mod benchmarks {
// darwinia
use super::*;
// substrate
use frame_support::traits::Currency;

fn deposit_for<T>(who: &T::AccountId, count: u32) -> Vec<DepositId<T>>
where
Expand All @@ -53,7 +55,7 @@ mod benchmarks {
let a = frame_benchmarking::whitelisted_caller();

// Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655.
T::RingCurrency::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Ring::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Kton::mint(&a, UNIT).unwrap();

let deposits = deposit_for::<T>(&a, x);
Expand All @@ -70,7 +72,7 @@ mod benchmarks {
let a = frame_benchmarking::whitelisted_caller();

// Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655.
T::RingCurrency::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Ring::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Kton::mint(&a, UNIT).unwrap();

let deposits = deposit_for::<T>(&a, x);
Expand All @@ -90,7 +92,7 @@ mod benchmarks {
let a = frame_benchmarking::whitelisted_caller();

// Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655.
T::RingCurrency::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Ring::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Kton::mint(&a, UNIT).unwrap();

let deposits = deposit_for::<T>(&a, x);
Expand All @@ -112,7 +114,7 @@ mod benchmarks {
let a = frame_benchmarking::whitelisted_caller();

// Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655.
T::RingCurrency::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Ring::make_free_balance_be(&a, 1_024 * UNIT + 1);
<T as darwinia_deposit::Config>::Kton::mint(&a, UNIT).unwrap();

let deposits = deposit_for::<T>(&a, <T as Config>::MaxUnstakings::get());
Expand Down Expand Up @@ -154,7 +156,7 @@ mod benchmarks {
let a_cloned = a.clone();

// Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655.
T::RingCurrency::make_free_balance_be(&a, UNIT + 1);
<T as darwinia_deposit::Config>::Ring::make_free_balance_be(&a, UNIT + 1);

<Pallet<T>>::stake(
RawOrigin::Signed(a.clone()).into(),
Expand All @@ -177,7 +179,7 @@ mod benchmarks {
let a = frame_benchmarking::whitelisted_caller::<T::AccountId>();

// Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655.
T::RingCurrency::make_free_balance_be(&a, UNIT + 1);
<T as darwinia_deposit::Config>::Ring::make_free_balance_be(&a, UNIT + 1);

<Pallet<T>>::stake(
RawOrigin::Signed(a.clone()).into(),
Expand Down

0 comments on commit 715712b

Please sign in to comment.