Skip to content

Commit

Permalink
fixed benchmarks - compiler flags for trait impl
Browse files Browse the repository at this point in the history
  • Loading branch information
zees-dev committed Jan 29, 2025
1 parent e3c6e0c commit 14771ef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pallet/partner-attribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ std = [
"frame-benchmarking?/std",
]
try-runtime = ["frame-support/try-runtime"]
runtime-benchmarks = ["frame-benchmarking"]
runtime-benchmarks = ["frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks"]
6 changes: 4 additions & 2 deletions pallet/partner-attribution/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ benchmarks! {
let acc: T::AccountId = account("acc", 0, 0);
let partner_id: u128 = 1;
PartnerAttribution::<T>::register_partner_account(RawOrigin::Signed(acc.clone()).into(), acc.clone()).unwrap();
}: _(RawOrigin::Signed(acc.clone()), partner_id)

let new_acc: T::AccountId = account("caller", 0, 0);
}: _(RawOrigin::Signed(new_acc.clone()), partner_id)
verify {
let got_partner_id = Attributions::<T>::get(acc).unwrap();
let got_partner_id = Attributions::<T>::get(new_acc).unwrap();
assert_eq!(got_partner_id, partner_id);
}

Expand Down
3 changes: 2 additions & 1 deletion pallet/partner-attribution/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ impl EnsureOrigin<<Test as frame_system::Config>::RuntimeOrigin> for EnsureAny {

#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin() -> Result<<Test as frame_system::Config>::RuntimeOrigin, ()> {
Ok(RawOrigin::Root.into())
let account = frame_benchmarking::account("caller", 0, 0);
Ok(frame_system::RawOrigin::Signed(account).into())
}
}

Expand Down

0 comments on commit 14771ef

Please sign in to comment.