Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

companion for https://github.com/paritytech/polkadot/pull/3507 #1067

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions modules/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,14 @@ mod tests {
fn should_fail_on_weight_mismatch() {
new_test_ext().execute_with(|| {
let id = [0; 4];
let mut message =
prepare_root_message(Call::System(<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3])));
let call = Call::System(<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3]));
let call_weight = call.get_dispatch_info().weight;
let mut message = prepare_root_message(call);
message.weight = 7;
assert!(
call_weight != 7,
"needed for test to actually trigger a weight mismatch"
);

System::set_block_number(1);
let result = Dispatch::dispatch(SOURCE_CHAIN_ID, TARGET_CHAIN_ID, id, Ok(message), |_, _| unreachable!());
Expand All @@ -615,7 +620,7 @@ mod tests {
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
SOURCE_CHAIN_ID,
id,
1038000,
call_weight,
7,
)),
topics: vec![],
Expand Down