mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 11:45:47 +00:00
Add field names to pallet Event variants (#9993)
* convert pallet-assets events to struct types * updated events of a couple pallets * updated pallet event field names * update pallet event field names * updated events in test files * cargo fmt * minorfixes * fix assertion error * minor fix * formatting fix * fmt
This commit is contained in:
@@ -315,13 +315,13 @@ benchmarks! {
|
||||
<T as StakingConfig>::Event::from(StakingEvent::<T>::Slashed(id, BalanceOf::<T>::from(slash_amount)))
|
||||
);
|
||||
let balance_slash = |id| core::iter::once(
|
||||
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Slashed(id, slash_amount.into()))
|
||||
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Slashed{who: id, amount: slash_amount.into()})
|
||||
);
|
||||
let chill = |id| core::iter::once(
|
||||
<T as StakingConfig>::Event::from(StakingEvent::<T>::Chilled(id))
|
||||
);
|
||||
let balance_deposit = |id, amount: u32|
|
||||
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Deposit(id, amount.into()));
|
||||
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Deposit{who: id, amount: amount.into()});
|
||||
let mut first = true;
|
||||
let slash_events = raw_offenders.into_iter()
|
||||
.flat_map(|offender| {
|
||||
@@ -344,7 +344,7 @@ benchmarks! {
|
||||
balance_deposit(reporter.clone(), reward.into()).into(),
|
||||
frame_system::Event::<T>::NewAccount(reporter.clone()).into(),
|
||||
<T as BalancesConfig>::Event::from(
|
||||
pallet_balances::Event::<T>::Endowed(reporter.clone(), reward.into())
|
||||
pallet_balances::Event::<T>::Endowed{account: reporter.clone(), free_balance: reward.into()}
|
||||
).into(),
|
||||
])
|
||||
.collect::<Vec<_>>();
|
||||
@@ -371,10 +371,10 @@ benchmarks! {
|
||||
std::iter::empty()
|
||||
.chain(slash_events.into_iter().map(Into::into))
|
||||
.chain(std::iter::once(<T as OffencesConfig>::Event::from(
|
||||
pallet_offences::Event::Offence(
|
||||
UnresponsivenessOffence::<T>::ID,
|
||||
0_u32.to_le_bytes().to_vec(),
|
||||
)
|
||||
pallet_offences::Event::Offence{
|
||||
kind: UnresponsivenessOffence::<T>::ID,
|
||||
timeslot: 0_u32.to_le_bytes().to_vec(),
|
||||
}
|
||||
).into()))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ pub mod pallet {
|
||||
/// There is an offence reported of the given `kind` happened at the `session_index` and
|
||||
/// (kind-specific) time slot. This event is not deposited for duplicate slashes.
|
||||
/// \[kind, timeslot\].
|
||||
Offence(Kind, OpaqueTimeSlot),
|
||||
Offence { kind: Kind, timeslot: OpaqueTimeSlot },
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
@@ -153,7 +153,7 @@ where
|
||||
);
|
||||
|
||||
// Deposit the event.
|
||||
Self::deposit_event(Event::Offence(O::ID, time_slot.encode()));
|
||||
Self::deposit_event(Event::Offence { kind: O::ID, timeslot: time_slot.encode() });
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -114,7 +114,10 @@ fn should_deposit_event() {
|
||||
System::events(),
|
||||
vec![EventRecord {
|
||||
phase: Phase::Initialization,
|
||||
event: Event::Offences(crate::Event::Offence(KIND, time_slot.encode())),
|
||||
event: Event::Offences(crate::Event::Offence {
|
||||
kind: KIND,
|
||||
timeslot: time_slot.encode()
|
||||
}),
|
||||
topics: vec![],
|
||||
}]
|
||||
);
|
||||
@@ -145,7 +148,10 @@ fn doesnt_deposit_event_for_dups() {
|
||||
System::events(),
|
||||
vec![EventRecord {
|
||||
phase: Phase::Initialization,
|
||||
event: Event::Offences(crate::Event::Offence(KIND, time_slot.encode())),
|
||||
event: Event::Offences(crate::Event::Offence {
|
||||
kind: KIND,
|
||||
timeslot: time_slot.encode()
|
||||
}),
|
||||
topics: vec![],
|
||||
}]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user