diff --git a/bridges/bin/runtime-common/src/extensions/refund_relayer_extension.rs b/bridges/bin/runtime-common/src/extensions/refund_relayer_extension.rs index d6ad32da835d5..f8f0fa80756f5 100644 --- a/bridges/bin/runtime-common/src/extensions/refund_relayer_extension.rs +++ b/bridges/bin/runtime-common/src/extensions/refund_relayer_extension.rs @@ -1142,7 +1142,7 @@ pub(crate) mod tests { fn message_delivery_call(best_message: MessageNonce) -> RuntimeCall { RuntimeCall::BridgeMessages(MessagesCall::receive_messages_proof { relayer_id_at_bridged_chain: relayer_account_at_bridged_chain(), - proof: FromBridgedChainMessagesProof { + proof: Box::new(FromBridgedChainMessagesProof { bridged_header_hash: Default::default(), storage: Default::default(), lane: TestLaneId::get(), @@ -1153,7 +1153,7 @@ pub(crate) mod tests { .last_delivered_nonce() + 1, nonces_end: best_message, - }, + }), messages_count: 1, dispatch_weight: Weight::zero(), }) diff --git a/bridges/bin/runtime-common/src/messages_call_ext.rs b/bridges/bin/runtime-common/src/messages_call_ext.rs index 9f21910803818..58bf354968bc5 100644 --- a/bridges/bin/runtime-common/src/messages_call_ext.rs +++ b/bridges/bin/runtime-common/src/messages_call_ext.rs @@ -415,13 +415,13 @@ mod tests { messages_count: nonces_end.checked_sub(nonces_start).map(|x| x + 1).unwrap_or(0) as u32, dispatch_weight: frame_support::weights::Weight::zero(), - proof: FromBridgedChainMessagesProof { + proof: Box::new(FromBridgedChainMessagesProof { bridged_header_hash: Default::default(), storage: Default::default(), lane: TEST_LANE_ID, nonces_start, nonces_end, - }, + }), }, ) .check_obsolete_call() diff --git a/bridges/modules/messages/src/benchmarking.rs b/bridges/modules/messages/src/benchmarking.rs index f1b672c41a526..8613911033fc7 100644 --- a/bridges/modules/messages/src/benchmarking.rs +++ b/bridges/modules/messages/src/benchmarking.rs @@ -224,7 +224,7 @@ mod benchmarks { receive_messages_proof( RawOrigin::Signed(setup.relayer_id_on_tgt()), setup.relayer_id_on_src(), - proof, + Box::new(proof), setup.msgs_count, dispatch_weight, ); @@ -255,7 +255,7 @@ mod benchmarks { receive_messages_proof( RawOrigin::Signed(setup.relayer_id_on_tgt()), setup.relayer_id_on_src(), - proof, + Box::new(proof), setup.msgs_count, dispatch_weight, ); @@ -296,7 +296,7 @@ mod benchmarks { receive_messages_proof( RawOrigin::Signed(setup.relayer_id_on_tgt()), setup.relayer_id_on_src(), - proof, + Box::new(proof), setup.msgs_count, dispatch_weight, ); @@ -331,7 +331,7 @@ mod benchmarks { receive_messages_proof( RawOrigin::Signed(setup.relayer_id_on_tgt()), setup.relayer_id_on_src(), - proof, + Box::new(proof), setup.msgs_count, dispatch_weight, ); @@ -531,7 +531,7 @@ mod benchmarks { receive_messages_proof( RawOrigin::Signed(setup.relayer_id_on_tgt()), setup.relayer_id_on_src(), - proof, + Box::new(proof), setup.msgs_count, dispatch_weight, ); diff --git a/bridges/modules/messages/src/lib.rs b/bridges/modules/messages/src/lib.rs index 880b5553e3b68..7bb2bb650197a 100644 --- a/bridges/modules/messages/src/lib.rs +++ b/bridges/modules/messages/src/lib.rs @@ -194,11 +194,11 @@ pub mod pallet { /// The call may succeed, but some messages may not be delivered e.g. if they are not fit /// into the unrewarded relayers vector. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::receive_messages_proof_weight(proof, *messages_count, *dispatch_weight))] + #[pallet::weight(T::WeightInfo::receive_messages_proof_weight(&**proof, *messages_count, *dispatch_weight))] pub fn receive_messages_proof( origin: OriginFor, relayer_id_at_bridged_chain: AccountIdOf>, - proof: FromBridgedChainMessagesProof>>, + proof: Box>>>, messages_count: u32, dispatch_weight: Weight, ) -> DispatchResultWithPostInfo { @@ -226,14 +226,14 @@ pub mod pallet { // The DeclaredWeight is exactly what's computed here. Unfortunately it is impossible // to get pre-computed value (and it has been already computed by the executive). let declared_weight = T::WeightInfo::receive_messages_proof_weight( - &proof, + &*proof, messages_count, dispatch_weight, ); let mut actual_weight = declared_weight; // verify messages proof && convert proof into messages - let messages = verify_and_decode_messages_proof::(proof, messages_count) + let messages = verify_and_decode_messages_proof::(*proof, messages_count) .map_err(|err| { log::trace!(target: LOG_TARGET, "Rejecting invalid messages proof: {:?}", err,); diff --git a/bridges/modules/messages/src/tests/mock.rs b/bridges/modules/messages/src/tests/mock.rs index fd76673f21e18..15bc6a3033a91 100644 --- a/bridges/modules/messages/src/tests/mock.rs +++ b/bridges/modules/messages/src/tests/mock.rs @@ -223,7 +223,7 @@ impl crate::benchmarking::Config<()> for TestRuntime { let dispatch_weight = REGULAR_PAYLOAD.declared_weight * params.message_nonces.checked_len().unwrap_or(0); ( - prepare_messages_proof( + *prepare_messages_proof( params.message_nonces.into_iter().map(|n| message(n, REGULAR_PAYLOAD)).collect(), params.outbound_lane_data, ), @@ -473,7 +473,7 @@ pub fn run_test(test: impl FnOnce() -> T) -> T { pub fn prepare_messages_proof( messages: Vec, outbound_lane_data: Option, -) -> FromBridgedChainMessagesProof { +) -> Box> { // first - let's generate storage proof let lane = messages.first().unwrap().key.lane_id; let nonces_start = messages.first().unwrap().key.nonce; @@ -497,13 +497,13 @@ pub fn prepare_messages_proof( StoredHeaderData { number: 0, state_root: storage_root }, ); - FromBridgedChainMessagesProof:: { + Box::new(FromBridgedChainMessagesProof:: { bridged_header_hash, storage, lane, nonces_start, nonces_end, - } + }) } /// Prepare valid storage proof for given messages and insert appropriate header to the diff --git a/bridges/modules/messages/src/tests/pallet_tests.rs b/bridges/modules/messages/src/tests/pallet_tests.rs index 613d551a3ac77..2ed7fa16ff513 100644 --- a/bridges/modules/messages/src/tests/pallet_tests.rs +++ b/bridges/modules/messages/src/tests/pallet_tests.rs @@ -666,7 +666,7 @@ fn ref_time_refund_from_receive_messages_proof_works() { let messages_count = 1; let pre_dispatch_weight = ::WeightInfo::receive_messages_proof_weight( - &proof, + &*proof, messages_count, REGULAR_PAYLOAD.declared_weight, ); @@ -721,7 +721,7 @@ fn proof_size_refund_from_receive_messages_proof_works() { let messages_count = 1; let pre_dispatch_weight = ::WeightInfo::receive_messages_proof_weight( - &proof, + &*proof, messages_count, REGULAR_PAYLOAD.declared_weight, ); @@ -898,7 +898,7 @@ fn test_bridge_messages_call_is_correctly_defined() { FromBridgedChainMessagesDeliveryProof, >::receive_messages_proof { relayer_id_at_bridged_chain: account_id, - proof: message_proof, + proof: *message_proof, messages_count: 1, dispatch_weight: REGULAR_PAYLOAD.declared_weight, }; diff --git a/bridges/relays/lib-substrate-relay/src/messages/mod.rs b/bridges/relays/lib-substrate-relay/src/messages/mod.rs index 4cbe5bf7fc885..7b2916186f966 100644 --- a/bridges/relays/lib-substrate-relay/src/messages/mod.rs +++ b/bridges/relays/lib-substrate-relay/src/messages/mod.rs @@ -365,7 +365,7 @@ where ) -> CallOf { let call: CallOf = BridgeMessagesCall::::receive_messages_proof { relayer_id_at_bridged_chain: relayer_id_at_source, - proof: proof.1, + proof: Box::new(proof.1), messages_count, dispatch_weight, }