diff --git a/modules/dispatch/src/lib.rs b/modules/dispatch/src/lib.rs index e9bf75686bb..46f05b487c3 100644 --- a/modules/dispatch/src/lib.rs +++ b/modules/dispatch/src/lib.rs @@ -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(>::remark(vec![1, 2, 3]))); + let call = Call::System(>::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!()); @@ -615,7 +620,7 @@ mod tests { event: Event::Dispatch(call_dispatch::Event::::MessageWeightMismatch( SOURCE_CHAIN_ID, id, - 1038000, + call_weight, 7, )), topics: vec![],