From b03c584e31806f8ebfaf61e572a1dcc9727ae20d Mon Sep 17 00:00:00 2001
From: Svyatoslav Nikolsky <svyatonik@gmail.com>
Date: Mon, 1 May 2023 12:22:51 +0300
Subject: [PATCH] Add millau specific messages weights (#2097)

* refactor weights a bit

* post cherry-pick fixes

* do not run spellcheck on new weight files

* fix
---
 bridges/bin/millau/runtime/src/lib.rs         |  57 ++----
 .../bin/millau/runtime/src/rialto_messages.rs |   6 +
 .../runtime/src/rialto_parachain_messages.rs  |   8 +
 bridges/bin/millau/runtime/src/weights/mod.rs |  21 ++
 ...h_runtime_with_rialto_messages_instance.rs | 188 ++++++++++++++++++
 ...with_rialto_parachain_messages_instance.rs | 188 ++++++++++++++++++
 .../bin/rialto/runtime/src/millau_messages.rs |   2 +-
 bridges/modules/grandpa/src/weights.rs        |   2 +-
 bridges/modules/messages/src/weights.rs       |   2 +-
 bridges/modules/parachains/src/weights.rs     |   2 +-
 bridges/modules/relayers/src/weights.rs       |   2 +-
 11 files changed, 438 insertions(+), 40 deletions(-)
 create mode 100644 bridges/bin/millau/runtime/src/weights/mod.rs
 create mode 100644 bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_messages_instance.rs
 create mode 100644 bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_parachain_messages_instance.rs

diff --git a/bridges/bin/millau/runtime/src/lib.rs b/bridges/bin/millau/runtime/src/lib.rs
index b717fd0a56c..03fedd00934 100644
--- a/bridges/bin/millau/runtime/src/lib.rs
+++ b/bridges/bin/millau/runtime/src/lib.rs
@@ -30,6 +30,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
 
 pub mod rialto_messages;
 pub mod rialto_parachain_messages;
+pub mod weights;
 pub mod xcm_config;
 
 use bp_parachains::SingleParaStoredHeaderDataBuilder;
@@ -442,7 +443,7 @@ pub type WithRialtoMessagesInstance = ();
 
 impl pallet_bridge_messages::Config<WithRialtoMessagesInstance> for Runtime {
 	type RuntimeEvent = RuntimeEvent;
-	type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
+	type WeightInfo = weights::RialtoMessagesWeightInfo<Runtime>;
 	type ActiveOutboundLanes = RialtoActiveOutboundLanes;
 	type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
 	type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
@@ -472,7 +473,7 @@ pub type WithRialtoParachainMessagesInstance = pallet_bridge_messages::Instance1
 
 impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Runtime {
 	type RuntimeEvent = RuntimeEvent;
-	type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
+	type WeightInfo = weights::RialtoParachainMessagesWeightInfo<Runtime>;
 	type ActiveOutboundLanes = RialtoParachainActiveOutboundLanes;
 	type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
 	type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
@@ -598,7 +599,7 @@ generate_bridge_reject_obsolete_headers_and_messages! {
 
 bp_runtime::generate_static_str_provider!(BridgeRefundRialtoPara2000Lane0Msgs);
 /// Signed extension that refunds relayers that are delivering messages from the Rialto parachain.
-pub type PriorityBoostPerMessage = ConstU64<921_900_294>;
+pub type PriorityBoostPerMessage = ConstU64<699_683_285>;
 pub type BridgeRefundRialtoParachainMessages = RefundBridgedParachainMessages<
 	Runtime,
 	RefundableParachain<WithRialtoParachainsInstance, RialtoParachainId>,
@@ -647,6 +648,17 @@ pub type Executive = frame_executive::Executive<
 	AllPalletsWithSystem,
 >;
 
+#[cfg(feature = "runtime-benchmarks")]
+mod benches {
+	frame_benchmarking::define_benchmarks!(
+		[pallet_bridge_messages, MessagesBench::<Runtime, WithRialtoMessagesInstance>]
+		[pallet_bridge_messages, MessagesBench::<Runtime, WithRialtoParachainMessagesInstance>]
+		[pallet_bridge_grandpa, BridgeRialtoGrandpa]
+		[pallet_bridge_parachains, ParachainsBench::<Runtime, WithRialtoParachainsInstance>]
+		[pallet_bridge_relayers, RelayersBench::<Runtime>]
+	);
+}
+
 impl_runtime_apis! {
 	impl sp_api::Core<Block> for Runtime {
 		fn version() -> RuntimeVersion {
@@ -954,7 +966,7 @@ impl_runtime_apis! {
 			Vec<frame_benchmarking::BenchmarkList>,
 			Vec<frame_support::traits::StorageInfo>,
 		) {
-			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
+			use frame_benchmarking::{Benchmarking, BenchmarkList};
 			use frame_support::traits::StorageInfoTrait;
 
 			use pallet_bridge_messages::benchmarking::Pallet as MessagesBench;
@@ -962,22 +974,16 @@ impl_runtime_apis! {
 			use pallet_bridge_relayers::benchmarking::Pallet as RelayersBench;
 
 			let mut list = Vec::<BenchmarkList>::new();
-
-			list_benchmark!(list, extra, RialtoParachainMessages, MessagesBench::<Runtime, WithRialtoParachainMessagesInstance>);
-			list_benchmark!(list, extra, RialtoMessages, MessagesBench::<Runtime, WithRialtoMessagesInstance>);
-			list_benchmark!(list, extra, pallet_bridge_grandpa, BridgeRialtoGrandpa);
-			list_benchmark!(list, extra, pallet_bridge_parachains, ParachainsBench::<Runtime, WithRialtoParachainsInstance>);
-			list_benchmark!(list, extra, pallet_bridge_relayers, RelayersBench::<Runtime>);
+			list_benchmarks!(list, extra);
 
 			let storage_info = AllPalletsWithSystem::storage_info();
-
 			return (list, storage_info)
 		}
 
 		fn dispatch_benchmark(
 			config: frame_benchmarking::BenchmarkConfig,
 		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
-			use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, add_benchmark};
+			use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
 
 			let whitelist: Vec<TrackedStorageKey> = vec![
 				// Block Number
@@ -992,9 +998,6 @@ impl_runtime_apis! {
 				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da946c154ffd9992e395af90b5b13cc6f295c77033fce8a9045824a6690bbf99c6db269502f0a8d1d2a008542d5690a0749").to_vec().into(),
 			];
 
-			let mut batches = Vec::<BenchmarkBatch>::new();
-			let params = (&config, &whitelist);
-
 			use bridge_runtime_common::messages_benchmarking::{
 				prepare_message_delivery_proof_from_grandpa_chain,
 				prepare_message_delivery_proof_from_parachain,
@@ -1125,26 +1128,10 @@ impl_runtime_apis! {
 				}
 			}
 
-			add_benchmark!(
-				params,
-				batches,
-				RialtoParachainMessages,
-				MessagesBench::<Runtime, WithRialtoParachainMessagesInstance>
-			);
-			add_benchmark!(
-				params,
-				batches,
-				RialtoMessages,
-				MessagesBench::<Runtime, WithRialtoMessagesInstance>
-			);
-			add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeRialtoGrandpa);
-			add_benchmark!(
-				params,
-				batches,
-				pallet_bridge_parachains,
-				ParachainsBench::<Runtime, WithRialtoParachainsInstance>
-			);
-			add_benchmark!(params, batches, pallet_bridge_relayers, RelayersBench::<Runtime>);
+			let mut batches = Vec::<BenchmarkBatch>::new();
+			let params = (&config, &whitelist);
+
+			add_benchmarks!(params, batches);
 
 			Ok(batches)
 		}
diff --git a/bridges/bin/millau/runtime/src/rialto_messages.rs b/bridges/bin/millau/runtime/src/rialto_messages.rs
index 573e3f5e68d..0cd535351f8 100644
--- a/bridges/bin/millau/runtime/src/rialto_messages.rs
+++ b/bridges/bin/millau/runtime/src/rialto_messages.rs
@@ -135,6 +135,12 @@ impl XcmBlobHauler for ToRialtoXcmBlobHauler {
 	}
 }
 
+impl pallet_bridge_messages::WeightInfoExt for crate::weights::RialtoMessagesWeightInfo<Runtime> {
+	fn expected_extra_storage_proof_size() -> u32 {
+		bp_rialto::EXTRA_STORAGE_PROOF_SIZE
+	}
+}
+
 #[cfg(test)]
 mod tests {
 	use super::*;
diff --git a/bridges/bin/millau/runtime/src/rialto_parachain_messages.rs b/bridges/bin/millau/runtime/src/rialto_parachain_messages.rs
index 041d3256f42..7f91bd290b7 100644
--- a/bridges/bin/millau/runtime/src/rialto_parachain_messages.rs
+++ b/bridges/bin/millau/runtime/src/rialto_parachain_messages.rs
@@ -136,6 +136,14 @@ impl XcmBlobHauler for ToRialtoParachainXcmBlobHauler {
 	}
 }
 
+impl pallet_bridge_messages::WeightInfoExt
+	for crate::weights::RialtoParachainMessagesWeightInfo<Runtime>
+{
+	fn expected_extra_storage_proof_size() -> u32 {
+		bp_rialto_parachain::EXTRA_STORAGE_PROOF_SIZE
+	}
+}
+
 #[cfg(test)]
 mod tests {
 	use super::*;
diff --git a/bridges/bin/millau/runtime/src/weights/mod.rs b/bridges/bin/millau/runtime/src/weights/mod.rs
new file mode 100644
index 00000000000..801ff9b3c8f
--- /dev/null
+++ b/bridges/bin/millau/runtime/src/weights/mod.rs
@@ -0,0 +1,21 @@
+// Copyright 2019-2021 Parity Technologies (UK) Ltd.
+// This file is part of Parity Bridges Common.
+
+// Parity Bridges Common is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity Bridges Common is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity Bridges Common.  If not, see <http://www.gnu.org/licenses/>.
+
+mod pallet_bridge_messages_messages_bench_runtime_with_rialto_messages_instance;
+mod pallet_bridge_messages_messages_bench_runtime_with_rialto_parachain_messages_instance;
+
+pub use pallet_bridge_messages_messages_bench_runtime_with_rialto_messages_instance::WeightInfo as RialtoMessagesWeightInfo;
+pub use pallet_bridge_messages_messages_bench_runtime_with_rialto_parachain_messages_instance::WeightInfo as RialtoParachainMessagesWeightInfo;
diff --git a/bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_messages_instance.rs b/bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_messages_instance.rs
new file mode 100644
index 00000000000..b58402d2756
--- /dev/null
+++ b/bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_messages_instance.rs
@@ -0,0 +1,188 @@
+
+//! Autogenerated weights for `pallet_bridge_messages`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-05-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+
+// Executed Command:
+// target/release/millau-bridge-node
+// benchmark
+// pallet
+// --chain=dev
+// --steps=50
+// --repeat=20
+// --pallet=pallet_bridge_messages
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=Compiled
+// --heap-pages=4096
+// --output=./bin/millau/runtime/src/weights/
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::marker::PhantomData;
+
+/// Weight functions for `pallet_bridge_messages`.
+pub struct WeightInfo<T>(PhantomData<T>);
+impl<T: frame_system::Config> pallet_bridge_messages::WeightInfo for WeightInfo<T> {
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `490`
+		//  Estimated: `57170`
+		// Minimum execution time: 51_189_000 picoseconds.
+		Weight::from_parts(52_881_000, 0)
+			.saturating_add(Weight::from_parts(0, 57170))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_two_messages_proof() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `490`
+		//  Estimated: `57170`
+		// Minimum execution time: 65_083_000 picoseconds.
+		Weight::from_parts(66_878_000, 0)
+			.saturating_add(Weight::from_parts(0, 57170))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `490`
+		//  Estimated: `57170`
+		// Minimum execution time: 57_919_000 picoseconds.
+		Weight::from_parts(58_927_000, 0)
+			.saturating_add(Weight::from_parts(0, 57170))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof_1_kb() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `490`
+		//  Estimated: `57170`
+		// Minimum execution time: 52_202_000 picoseconds.
+		Weight::from_parts(53_617_000, 0)
+			.saturating_add(Weight::from_parts(0, 57170))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof_16_kb() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `490`
+		//  Estimated: `57170`
+		// Minimum execution time: 74_726_000 picoseconds.
+		Weight::from_parts(76_379_000, 0)
+			.saturating_add(Weight::from_parts(0, 57170))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+	/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+	/// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
+	fn receive_delivery_proof_for_single_message() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `515`
+		//  Estimated: `9584`
+		// Minimum execution time: 45_156_000 picoseconds.
+		Weight::from_parts(46_535_000, 0)
+			.saturating_add(Weight::from_parts(0, 9584))
+			.saturating_add(T::DbWeight::get().reads(4))
+			.saturating_add(T::DbWeight::get().writes(2))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+	/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+	/// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
+	fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `532`
+		//  Estimated: `9584`
+		// Minimum execution time: 44_104_000 picoseconds.
+		Weight::from_parts(45_602_000, 0)
+			.saturating_add(Weight::from_parts(0, 9584))
+			.saturating_add(T::DbWeight::get().reads(4))
+			.saturating_add(T::DbWeight::get().writes(2))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+	/// Storage: BridgeRelayers RelayerRewards (r:2 w:2)
+	/// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
+	fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `532`
+		//  Estimated: `12124`
+		// Minimum execution time: 46_880_000 picoseconds.
+		Weight::from_parts(48_472_000, 0)
+			.saturating_add(Weight::from_parts(0, 12124))
+			.saturating_add(T::DbWeight::get().reads(5))
+			.saturating_add(T::DbWeight::get().writes(3))
+	}
+	/// Storage: BridgeRialtoMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:1 w:0)
+	/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68), added: 2048, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	/// The range of component `i` is `[128, 2048]`.
+	/// The range of component `i` is `[128, 2048]`.
+	fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `490`
+		//  Estimated: `57170`
+		// Minimum execution time: 107_297_000 picoseconds.
+		Weight::from_parts(98_819_194, 0)
+			.saturating_add(Weight::from_parts(0, 57170))
+			// Standard Error: 2_195
+			.saturating_add(Weight::from_parts(448_268, 0).saturating_mul(i.into()))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+}
diff --git a/bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_parachain_messages_instance.rs b/bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_parachain_messages_instance.rs
new file mode 100644
index 00000000000..c71cb11fdc7
--- /dev/null
+++ b/bridges/bin/millau/runtime/src/weights/pallet_bridge_messages_messages_bench_runtime_with_rialto_parachain_messages_instance.rs
@@ -0,0 +1,188 @@
+
+//! Autogenerated weights for `pallet_bridge_messages`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-05-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+
+// Executed Command:
+// target/release/millau-bridge-node
+// benchmark
+// pallet
+// --chain=dev
+// --steps=50
+// --repeat=20
+// --pallet=pallet_bridge_messages
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=Compiled
+// --heap-pages=4096
+// --output=./bin/millau/runtime/src/weights/
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::marker::PhantomData;
+
+/// Weight functions for `pallet_bridge_messages`.
+pub struct WeightInfo<T>(PhantomData<T>);
+impl<T: frame_system::Config> pallet_bridge_messages::WeightInfo for WeightInfo<T> {
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `428`
+		//  Estimated: `56803`
+		// Minimum execution time: 49_949_000 picoseconds.
+		Weight::from_parts(51_439_000, 0)
+			.saturating_add(Weight::from_parts(0, 56803))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_two_messages_proof() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `428`
+		//  Estimated: `56803`
+		// Minimum execution time: 62_552_000 picoseconds.
+		Weight::from_parts(64_899_000, 0)
+			.saturating_add(Weight::from_parts(0, 56803))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `428`
+		//  Estimated: `56803`
+		// Minimum execution time: 56_795_000 picoseconds.
+		Weight::from_parts(58_441_000, 0)
+			.saturating_add(Weight::from_parts(0, 56803))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof_1_kb() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `428`
+		//  Estimated: `56803`
+		// Minimum execution time: 51_340_000 picoseconds.
+		Weight::from_parts(52_533_000, 0)
+			.saturating_add(Weight::from_parts(0, 56803))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	fn receive_single_message_proof_16_kb() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `428`
+		//  Estimated: `56803`
+		// Minimum execution time: 74_022_000 picoseconds.
+		Weight::from_parts(75_115_000, 0)
+			.saturating_add(Weight::from_parts(0, 56803))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages OutboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+	/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+	/// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
+	fn receive_delivery_proof_for_single_message() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `453`
+		//  Estimated: `9217`
+		// Minimum execution time: 43_296_000 picoseconds.
+		Weight::from_parts(45_022_000, 0)
+			.saturating_add(Weight::from_parts(0, 9217))
+			.saturating_add(T::DbWeight::get().reads(4))
+			.saturating_add(T::DbWeight::get().writes(2))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages OutboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+	/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+	/// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
+	fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `470`
+		//  Estimated: `9217`
+		// Minimum execution time: 42_618_000 picoseconds.
+		Weight::from_parts(43_972_000, 0)
+			.saturating_add(Weight::from_parts(0, 9217))
+			.saturating_add(T::DbWeight::get().reads(4))
+			.saturating_add(T::DbWeight::get().writes(2))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages OutboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+	/// Storage: BridgeRelayers RelayerRewards (r:2 w:2)
+	/// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
+	fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `470`
+		//  Estimated: `11757`
+		// Minimum execution time: 45_954_000 picoseconds.
+		Weight::from_parts(46_892_000, 0)
+			.saturating_add(Weight::from_parts(0, 11757))
+			.saturating_add(T::DbWeight::get().reads(5))
+			.saturating_add(T::DbWeight::get().writes(3))
+	}
+	/// Storage: BridgeRialtoParachainMessages PalletOperatingMode (r:1 w:0)
+	/// Proof: BridgeRialtoParachainMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachains ImportedParaHeads (r:1 w:0)
+	/// Proof: BridgeRialtoParachains ImportedParaHeads (max_values: Some(1024), max_size: Some(196), added: 1681, mode: MaxEncodedLen)
+	/// Storage: BridgeRialtoParachainMessages InboundLanes (r:1 w:1)
+	/// Proof: BridgeRialtoParachainMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+	/// The range of component `i` is `[128, 2048]`.
+	/// The range of component `i` is `[128, 2048]`.
+	fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `428`
+		//  Estimated: `56803`
+		// Minimum execution time: 107_766_000 picoseconds.
+		Weight::from_parts(97_865_035, 0)
+			.saturating_add(Weight::from_parts(0, 56803))
+			// Standard Error: 2_179
+			.saturating_add(Weight::from_parts(447_749, 0).saturating_mul(i.into()))
+			.saturating_add(T::DbWeight::get().reads(3))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+}
diff --git a/bridges/bin/rialto/runtime/src/millau_messages.rs b/bridges/bin/rialto/runtime/src/millau_messages.rs
index 7c960639f2f..58f86148fbe 100644
--- a/bridges/bin/rialto/runtime/src/millau_messages.rs
+++ b/bridges/bin/rialto/runtime/src/millau_messages.rs
@@ -149,7 +149,7 @@ mod tests {
 	};
 
 	#[test]
-	fn ensure_rialto_message_lane_weights_are_correct() {
+	fn ensure_millau_message_lane_weights_are_correct() {
 		check_message_lane_weights::<bp_rialto::Rialto, Runtime>(
 			bp_millau::EXTRA_STORAGE_PROOF_SIZE,
 			bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
diff --git a/bridges/modules/grandpa/src/weights.rs b/bridges/modules/grandpa/src/weights.rs
index 089aee8b569..4b94f7adfe7 100644
--- a/bridges/modules/grandpa/src/weights.rs
+++ b/bridges/modules/grandpa/src/weights.rs
@@ -35,7 +35,7 @@
 // --wasm-execution=Compiled
 // --heap-pages=4096
 // --output=./modules/grandpa/src/weights.rs
-// --template=./.maintain/millau-weight-template.hbs
+// --template=./.maintain/bridge-weight-template.hbs
 
 #![allow(clippy::all)]
 #![allow(unused_parens)]
diff --git a/bridges/modules/messages/src/weights.rs b/bridges/modules/messages/src/weights.rs
index baaef317241..9880f1dd1ea 100644
--- a/bridges/modules/messages/src/weights.rs
+++ b/bridges/modules/messages/src/weights.rs
@@ -35,7 +35,7 @@
 // --wasm-execution=Compiled
 // --heap-pages=4096
 // --output=./modules/messages/src/weights.rs
-// --template=./.maintain/millau-weight-template.hbs
+// --template=./.maintain/bridge-weight-template.hbs
 
 #![allow(clippy::all)]
 #![allow(unused_parens)]
diff --git a/bridges/modules/parachains/src/weights.rs b/bridges/modules/parachains/src/weights.rs
index 54a835cbc87..1e81dba72fe 100644
--- a/bridges/modules/parachains/src/weights.rs
+++ b/bridges/modules/parachains/src/weights.rs
@@ -35,7 +35,7 @@
 // --wasm-execution=Compiled
 // --heap-pages=4096
 // --output=./modules/parachains/src/weights.rs
-// --template=./.maintain/millau-weight-template.hbs
+// --template=./.maintain/bridge-weight-template.hbs
 
 #![allow(clippy::all)]
 #![allow(unused_parens)]
diff --git a/bridges/modules/relayers/src/weights.rs b/bridges/modules/relayers/src/weights.rs
index abfdd50019f..a1f8fde1b0d 100644
--- a/bridges/modules/relayers/src/weights.rs
+++ b/bridges/modules/relayers/src/weights.rs
@@ -35,7 +35,7 @@
 // --wasm-execution=Compiled
 // --heap-pages=4096
 // --output=./modules/relayers/src/weights.rs
-// --template=./.maintain/millau-weight-template.hbs
+// --template=./.maintain/bridge-weight-template.hbs
 
 #![allow(clippy::all)]
 #![allow(unused_parens)]
-- 
GitLab