Skip to content

Commit

Permalink
fix: revert to old hook order execution
Browse files Browse the repository at this point in the history
  • Loading branch information
wischli committed Feb 2, 2022
1 parent d43f354 commit 6363a5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
15 changes: 5 additions & 10 deletions pallets/parachain-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ construct_runtime!(
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Aura: pallet_aura::{Pallet, Storage},
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
StakePallet: stake::{Pallet, Call, Storage, Config<T>, Event<T>},
Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent},
StakePallet: stake::{Pallet, Call, Storage, Config<T>, Event<T>},
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
Aura: pallet_aura::{Pallet, Storage},
}
);

Expand Down Expand Up @@ -364,14 +364,9 @@ pub(crate) fn roll_to(n: BlockNumber, authors: Vec<Option<AccountId>>) {
if let Some(Some(author)) = authors.get((System::block_number()) as usize) {
StakePallet::note_author(*author);
}
// TODO: Remove comments after settling on hook with coworkers
// <AllPalletsReversedWithSystemFirst as
// OnFinalize<u64>>::on_finalize(System::block_number());
<AllPalletsWithSystem as OnFinalize<u64>>::on_finalize(System::block_number());
<AllPalletsReversedWithSystemFirst as OnFinalize<u64>>::on_finalize(System::block_number());
System::set_block_number(System::block_number() + 1);
<AllPalletsWithSystem as OnInitialize<u64>>::on_initialize(System::block_number());
// <AllPalletsReversedWithSystemFirst as
// OnInitialize<u64>>::on_initialize(System::block_number());
<AllPalletsReversedWithSystemFirst as OnInitialize<u64>>::on_initialize(System::block_number());
}
}

Expand Down
4 changes: 3 additions & 1 deletion runtimes/peregrine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,9 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
// Executes pallet hooks in reverse order of definition in construct_runtime
// If we want to switch to AllPalletsWithSystem, we need to reorder the staking pallets
AllPalletsReversedWithSystemFirst,
SchedulerMigrationV3,
>;

Expand Down
4 changes: 3 additions & 1 deletion runtimes/spiritnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,9 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
// Executes pallet hooks in reverse order of definition in construct_runtime
// If we want to switch to AllPalletsWithSystem, we need to reorder the staking pallets
AllPalletsReversedWithSystemFirst,
SchedulerMigrationV3,
>;

Expand Down

0 comments on commit 6363a5c

Please sign in to comment.