companion for pallet order fix. (#4181)

* 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>
This commit is contained in:
Guillaume Thiolliere
2021-12-01 12:00:20 +09:00
committed by GitHub
parent 8f75230e42
commit e16f71b7b6
10 changed files with 952 additions and 1082 deletions
+914 -1058
View File
File diff suppressed because it is too large Load Diff
@@ -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 {
@@ -570,7 +570,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
>;
impl_runtime_apis! {
@@ -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);
}
}
@@ -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]
@@ -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());
+4 -2
View File
@@ -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,
@@ -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,
@@ -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.
+4 -4
View File
@@ -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::{
@@ -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(
+4 -2
View File
@@ -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,
@@ -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,
@@ -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.
+4 -2
View File
@@ -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.
@@ -204,7 +204,7 @@ construct_runtime! {
{
System: frame_system,
// Must be before session.
// Babe must be before session.
Babe: pallet_babe,
Timestamp: pallet_timestamp,
@@ -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,
+1 -1
View File
@@ -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>;
+4 -2
View File
@@ -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,
@@ -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,
@@ -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.