Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

companion for pallet order fix. #4181

Merged
merged 9 commits into from
Dec 1, 2021
Merged
9 changes: 7 additions & 2 deletions bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,13 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive =
frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPallets>;
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
>;

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion bridges/bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
>;

impl_runtime_apis! {
Expand Down
4 changes: 2 additions & 2 deletions runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,12 @@ fn run_to_block(n: u32) {
assert!(System::block_number() < n);
while System::block_number() < n {
let block_number = System::block_number();
AllPallets::on_finalize(block_number);
AllPalletsWithSystem::on_finalize(block_number);
System::on_finalize(block_number);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System::on_finalize is inside AllPalletsWithSystem now

System::set_block_number(block_number + 1);
System::on_initialize(block_number + 1);
thiolliere marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System::on_initialize is now inside AllPalletsWithSystem. And it is no-op so having it after is fine.

maybe_new_session(block_number + 1);
AllPallets::on_initialize(block_number + 1);
AllPalletsWithSystem::on_initialize(block_number + 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So here we have switched from reverse order, to not-reversed order. I was expecting this to cause some items in construct_runtime to be swapped. How so?

Copy link
Contributor Author

@thiolliere thiolliere Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only constraint I have found are those I put into comment, and switching to no-reversed order actually fix them.
I believe than currently the block producer of the last block of an era doesn't get points (except if he is elected in the next era) and also the block producer of last block of a session cannot tell he was online.

because pallet-authoship is executed after pallet-session.

About babe and session AFAICT the order is not relevant, all cases are handled in their implementation

(),
>;
/// The payload being signed in the transactions.
Expand Down
6 changes: 3 additions & 3 deletions runtime/parachains/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ fn check_signature(
mod tests {
use super::*;
use crate::mock::{
new_test_ext, AccountId, AllPallets, Initializer, MockGenesisConfig, System, Test,
new_test_ext, AccountId, AllPalletsWithSystem, Initializer, MockGenesisConfig, System, Test,
PUNISH_VALIDATORS_AGAINST, PUNISH_VALIDATORS_FOR, PUNISH_VALIDATORS_INCONCLUSIVE,
REWARD_VALIDATORS,
};
Expand Down Expand Up @@ -1240,12 +1240,12 @@ mod tests {
// circumvent requirement to have bitfields and headers in block for testing purposes
crate::paras_inherent::Included::<Test>::set(Some(()));

AllPallets::on_finalize(b);
AllPalletsWithSystem::on_finalize(b);
System::finalize();
}

System::initialize(&(b + 1), &Default::default(), &Default::default(), InitKind::Full);
AllPallets::on_initialize(b + 1);
AllPalletsWithSystem::on_initialize(b + 1);

if let Some(new_session) = new_session(b + 1) {
Initializer::test_trigger_on_new_session(
Expand Down
2 changes: 1 addition & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
StakingBagsListMigrationV8,
>;
/// The payload being signed in transactions.
Expand Down
2 changes: 1 addition & 1 deletion runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
(),
>;
/// The payload being signed in transactions.
Expand Down
2 changes: 1 addition & 1 deletion runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
(),
>;
/// The payload being signed in transactions.
Expand Down