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

Commit

Permalink
swap key order in StoredJobAssignment
Browse files Browse the repository at this point in the history
for faster access by processors
  • Loading branch information
gitsimon committed Nov 8, 2022
1 parent ab996d5 commit 42799f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pallets/marketplace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ pub mod pallet {
pub type StoredJobAssignment<T: Config> = StorageDoubleMap<
_,
Blake2_128Concat,
JobId<T::AccountId>,
Blake2_128Concat,
T::AccountId,
Blake2_128Concat,
JobId<T::AccountId>,
u8,
>;

Expand Down Expand Up @@ -329,7 +329,7 @@ pub mod pallet {
) -> Result<(), DispatchError> {
// find assignment
let job_id: JobId<T::AccountId> = (requester.clone(), fulfillment.script.clone());
<StoredJobAssignment<T>>::get(&job_id, &who)
<StoredJobAssignment<T>>::get(&who, &job_id)
.ok_or(pallet_acurast::Error::<T>::FulfillSourceNotAllowed)?;

// find job
Expand All @@ -348,7 +348,7 @@ pub mod pallet {
);

// removed fulfilled job from assigned jobs
<StoredJobAssignment<T>>::remove(&job_id, &who);
<StoredJobAssignment<T>>::remove(&who, &job_id);

// pay only after all other steps succeeded without errors because locking reward is not revertable
T::RewardManager::pay_reward(extra.reward.clone(), T::Lookup::unlookup(who.clone()))
Expand Down Expand Up @@ -435,8 +435,8 @@ pub mod pallet {
// all slots matched
for (slot, candidate) in candidates.iter().enumerate() {
<StoredJobAssignment<T>>::set(
(&who, &registration.script),
&candidate.0,
(&who, &registration.script),
Some(slot as u8),
);

Expand Down

0 comments on commit 42799f7

Please sign in to comment.