mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 19:01:02 +00:00
EPM and staking events improvement (#13035)
* EPM and staking events improvement * Uses RawOrigin in ElectionCompute event * Refactors new phase events to PhaseTransition event * PhaseTransitioned and remove RawOrigin from event * Adds helpers for epm phase transition and staking force new * addresses review comments * nit: removes unecessary clone * fixes benchmarks Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -339,7 +339,7 @@ impl<T: Config> Pallet<T> {
|
||||
if maybe_new_era_validators.is_some() &&
|
||||
matches!(ForceEra::<T>::get(), Forcing::ForceNew)
|
||||
{
|
||||
ForceEra::<T>::put(Forcing::NotForcing);
|
||||
Self::set_force_era(Forcing::NotForcing);
|
||||
}
|
||||
|
||||
maybe_new_era_validators
|
||||
@@ -717,11 +717,18 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper to set a new `ForceEra` mode.
|
||||
pub(crate) fn set_force_era(mode: Forcing) {
|
||||
log!(info, "Setting force era mode {:?}.", mode);
|
||||
ForceEra::<T>::put(mode);
|
||||
Self::deposit_event(Event::<T>::ForceEra { mode });
|
||||
}
|
||||
|
||||
/// Ensures that at the end of the current session there will be a new era.
|
||||
pub(crate) fn ensure_new_era() {
|
||||
match ForceEra::<T>::get() {
|
||||
Forcing::ForceAlways | Forcing::ForceNew => (),
|
||||
_ => ForceEra::<T>::put(Forcing::ForceNew),
|
||||
_ => Self::set_force_era(Forcing::ForceNew),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user