Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
feat: job identifier rework (fix benchmarks)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Quelhas authored and RomarQ committed Mar 15, 2023
1 parent 8712d3e commit 42880d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
13 changes: 7 additions & 6 deletions pallets/acurast/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,17 @@ benchmarks! {
}: _(RawOrigin::Signed(caller.clone()), job.clone())
verify {
assert_last_event::<T>(Event::<T>::JobRegistrationStored(
job, caller
job, (MultiOrigin::Acurast(caller), 1)
).into());
}

deregister {
let (caller, job) = register_job::<T>(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::<T>(Event::<T>::JobRegistrationRemoved(
job.script, caller
(MultiOrigin::Acurast(caller), local_job_id)
).into());
}

Expand All @@ -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::<T>(Event::AllowedSourcesUpdated(
caller, job, sources_update
(MultiOrigin::Acurast(caller), 1), job, sources_update
).into());
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/acurast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub mod pallet {
};
use frame_system::pallet_prelude::*;
use sp_std::prelude::*;
use std::ops::AddAssign;
use core::ops::AddAssign;

use crate::{traits::*, utils::*, JobRegistrationFor};

Expand Down
10 changes: 6 additions & 4 deletions pallets/marketplace/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -216,23 +216,25 @@ benchmarks! {
register {
let _ = advertise_helper::<T>(true);
let (caller, job) = register_helper::<T>(false);
let local_job_id = 1;
}: {
pallet_acurast::Pallet::<T>::register(RawOrigin::Signed(caller.clone()).into(), job.clone())?
}
verify {
assert_last_acurast_event::<T>(AcurastEvent::<T>::JobRegistrationStored(
job, caller
job, (MultiOrigin::Acurast(caller), local_job_id)
).into());
}

deregister {
let (caller, job) = register_helper::<T>(true);
let local_job_id = 1;
}: {
pallet_acurast::Pallet::<T>::deregister(RawOrigin::Signed(caller.clone()).into(), job.script.clone())?
pallet_acurast::Pallet::<T>::deregister(RawOrigin::Signed(caller.clone()).into(), local_job_id)?
}
verify {
assert_last_acurast_event::<T>(AcurastEvent::<T>::JobRegistrationRemoved(
job.script, caller
(MultiOrigin::Acurast(caller), local_job_id)
).into());
}

Expand Down

0 comments on commit 42880d4

Please sign in to comment.