diff --git a/modules/messages/src/lib.rs b/modules/messages/src/lib.rs index a9a25fb9622..3faf00b9e75 100644 --- a/modules/messages/src/lib.rs +++ b/modules/messages/src/lib.rs @@ -749,15 +749,7 @@ fn send_message, I: 'static>( Pallet::::deposit_event(Event::MessageAccepted { lane_id, nonce }); - // we may introduce benchmarks for that, but no heavy ops planned here apart from - // db reads and writes. There are currently 2 db reads and 2 db writes: - // - one db read for operation mode check (`ensure_normal_operating_mode`); - // - one db read for outbound lane state (`outbound_lane`); - // - one db write for outbound lane state (`send_message`); - // - one db write for the message (`send_message`); - let actual_weight = T::DbWeight::get().reads_writes(2, 2); - - Ok(SendMessageArtifacts { nonce, weight: actual_weight }) + Ok(SendMessageArtifacts { nonce }) } /// Ensure that the pallet is in normal operational mode. @@ -970,18 +962,13 @@ mod tests { } } - fn send_regular_message() -> Weight { + fn send_regular_message() { get_ready_for_events(); let message_nonce = outbound_lane::(TEST_LANE_ID).data().latest_generated_nonce + 1; - let weight = send_message::( - RuntimeOrigin::signed(1), - TEST_LANE_ID, - REGULAR_PAYLOAD, - ) - .expect("send_message has failed") - .weight; + send_message::(RuntimeOrigin::signed(1), TEST_LANE_ID, REGULAR_PAYLOAD) + .expect("send_message has failed"); // check event with assigned nonce assert_eq!( @@ -995,8 +982,6 @@ mod tests { topics: vec![], }], ); - - weight } fn receive_messages_delivery_proof() { diff --git a/primitives/messages/src/source_chain.rs b/primitives/messages/src/source_chain.rs index 881bd92f5f9..83f27843d63 100644 --- a/primitives/messages/src/source_chain.rs +++ b/primitives/messages/src/source_chain.rs @@ -20,7 +20,7 @@ use crate::{InboundLaneData, LaneId, MessageNonce, OutboundLaneData}; use crate::UnrewardedRelayer; use bp_runtime::Size; -use frame_support::{weights::Weight, Parameter, RuntimeDebug}; +use frame_support::{Parameter, RuntimeDebug}; use sp_std::{ collections::{btree_map::BTreeMap, vec_deque::VecDeque}, fmt::Debug, @@ -124,8 +124,6 @@ impl DeliveryConfirmationPayments for () { pub struct SendMessageArtifacts { /// Nonce of the message. pub nonce: MessageNonce, - /// Actual weight of send message call. - pub weight: Weight, } /// Messages bridge API to be used from other pallets. @@ -155,7 +153,7 @@ impl MessagesBridge for NoopMessag _lane: LaneId, _message: Payload, ) -> Result { - Ok(SendMessageArtifacts { nonce: 0, weight: Weight::zero() }) + Ok(SendMessageArtifacts { nonce: 0 }) } }