Skip to content
Snippets Groups Projects
Commit a62d6247 authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

update distance setup handler

parent ca975dfd
Branches
Tags
No related merge requests found
...@@ -45,7 +45,7 @@ benchmarks_instance_pallet! { ...@@ -45,7 +45,7 @@ benchmarks_instance_pallet! {
Membership::<T, I>::take(idty); Membership::<T, I>::take(idty);
let caller: T::AccountId = T::AccountIdOf::convert(idty).unwrap(); let caller: T::AccountId = T::AccountIdOf::convert(idty).unwrap();
let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into(); let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into();
T::BenchmarkSetupHandler::force_status_ok(&idty, &caller); T::BenchmarkSetupHandler::force_valid_distance_status(&idty);
}: _<T::RuntimeOrigin>(caller_origin) }: _<T::RuntimeOrigin>(caller_origin)
verify { verify {
assert_has_event::<T, I>(Event::<T, I>::MembershipAdded{member: idty, expire_on: BlockNumberFor::<T>::one() + T::MembershipPeriod::get()}.into()); assert_has_event::<T, I>(Event::<T, I>::MembershipAdded{member: idty, expire_on: BlockNumberFor::<T>::one() + T::MembershipPeriod::get()}.into());
...@@ -56,7 +56,7 @@ benchmarks_instance_pallet! { ...@@ -56,7 +56,7 @@ benchmarks_instance_pallet! {
let idty: T::IdtyId = 3.into(); let idty: T::IdtyId = 3.into();
let caller: T::AccountId = T::AccountIdOf::convert(idty).unwrap(); let caller: T::AccountId = T::AccountIdOf::convert(idty).unwrap();
let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into(); let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into();
T::BenchmarkSetupHandler::force_status_ok(&idty, &caller); T::BenchmarkSetupHandler::force_valid_distance_status(&idty);
}: _<T::RuntimeOrigin>(caller_origin) }: _<T::RuntimeOrigin>(caller_origin)
verify { verify {
assert_has_event::<T, I>(Event::<T, I>::MembershipAdded{member: idty, expire_on: BlockNumberFor::<T>::one() + T::MembershipPeriod::get()}.into()); assert_has_event::<T, I>(Event::<T, I>::MembershipAdded{member: idty, expire_on: BlockNumberFor::<T>::one() + T::MembershipPeriod::get()}.into());
......
...@@ -44,13 +44,13 @@ use std::collections::BTreeMap; ...@@ -44,13 +44,13 @@ use std::collections::BTreeMap;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
pub trait SetupBenchmark<IdtyId, AccountId> { pub trait SetupBenchmark<IdtyId, AccountId> {
fn force_status_ok(idty_index: &IdtyId, account: &AccountId); fn force_valid_distance_status(idty_index: &IdtyId);
fn add_cert(_issuer: &IdtyId, _receiver: &IdtyId); fn add_cert(_issuer: &IdtyId, _receiver: &IdtyId);
} }
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
impl<IdtyId, AccountId> SetupBenchmark<IdtyId, AccountId> for () { impl<IdtyId, AccountId> SetupBenchmark<IdtyId, AccountId> for () {
fn force_status_ok(_idty_id: &IdtyId, _account: &AccountId) {} fn force_valid_distance_status(_idty_id: &IdtyId) {}
fn add_cert(_issuer: &IdtyId, _receiver: &IdtyId) {} fn add_cert(_issuer: &IdtyId, _receiver: &IdtyId) {}
} }
......
...@@ -104,9 +104,8 @@ macro_rules! impl_benchmark_setup_handler { ...@@ -104,9 +104,8 @@ macro_rules! impl_benchmark_setup_handler {
T: pallet_certification::Config<frame_support::instances::Instance1>, T: pallet_certification::Config<frame_support::instances::Instance1>,
<T as pallet_certification::Config<frame_support::instances::Instance1>>::IdtyIndex: From<u32>, <T as pallet_certification::Config<frame_support::instances::Instance1>>::IdtyIndex: From<u32>,
{ {
fn force_status_ok( fn force_valid_distance_status(
idty_id: &IdtyIndex, idty_id: &IdtyIndex,
account: &<T as frame_system::Config>::AccountId,
) -> () { ) -> () {
let _ = pallet_distance::Pallet::<T>::do_valid_distance_status( let _ = pallet_distance::Pallet::<T>::do_valid_distance_status(
*idty_id, None *idty_id, None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment