mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 04:01:01 +00:00
Add some important events to batch & staking to ensure ease of analysis (#9462)
* Add some important events to batch & staking to ensure ease of analysis * Update frame/staking/src/pallet/mod.rs Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> * Update lib.rs * fix test Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -154,11 +154,13 @@ impl<T: Config> Pallet<T> {
|
||||
let validator_exposure_part = Perbill::from_rational(exposure.own, exposure.total);
|
||||
let validator_staking_payout = validator_exposure_part * validator_leftover_payout;
|
||||
|
||||
Self::deposit_event(Event::<T>::PayoutStarted(era, ledger.stash.clone()));
|
||||
|
||||
// We can now make total validator payout:
|
||||
if let Some(imbalance) =
|
||||
Self::make_payout(&ledger.stash, validator_staking_payout + validator_commission_payout)
|
||||
{
|
||||
Self::deposit_event(Event::<T>::Reward(ledger.stash, imbalance.peek()));
|
||||
Self::deposit_event(Event::<T>::Rewarded(ledger.stash, imbalance.peek()));
|
||||
}
|
||||
|
||||
// Track the number of payout ops to nominators. Note: `WeightInfo::payout_stakers_alive_staked`
|
||||
@@ -176,7 +178,8 @@ impl<T: Config> Pallet<T> {
|
||||
if let Some(imbalance) = Self::make_payout(&nominator.who, nominator_reward) {
|
||||
// Note: this logic does not count payouts for `RewardDestination::None`.
|
||||
nominator_payout_count += 1;
|
||||
Self::deposit_event(Event::<T>::Reward(nominator.who.clone(), imbalance.peek()));
|
||||
let e = Event::<T>::Rewarded(nominator.who.clone(), imbalance.peek());
|
||||
Self::deposit_event(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +357,7 @@ impl<T: Config> Pallet<T> {
|
||||
let issuance = T::Currency::total_issuance();
|
||||
let (validator_payout, rest) = T::EraPayout::era_payout(staked, issuance, era_duration);
|
||||
|
||||
Self::deposit_event(Event::<T>::EraPayout(active_era.index, validator_payout, rest));
|
||||
Self::deposit_event(Event::<T>::EraPaid(active_era.index, validator_payout, rest));
|
||||
|
||||
// Set ending era reward.
|
||||
<ErasValidatorReward<T>>::insert(&active_era.index, validator_payout);
|
||||
@@ -446,7 +449,7 @@ impl<T: Config> Pallet<T> {
|
||||
return None
|
||||
}
|
||||
|
||||
Self::deposit_event(Event::StakingElection);
|
||||
Self::deposit_event(Event::StakersElected);
|
||||
Some(Self::trigger_new_era(start_session_index, exposures))
|
||||
}
|
||||
|
||||
|
||||
@@ -525,17 +525,17 @@ pub mod pallet {
|
||||
/// The era payout has been set; the first balance is the validator-payout; the second is
|
||||
/// the remainder from the maximum amount of reward.
|
||||
/// \[era_index, validator_payout, remainder\]
|
||||
EraPayout(EraIndex, BalanceOf<T>, BalanceOf<T>),
|
||||
/// The staker has been rewarded by this amount. \[stash, amount\]
|
||||
Reward(T::AccountId, BalanceOf<T>),
|
||||
EraPaid(EraIndex, BalanceOf<T>, BalanceOf<T>),
|
||||
/// The nominator has been rewarded by this amount. \[stash, amount\]
|
||||
Rewarded(T::AccountId, BalanceOf<T>),
|
||||
/// One validator (and its nominators) has been slashed by the given amount.
|
||||
/// \[validator, amount\]
|
||||
Slash(T::AccountId, BalanceOf<T>),
|
||||
Slashed(T::AccountId, BalanceOf<T>),
|
||||
/// An old slashing report from a prior era was discarded because it could
|
||||
/// not be processed. \[session_index\]
|
||||
OldSlashingReportDiscarded(SessionIndex),
|
||||
/// A new set of stakers was elected.
|
||||
StakingElection,
|
||||
StakersElected,
|
||||
/// An account has bonded this amount. \[stash, amount\]
|
||||
///
|
||||
/// NOTE: This event is only emitted when funds are bonded via a dispatchable. Notably,
|
||||
@@ -553,6 +553,8 @@ pub mod pallet {
|
||||
/// An account has stopped participating as either a validator or nominator.
|
||||
/// \[stash\]
|
||||
Chilled(T::AccountId),
|
||||
/// The stakers' rewards are getting paid. \[era_index, validator_stash\]
|
||||
PayoutStarted(EraIndex, T::AccountId),
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
|
||||
Reference in New Issue
Block a user