mirror of
https://gitlab.com/pezkuwichain/pezkuwi-sdk.git
synced 2026-10-25 05:05:09 +00:00
fix: forward session events to Staking pallet for era management
ValidatorManager now forwards session hooks to Staking pallet: - new_session: Staking receives session changes to trigger era - start_session: Staking can initialize era stakers - end_session: Staking can finalize era rewards This fixes the issue where staking era never started because session events were not being forwarded to the Staking pallet.
This commit is contained in:
1 parent
b20735a6b0
commit
9cc8bd1095
2 files changed
+15
-2
No files matched your search
@@ -1457,6 +1457,7 @@ impl assigned_slots::Config for Runtime {
|
||||
impl validator_manager::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PrivilegedOrigin = EnsureRoot<AccountId>;
|
||||
type Staking = Staking;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -43,6 +43,9 @@ pub mod pezpallet {
|
||||
|
||||
/// Privileged origin that can add or remove validators.
|
||||
type PrivilegedOrigin: EnsureOrigin<<Self as pezframe_system::Config>::RuntimeOrigin>;
|
||||
|
||||
/// Staking pallet for forwarding session events
|
||||
type Staking: pezpallet_session::SessionManager<Self::ValidatorId>;
|
||||
}
|
||||
|
||||
#[pezpallet::event]
|
||||
@@ -103,6 +106,9 @@ pub mod pezpallet {
|
||||
|
||||
impl<T: Config> pezpallet_session::SessionManager<T::ValidatorId> for Pezpallet<T> {
|
||||
fn new_session(new_index: SessionIndex) -> Option<Vec<T::ValidatorId>> {
|
||||
// Forward to Staking pallet for era management
|
||||
let _ = T::Staking::new_session(new_index);
|
||||
|
||||
if new_index <= 1 {
|
||||
return None;
|
||||
}
|
||||
@@ -124,9 +130,15 @@ impl<T: Config> pezpallet_session::SessionManager<T::ValidatorId> for Pezpallet<
|
||||
Some(validators)
|
||||
}
|
||||
|
||||
fn end_session(_: SessionIndex) {}
|
||||
fn end_session(end_index: SessionIndex) {
|
||||
// Forward to Staking pallet
|
||||
T::Staking::end_session(end_index);
|
||||
}
|
||||
|
||||
fn start_session(_start_index: SessionIndex) {}
|
||||
fn start_session(start_index: SessionIndex) {
|
||||
// Forward to Staking pallet
|
||||
T::Staking::start_session(start_index);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> pezpallet_session::historical::SessionManager<T::ValidatorId, ()> for Pezpallet<T> {
|
||||
|
||||
Reference in new issue
Block a user