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

Commit 628a740

Browse files
authored
FRAME: Pay trait benchmark helper should use asset kind (#14259)
* Fix Pay benchmarking helpers * Formatting
1 parent 3b1750e commit 628a740

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

frame/salary/src/benchmarking.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ mod benchmarks {
107107
System::<T>::set_block_number(System::<T>::block_number() + T::RegistrationPeriod::get());
108108

109109
let salary = T::Salary::get_salary(T::Members::rank_of(&caller).unwrap(), &caller);
110-
T::Paymaster::ensure_successful(&caller, salary);
110+
T::Paymaster::ensure_successful(&caller, (), salary);
111111

112112
#[extrinsic_call]
113113
_(RawOrigin::Signed(caller.clone()));
@@ -134,7 +134,7 @@ mod benchmarks {
134134

135135
let salary = T::Salary::get_salary(T::Members::rank_of(&caller).unwrap(), &caller);
136136
let recipient: T::AccountId = account("recipient", 0, SEED);
137-
T::Paymaster::ensure_successful(&recipient, salary);
137+
T::Paymaster::ensure_successful(&recipient, (), salary);
138138

139139
#[extrinsic_call]
140140
_(RawOrigin::Signed(caller.clone()), recipient.clone());
@@ -161,7 +161,7 @@ mod benchmarks {
161161

162162
let salary = T::Salary::get_salary(T::Members::rank_of(&caller).unwrap(), &caller);
163163
let recipient: T::AccountId = account("recipient", 0, SEED);
164-
T::Paymaster::ensure_successful(&recipient, salary);
164+
T::Paymaster::ensure_successful(&recipient, (), salary);
165165
Salary::<T, I>::payout(RawOrigin::Signed(caller.clone()).into()).unwrap();
166166
let id = match Claimant::<T, I>::get(&caller).unwrap().status {
167167
Attempted { id, .. } => id,

frame/salary/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl Pay for TestPay {
121121
STATUS.with(|s| s.borrow().get(&id).cloned().unwrap_or(PaymentStatus::Unknown))
122122
}
123123
#[cfg(feature = "runtime-benchmarks")]
124-
fn ensure_successful(_: &Self::Beneficiary, _: Self::Balance) {}
124+
fn ensure_successful(_: &Self::Beneficiary, _: Self::AssetKind, _: Self::Balance) {}
125125
#[cfg(feature = "runtime-benchmarks")]
126126
fn ensure_concluded(id: Self::Id) {
127127
set_status(id, PaymentStatus::Failure)

frame/support/src/traits/tokens/pay.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ pub trait Pay {
5656
/// Ensure that a call to pay with the given parameters will be successful if done immediately
5757
/// after this call. Used in benchmarking code.
5858
#[cfg(feature = "runtime-benchmarks")]
59-
fn ensure_successful(who: &Self::Beneficiary, amount: Self::Balance);
59+
fn ensure_successful(
60+
who: &Self::Beneficiary,
61+
asset_kind: Self::AssetKind,
62+
amount: Self::Balance,
63+
);
6064
/// Ensure that a call to `check_payment` with the given parameters will return either `Success`
6165
/// or `Failure`.
6266
#[cfg(feature = "runtime-benchmarks")]
@@ -97,7 +101,7 @@ impl<A: TypedGet, F: fungible::Mutate<A::Type>> Pay for PayFromAccount<F, A> {
97101
PaymentStatus::Success
98102
}
99103
#[cfg(feature = "runtime-benchmarks")]
100-
fn ensure_successful(_: &Self::Beneficiary, amount: Self::Balance) {
104+
fn ensure_successful(_: &Self::Beneficiary, _: Self::AssetKind, amount: Self::Balance) {
101105
<F as fungible::Mutate<_>>::mint_into(&A::get(), amount).unwrap();
102106
}
103107
#[cfg(feature = "runtime-benchmarks")]

0 commit comments

Comments
 (0)