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

Commit

Permalink
companion for pallet order fix. (#4181)
Browse files Browse the repository at this point in the history
* companion

* remove no-op duplicated function

* fmt

* add comment on constraint

* Run cargo update

* fix integration test

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
  • Loading branch information
3 people authored and drahnr committed Dec 1, 2021
1 parent 3acec0d commit 04ade83
Show file tree
Hide file tree
Showing 10 changed files with 949 additions and 1,079 deletions.
1,966 changes: 911 additions & 1,055 deletions Cargo.lock

Large diffs are not rendered by default.

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
17 changes: 9 additions & 8 deletions runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,10 @@ 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);
System::on_finalize(block_number);
AllPalletsWithSystem::on_finalize(block_number);
System::set_block_number(block_number + 1);
System::on_initialize(block_number + 1);
maybe_new_session(block_number + 1);
AllPallets::on_initialize(block_number + 1);
AllPalletsWithSystem::on_initialize(block_number + 1);
}
}

Expand All @@ -310,6 +308,10 @@ fn last_event() -> Event {
System::events().pop().expect("Event expected").event
}

fn contains_event(event: Event) -> bool {
System::events().iter().any(|x| x.event == event)
}

// Runs an end to end test of the auction, crowdloan, slots, and onboarding process over varying
// lease period offsets.
#[test]
Expand Down Expand Up @@ -390,10 +392,9 @@ fn basic_end_to_end_works() {

// Auction ends at block 110 + offset
run_to_block(109 + offset);
assert_eq!(
last_event(),
crowdloan::Event::<Test>::HandleBidResult(ParaId::from(para_2), Ok(())).into(),
);
assert!(contains_event(
crowdloan::Event::<Test>::HandleBidResult(ParaId::from(para_2), Ok(())).into()
));
run_to_block(110 + offset);
assert_eq!(last_event(), auctions::Event::<Test>::AuctionClosed(1).into());

Expand Down
6 changes: 4 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,7 @@ construct_runtime! {
// Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,

// Must be before session.
// Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1,

Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Expand All @@ -1489,6 +1489,8 @@ construct_runtime! {
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,

// Consensus support.
// Authorship must be before session in order to note author in the correct session and era
// for im-online and staking.
Authorship: pallet_authorship::{Pallet, Call, Storage} = 5,
Staking: pallet_staking::{Pallet, Call, Storage, Config<T>, Event<T>} = 6,
Offences: pallet_offences::{Pallet, Storage, Event} = 7,
Expand Down Expand Up @@ -1602,7 +1604,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
(SessionHistoricalPalletPrefixMigration,),
>;
/// The payload being signed in the transactions.
Expand Down
8 changes: 4 additions & 4 deletions runtime/parachains/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,8 +1229,8 @@ fn check_signature(
mod tests {
use super::*;
use crate::mock::{
new_test_ext, AccountId, AllPallets, Initializer, MockGenesisConfig, System, Test,
PUNISH_VALIDATORS_AGAINST, PUNISH_VALIDATORS_FOR, PUNISH_VALIDATORS_INCONCLUSIVE,
new_test_ext, AccountId, AllPalletsWithSystem, Initializer, MockGenesisConfig, System,
Test, PUNISH_VALIDATORS_AGAINST, PUNISH_VALIDATORS_FOR, PUNISH_VALIDATORS_INCONCLUSIVE,
REWARD_VALIDATORS,
};
use frame_support::{
Expand Down Expand Up @@ -1261,12 +1261,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
6 changes: 4 additions & 2 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ construct_runtime! {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 1,

// Must be before session.
// Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 2,

Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
Expand All @@ -1459,6 +1459,8 @@ construct_runtime! {
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 32,

// Consensus support.
// Authorship must be before session in order to note author in the correct session and era
// for im-online and staking.
Authorship: pallet_authorship::{Pallet, Call, Storage} = 6,
Staking: pallet_staking::{Pallet, Call, Storage, Config<T>, Event<T>} = 7,
Offences: pallet_offences::{Pallet, Storage, Event} = 8,
Expand Down Expand Up @@ -1558,7 +1560,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
(StakingBagsListMigrationV8, SessionHistoricalPalletPrefixMigration),
>;
/// The payload being signed in transactions.
Expand Down
6 changes: 4 additions & 2 deletions 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,
(SessionHistoricalModulePrefixMigration,),
>;
/// The payload being signed in transactions.
Expand Down Expand Up @@ -204,7 +204,7 @@ construct_runtime! {
{
System: frame_system,

// Must be before session.
// Babe must be before session.
Babe: pallet_babe,

Timestamp: pallet_timestamp,
Expand All @@ -213,6 +213,8 @@ construct_runtime! {
TransactionPayment: pallet_transaction_payment,

// Consensus support.
// Authorship must be before session in order to note author in the correct session for
// im-online.
Authorship: pallet_authorship,
Offences: pallet_offences,
Historical: session_historical,
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 @@ -715,7 +715,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
6 changes: 4 additions & 2 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ construct_runtime! {
// Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,

// Must be before session.
// Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1,

Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Expand All @@ -1051,6 +1051,8 @@ construct_runtime! {
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 26,

// Consensus support.
// Authorship must be before session in order to note author in the correct session and era
// for im-online and staking.
Authorship: pallet_authorship::{Pallet, Call, Storage} = 5,
Staking: pallet_staking::{Pallet, Call, Storage, Config<T>, Event<T>} = 6,
Offences: pallet_offences::{Pallet, Storage, Event} = 7,
Expand Down Expand Up @@ -1144,7 +1146,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
(SessionHistoricalPalletPrefixMigration,),
>;
/// The payload being signed in transactions.
Expand Down

0 comments on commit 04ade83

Please sign in to comment.