Skip to content

Commit

Permalink
Update tests for UnpaidExecution fix
Browse files Browse the repository at this point in the history
  • Loading branch information
seadanda committed Aug 16, 2024
1 parent 63cb34d commit e718c64
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ fn transact_hardcoded_weights_are_sane() {
Kusama::ext_wrapper(|| {
block_number_cursor = <Kusama as Chain>::System::block_number();
});

dbg!(&block_number_cursor);
}

// In this block we trigger assign core.
Expand Down Expand Up @@ -201,4 +199,25 @@ fn transact_hardcoded_weights_are_sane() {
]
);
});

// Here we receive and process the notify_revenue XCM with zero revenue.
CoretimeKusama::execute_with(|| {
// Hooks don't run in emulated tests - workaround.
<CoretimeKusama as CoretimeKusamaPallet>::Broker::on_initialize(
<CoretimeKusama as Chain>::System::block_number(),
);

assert_expected_events!(
CoretimeKusama,
vec![
CoretimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
// Zero revenue in first timeslice so history is immediately dropped.
CoretimeEvent::Broker(
pallet_broker::Event::HistoryDropped { when: 0, revenue: 0 }
) => {},
]
);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ fn transact_hardcoded_weights_are_sane() {
Polkadot::ext_wrapper(|| {
block_number_cursor = <Polkadot as Chain>::System::block_number();
});

dbg!(&block_number_cursor);
}

// In this block we trigger assign core.
Expand Down Expand Up @@ -201,4 +199,25 @@ fn transact_hardcoded_weights_are_sane() {
]
);
});

// Here we receive and process the notify_revenue XCM with zero revenue.
CoretimePolkadot::execute_with(|| {
// Hooks don't run in emulated tests - workaround.
<CoretimePolkadot as CoretimePolkadotPallet>::Broker::on_initialize(
<CoretimePolkadot as Chain>::System::block_number(),
);

assert_expected_events!(
CoretimePolkadot,
vec![
CoretimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
// Zero revenue in first timeslice so history is immediately dropped.
CoretimeEvent::Broker(
pallet_broker::Event::HistoryDropped { when: 0, revenue: 0 }
) => {},
]
);
});
}

0 comments on commit e718c64

Please sign in to comment.