mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
Use named events in cumulus pallets (#1260)
* Use named events * For now standardise on message_id * cargo fmt * reverting xcm changes * remove superfluous comments * renaming * updating benches
This commit is contained in:
@@ -117,7 +117,7 @@ benchmarks! {
|
||||
);
|
||||
}
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NewInvulnerables(new_invulnerables).into());
|
||||
assert_last_event::<T>(Event::NewInvulnerables{invulnerables: new_invulnerables}.into());
|
||||
}
|
||||
|
||||
set_desired_candidates {
|
||||
@@ -129,19 +129,19 @@ benchmarks! {
|
||||
);
|
||||
}
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NewDesiredCandidates(max).into());
|
||||
assert_last_event::<T>(Event::NewDesiredCandidates{desired_candidates: max}.into());
|
||||
}
|
||||
|
||||
set_candidacy_bond {
|
||||
let bond: BalanceOf<T> = T::Currency::minimum_balance() * 10u32.into();
|
||||
let bond_amount: BalanceOf<T> = T::Currency::minimum_balance() * 10u32.into();
|
||||
let origin = T::UpdateOrigin::successful_origin();
|
||||
}: {
|
||||
assert_ok!(
|
||||
<CollatorSelection<T>>::set_candidacy_bond(origin, bond.clone())
|
||||
<CollatorSelection<T>>::set_candidacy_bond(origin, bond_amount.clone())
|
||||
);
|
||||
}
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NewCandidacyBond(bond).into());
|
||||
assert_last_event::<T>(Event::NewCandidacyBond{bond_amount}.into());
|
||||
}
|
||||
|
||||
// worse case is when we have all the max-candidate slots filled except one, and we fill that
|
||||
@@ -167,7 +167,7 @@ benchmarks! {
|
||||
|
||||
}: _(RawOrigin::Signed(caller.clone()))
|
||||
verify {
|
||||
assert_last_event::<T>(Event::CandidateAdded(caller, bond / 2u32.into()).into());
|
||||
assert_last_event::<T>(Event::CandidateAdded{account_id: caller, deposit: bond / 2u32.into()}.into());
|
||||
}
|
||||
|
||||
// worse case is the last candidate leaving.
|
||||
@@ -183,7 +183,7 @@ benchmarks! {
|
||||
whitelist!(leaving);
|
||||
}: _(RawOrigin::Signed(leaving.clone()))
|
||||
verify {
|
||||
assert_last_event::<T>(Event::CandidateRemoved(leaving).into());
|
||||
assert_last_event::<T>(Event::CandidateRemoved{account_id: leaving}.into());
|
||||
}
|
||||
|
||||
// worse case is paying a non-existing candidate account.
|
||||
|
||||
@@ -248,11 +248,11 @@ pub mod pallet {
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
NewInvulnerables(Vec<T::AccountId>),
|
||||
NewDesiredCandidates(u32),
|
||||
NewCandidacyBond(BalanceOf<T>),
|
||||
CandidateAdded(T::AccountId, BalanceOf<T>),
|
||||
CandidateRemoved(T::AccountId),
|
||||
NewInvulnerables { invulnerables: Vec<T::AccountId> },
|
||||
NewDesiredCandidates { desired_candidates: u32 },
|
||||
NewCandidacyBond { bond_amount: BalanceOf<T> },
|
||||
CandidateAdded { account_id: T::AccountId, deposit: BalanceOf<T> },
|
||||
CandidateRemoved { account_id: T::AccountId },
|
||||
}
|
||||
|
||||
// Errors inform users that something went wrong.
|
||||
@@ -308,7 +308,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
<Invulnerables<T>>::put(&new);
|
||||
Self::deposit_event(Event::NewInvulnerables(new));
|
||||
Self::deposit_event(Event::NewInvulnerables { invulnerables: new });
|
||||
Ok(().into())
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ pub mod pallet {
|
||||
log::warn!("max > T::MaxCandidates; you might need to run benchmarks again");
|
||||
}
|
||||
<DesiredCandidates<T>>::put(&max);
|
||||
Self::deposit_event(Event::NewDesiredCandidates(max));
|
||||
Self::deposit_event(Event::NewDesiredCandidates { desired_candidates: max });
|
||||
Ok(().into())
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ pub mod pallet {
|
||||
) -> DispatchResultWithPostInfo {
|
||||
T::UpdateOrigin::ensure_origin(origin)?;
|
||||
<CandidacyBond<T>>::put(&bond);
|
||||
Self::deposit_event(Event::NewCandidacyBond(bond));
|
||||
Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond });
|
||||
Ok(().into())
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ pub mod pallet {
|
||||
}
|
||||
})?;
|
||||
|
||||
Self::deposit_event(Event::CandidateAdded(who, deposit));
|
||||
Self::deposit_event(Event::CandidateAdded { account_id: who, deposit });
|
||||
Ok(Some(T::WeightInfo::register_as_candidate(current_count as u32)).into())
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ pub mod pallet {
|
||||
<LastAuthoredBlock<T>>::remove(who.clone());
|
||||
Ok(candidates.len())
|
||||
})?;
|
||||
Self::deposit_event(Event::CandidateRemoved(who.clone()));
|
||||
Self::deposit_event(Event::CandidateRemoved { account_id: who.clone() });
|
||||
Ok(current_count)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user