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:
Gonçalo Pestana
2023-01-09 16:06:47 +00:00
committed by GitHub
parent b929e0282d
commit fcdd8a88ad
7 changed files with 369 additions and 124 deletions
+5 -3
View File
@@ -714,6 +714,8 @@ pub mod pallet {
PayoutStarted { era_index: EraIndex, validator_stash: T::AccountId },
/// A validator has set their preferences.
ValidatorPrefsSet { stash: T::AccountId, prefs: ValidatorPrefs },
/// A new force era mode was set.
ForceEra { mode: Forcing },
}
#[pallet::error]
@@ -1377,7 +1379,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::force_no_eras())]
pub fn force_no_eras(origin: OriginFor<T>) -> DispatchResult {
ensure_root(origin)?;
ForceEra::<T>::put(Forcing::ForceNone);
Self::set_force_era(Forcing::ForceNone);
Ok(())
}
@@ -1401,7 +1403,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::force_new_era())]
pub fn force_new_era(origin: OriginFor<T>) -> DispatchResult {
ensure_root(origin)?;
ForceEra::<T>::put(Forcing::ForceNew);
Self::set_force_era(Forcing::ForceNew);
Ok(())
}
@@ -1452,7 +1454,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::force_new_era_always())]
pub fn force_new_era_always(origin: OriginFor<T>) -> DispatchResult {
ensure_root(origin)?;
ForceEra::<T>::put(Forcing::ForceAlways);
Self::set_force_era(Forcing::ForceAlways);
Ok(())
}