mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 09:51:02 +00:00
remove invalid weight, returned by send_message (#1984)
This commit is contained in:
committed by
Bastian Köcher
parent
9b57f2181c
commit
eccbdff851
@@ -749,15 +749,7 @@ fn send_message<T: Config<I>, I: 'static>(
|
|||||||
|
|
||||||
Pallet::<T, I>::deposit_event(Event::MessageAccepted { lane_id, nonce });
|
Pallet::<T, I>::deposit_event(Event::MessageAccepted { lane_id, nonce });
|
||||||
|
|
||||||
// we may introduce benchmarks for that, but no heavy ops planned here apart from
|
Ok(SendMessageArtifacts { nonce })
|
||||||
// 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 })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure that the pallet is in normal operational mode.
|
/// 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();
|
get_ready_for_events();
|
||||||
|
|
||||||
let message_nonce =
|
let message_nonce =
|
||||||
outbound_lane::<TestRuntime, ()>(TEST_LANE_ID).data().latest_generated_nonce + 1;
|
outbound_lane::<TestRuntime, ()>(TEST_LANE_ID).data().latest_generated_nonce + 1;
|
||||||
let weight = send_message::<TestRuntime, ()>(
|
send_message::<TestRuntime, ()>(RuntimeOrigin::signed(1), TEST_LANE_ID, REGULAR_PAYLOAD)
|
||||||
RuntimeOrigin::signed(1),
|
.expect("send_message has failed");
|
||||||
TEST_LANE_ID,
|
|
||||||
REGULAR_PAYLOAD,
|
|
||||||
)
|
|
||||||
.expect("send_message has failed")
|
|
||||||
.weight;
|
|
||||||
|
|
||||||
// check event with assigned nonce
|
// check event with assigned nonce
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -995,8 +982,6 @@ mod tests {
|
|||||||
topics: vec![],
|
topics: vec![],
|
||||||
}],
|
}],
|
||||||
);
|
);
|
||||||
|
|
||||||
weight
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn receive_messages_delivery_proof() {
|
fn receive_messages_delivery_proof() {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use crate::{InboundLaneData, LaneId, MessageNonce, OutboundLaneData};
|
|||||||
|
|
||||||
use crate::UnrewardedRelayer;
|
use crate::UnrewardedRelayer;
|
||||||
use bp_runtime::Size;
|
use bp_runtime::Size;
|
||||||
use frame_support::{weights::Weight, Parameter, RuntimeDebug};
|
use frame_support::{Parameter, RuntimeDebug};
|
||||||
use sp_std::{
|
use sp_std::{
|
||||||
collections::{btree_map::BTreeMap, vec_deque::VecDeque},
|
collections::{btree_map::BTreeMap, vec_deque::VecDeque},
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
@@ -124,8 +124,6 @@ impl<AccountId> DeliveryConfirmationPayments<AccountId> for () {
|
|||||||
pub struct SendMessageArtifacts {
|
pub struct SendMessageArtifacts {
|
||||||
/// Nonce of the message.
|
/// Nonce of the message.
|
||||||
pub nonce: MessageNonce,
|
pub nonce: MessageNonce,
|
||||||
/// Actual weight of send message call.
|
|
||||||
pub weight: Weight,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Messages bridge API to be used from other pallets.
|
/// Messages bridge API to be used from other pallets.
|
||||||
@@ -155,7 +153,7 @@ impl<SenderOrigin, Payload> MessagesBridge<SenderOrigin, Payload> for NoopMessag
|
|||||||
_lane: LaneId,
|
_lane: LaneId,
|
||||||
_message: Payload,
|
_message: Payload,
|
||||||
) -> Result<SendMessageArtifacts, Self::Error> {
|
) -> Result<SendMessageArtifacts, Self::Error> {
|
||||||
Ok(SendMessageArtifacts { nonce: 0, weight: Weight::zero() })
|
Ok(SendMessageArtifacts { nonce: 0 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user