From 9443694a1975cfba32d3a568d657f22f44afefd4 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Mon, 13 Mar 2023 16:10:44 +0000 Subject: [PATCH] feat: job identifier rework (fix benchmarks) --- pallets/acurast/src/benchmarking.rs | 13 +++++++------ pallets/marketplace/src/benchmarking.rs | 10 ++++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/pallets/acurast/src/benchmarking.rs b/pallets/acurast/src/benchmarking.rs index f5aaf6bf..f3cfdb91 100644 --- a/pallets/acurast/src/benchmarking.rs +++ b/pallets/acurast/src/benchmarking.rs @@ -143,16 +143,17 @@ benchmarks! { }: _(RawOrigin::Signed(caller.clone()), job.clone()) verify { assert_last_event::(Event::::JobRegistrationStored( - job, caller + job, (MultiOrigin::Acurast(caller), 1) ).into()); } deregister { let (caller, job) = register_job::(true); - }: _(RawOrigin::Signed(caller.clone()), job.script.clone()) + let local_job_id = 1; + }: _(RawOrigin::Signed(caller.clone()), local_job_id.clone()) verify { assert_last_event::(Event::::JobRegistrationRemoved( - job.script, caller + (MultiOrigin::Acurast(caller), local_job_id) ).into()); } @@ -162,11 +163,11 @@ benchmarks! { operation: ListUpdateOperation::Add, item: account("processor", 0, SEED), }]; - - }: _(RawOrigin::Signed(caller.clone()), job.script.clone(), sources_update.clone()) + let local_job_id = 1; + }: _(RawOrigin::Signed(caller.clone()), local_job_id, sources_update.clone()) verify { assert_last_event::(Event::AllowedSourcesUpdated( - caller, job, sources_update + (MultiOrigin::Acurast(caller), 1), job, sources_update ).into()); } diff --git a/pallets/marketplace/src/benchmarking.rs b/pallets/marketplace/src/benchmarking.rs index db840e45..2ccfc664 100644 --- a/pallets/marketplace/src/benchmarking.rs +++ b/pallets/marketplace/src/benchmarking.rs @@ -11,7 +11,7 @@ use sp_runtime::BoundedVec; use sp_std::prelude::*; pub use pallet::Config; -use pallet_acurast::{Event as AcurastEvent, JobRegistrationFor, Script}; +use pallet_acurast::{Event as AcurastEvent, JobRegistrationFor, Script, MultiOrigin}; use pallet_acurast::{Pallet as Acurast, Schedule}; pub use crate::stub::*; @@ -216,23 +216,25 @@ benchmarks! { register { let _ = advertise_helper::(true); let (caller, job) = register_helper::(false); + let local_job_id = 1; }: { pallet_acurast::Pallet::::register(RawOrigin::Signed(caller.clone()).into(), job.clone())? } verify { assert_last_acurast_event::(AcurastEvent::::JobRegistrationStored( - job, caller + job, (MultiOrigin::Acurast(caller), local_job_id) ).into()); } deregister { let (caller, job) = register_helper::(true); + let local_job_id = 1; }: { - pallet_acurast::Pallet::::deregister(RawOrigin::Signed(caller.clone()).into(), job.script.clone())? + pallet_acurast::Pallet::::deregister(RawOrigin::Signed(caller.clone()).into(), local_job_id)? } verify { assert_last_acurast_event::(AcurastEvent::::JobRegistrationRemoved( - job.script, caller + (MultiOrigin::Acurast(caller), local_job_id) ).into()); }