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
@@ -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());