remove invalid weight, returned by send_message (#1984)

This commit is contained in:
Svyatoslav Nikolsky
2023-03-22 17:32:23 +03:00
committed by Bastian Köcher
parent 9b57f2181c
commit eccbdff851
2 changed files with 6 additions and 23 deletions
+4 -19
View File
@@ -749,15 +749,7 @@ fn send_message<T: Config<I>, I: 'static>(
Pallet::<T, I>::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::<TestRuntime, ()>(TEST_LANE_ID).data().latest_generated_nonce + 1;
let weight = send_message::<TestRuntime, ()>(
RuntimeOrigin::signed(1),
TEST_LANE_ID,
REGULAR_PAYLOAD,
)
.expect("send_message has failed")
.weight;
send_message::<TestRuntime, ()>(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() {