From b62df695923c6b64c42c3081692194375b91f7b4 Mon Sep 17 00:00:00 2001
From: Svyatoslav Nikolsky <svyatonik@gmail.com>
Date: Fri, 22 Dec 2023 13:22:50 +0300
Subject: [PATCH] Final nits for bridge-hub-test-utils (#2788)

closes https://github.com/paritytech/parity-bridges-common/issues/2739
---
 .../src/test_cases/from_grandpa_chain.rs      |   4 +-
 .../src/test_cases/from_parachain.rs          |   8 +-
 .../test-utils/src/test_cases/helpers.rs      |  40 +++--
 .../test-utils/src/test_cases/mod.rs          | 153 ++++++++----------
 4 files changed, 94 insertions(+), 111 deletions(-)

diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs
index 8d4e6a034a7..e0e75f093cf 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs
@@ -18,7 +18,7 @@
 //! with remote GRANDPA chain.
 
 use crate::{
-	test_cases::{helpers, run_test},
+	test_cases::{bridges_prelude::*, helpers, run_test},
 	test_data,
 };
 
@@ -38,8 +38,6 @@ use bridge_runtime_common::{
 };
 use frame_support::traits::{Get, OnFinalize, OnInitialize};
 use frame_system::pallet_prelude::BlockNumberFor;
-use pallet_bridge_grandpa::{Call as BridgeGrandpaCall, Config as BridgeGrandpaConfig};
-use pallet_bridge_messages::{Call as BridgeMessagesCall, Config as BridgeMessagesConfig};
 use parachains_runtimes_test_utils::{
 	AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf,
 };
diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs
index fa1049cc6ec..91bebb36b18 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs
@@ -18,7 +18,7 @@
 //! with remote parachain.
 
 use crate::{
-	test_cases::{helpers, run_test},
+	test_cases::{bridges_prelude::*, helpers, run_test},
 	test_data,
 };
 
@@ -39,12 +39,6 @@ use bridge_runtime_common::{
 };
 use frame_support::traits::{Get, OnFinalize, OnInitialize};
 use frame_system::pallet_prelude::BlockNumberFor;
-use pallet_bridge_grandpa::{Call as BridgeGrandpaCall, Config as BridgeGrandpaConfig};
-use pallet_bridge_messages::{Call as BridgeMessagesCall, Config as BridgeMessagesConfig};
-use pallet_bridge_parachains::{
-	Call as BridgeParachainsCall, Config as BridgeParachainsConfig, RelayBlockHash,
-	RelayBlockNumber,
-};
 use parachains_runtimes_test_utils::{
 	AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf,
 };
diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs
index 4f824129bf7..69aa61db3cc 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs
@@ -16,7 +16,7 @@
 
 //! Module contains tests code, that is shared by all types of bridges
 
-use crate::test_cases::{run_test, RuntimeHelper};
+use crate::test_cases::{bridges_prelude::*, run_test, RuntimeHelper};
 
 use asset_test_utils::BasicParachainRuntime;
 use bp_messages::{LaneId, MessageNonce};
@@ -30,13 +30,16 @@ use frame_support::{
 use frame_system::pallet_prelude::BlockNumberFor;
 use pallet_bridge_grandpa::{BridgedBlockHash, BridgedHeader};
 use parachains_common::AccountId;
-use parachains_runtimes_test_utils::{mock_open_hrmp_channel, AccountIdOf, CollatorSessionKeys};
+use parachains_runtimes_test_utils::{
+	mock_open_hrmp_channel, AccountIdOf, CollatorSessionKeys, RuntimeCallOf,
+};
 use sp_core::Get;
 use sp_keyring::AccountKeyring::*;
 use sp_runtime::{traits::TrailingZeroInput, AccountId32};
 use sp_std::marker::PhantomData;
 use xcm::latest::prelude::*;
 
+/// Verify that the transaction has succeeded.
 #[impl_trait_for_tuples::impl_for_tuples(30)]
 pub trait VerifyTransactionOutcome {
 	fn verify_outcome(&self);
@@ -51,7 +54,7 @@ impl VerifyTransactionOutcome for Box<dyn VerifyTransactionOutcome> {
 /// Checks that the best finalized header hash in the bridge GRANDPA pallet equals to given one.
 pub struct VerifySubmitGrandpaFinalityProofOutcome<Runtime, GPI>
 where
-	Runtime: pallet_bridge_grandpa::Config<GPI>,
+	Runtime: BridgeGrandpaConfig<GPI>,
 	GPI: 'static,
 {
 	expected_best_hash: BridgedBlockHash<Runtime, GPI>,
@@ -59,7 +62,7 @@ where
 
 impl<Runtime, GPI> VerifySubmitGrandpaFinalityProofOutcome<Runtime, GPI>
 where
-	Runtime: pallet_bridge_grandpa::Config<GPI>,
+	Runtime: BridgeGrandpaConfig<GPI>,
 	GPI: 'static,
 {
 	/// Expect given header hash to be the best after transaction.
@@ -73,7 +76,7 @@ where
 impl<Runtime, GPI> VerifyTransactionOutcome
 	for VerifySubmitGrandpaFinalityProofOutcome<Runtime, GPI>
 where
-	Runtime: pallet_bridge_grandpa::Config<GPI>,
+	Runtime: BridgeGrandpaConfig<GPI>,
 	GPI: 'static,
 {
 	fn verify_outcome(&self) {
@@ -96,7 +99,7 @@ pub struct VerifySubmitParachainHeaderProofOutcome<Runtime, PPI> {
 
 impl<Runtime, PPI> VerifySubmitParachainHeaderProofOutcome<Runtime, PPI>
 where
-	Runtime: pallet_bridge_parachains::Config<PPI>,
+	Runtime: BridgeParachainsConfig<PPI>,
 	PPI: 'static,
 {
 	/// Expect given header hash to be the best after transaction.
@@ -111,7 +114,7 @@ where
 impl<Runtime, PPI> VerifyTransactionOutcome
 	for VerifySubmitParachainHeaderProofOutcome<Runtime, PPI>
 where
-	Runtime: pallet_bridge_parachains::Config<PPI>,
+	Runtime: BridgeParachainsConfig<PPI>,
 	PPI: 'static,
 {
 	fn verify_outcome(&self) {
@@ -132,7 +135,7 @@ pub struct VerifySubmitMessagesProofOutcome<Runtime, MPI> {
 
 impl<Runtime, MPI> VerifySubmitMessagesProofOutcome<Runtime, MPI>
 where
-	Runtime: pallet_bridge_messages::Config<MPI>,
+	Runtime: BridgeMessagesConfig<MPI>,
 	MPI: 'static,
 {
 	/// Expect given delivered nonce to be the latest after transaction.
@@ -146,7 +149,7 @@ where
 
 impl<Runtime, MPI> VerifyTransactionOutcome for VerifySubmitMessagesProofOutcome<Runtime, MPI>
 where
-	Runtime: pallet_bridge_messages::Config<MPI>,
+	Runtime: BridgeMessagesConfig<MPI>,
 	MPI: 'static,
 {
 	fn verify_outcome(&self) {
@@ -194,7 +197,7 @@ where
 pub(crate) fn initialize_bridge_grandpa_pallet<Runtime, GPI>(
 	init_data: bp_header_chain::InitializationData<BridgedHeader<Runtime, GPI>>,
 ) where
-	Runtime: pallet_bridge_grandpa::Config<GPI>,
+	Runtime: BridgeGrandpaConfig<GPI>,
 {
 	pallet_bridge_grandpa::Pallet::<Runtime, GPI>::initialize(
 		RuntimeHelper::<Runtime>::root_origin(),
@@ -205,7 +208,7 @@ pub(crate) fn initialize_bridge_grandpa_pallet<Runtime, GPI>(
 
 /// Runtime calls and their verifiers.
 pub type CallsAndVerifiers<Runtime> =
-	Vec<(<Runtime as frame_system::Config>::RuntimeCall, Box<dyn VerifyTransactionOutcome>)>;
+	Vec<(RuntimeCallOf<Runtime>, Box<dyn VerifyTransactionOutcome>)>;
 
 /// Returns relayer id at the bridged chain.
 pub fn relayer_id_at_bridged_chain<Runtime: pallet_bridge_messages::Config<MPI>, MPI>(
@@ -222,7 +225,7 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, MPI>(
 	local_relay_chain_id: NetworkId,
 	construct_and_apply_extrinsic: fn(
 		sp_keyring::AccountKeyring,
-		<Runtime as frame_system::Config>::RuntimeCall,
+		RuntimeCallOf<Runtime>,
 	) -> sp_runtime::DispatchOutcome,
 	prepare_message_proof_import: impl FnOnce(
 		Runtime::AccountId,
@@ -232,9 +235,7 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, MPI>(
 		Xcm<()>,
 	) -> CallsAndVerifiers<Runtime>,
 ) where
-	Runtime: BasicParachainRuntime
-		+ cumulus_pallet_xcmp_queue::Config
-		+ pallet_bridge_messages::Config<MPI>,
+	Runtime: BasicParachainRuntime + cumulus_pallet_xcmp_queue::Config + BridgeMessagesConfig<MPI>,
 	AllPalletsWithoutSystem:
 		OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
 	MPI: 'static,
@@ -251,7 +252,12 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, MPI>(
 		runtime_para_id,
 		vec![(
 			relayer_id_on_target.clone().into(),
-			Runtime::ExistentialDeposit::get() * 100000u32.into(),
+			// this value should be enough to cover all transaction costs, but computing the actual
+			// value here is tricky - there are several transaction payment pallets and we don't
+			// want to introduce additional bounds and traits here just for that, so let's just
+			// select some presumably large value
+			sp_std::cmp::max::<Runtime::Balance>(Runtime::ExistentialDeposit::get(), 1u32.into()) *
+				100_000_000u32.into(),
 		)],
 		|| {
 			let mut alice = [0u8; 32];
@@ -327,7 +333,7 @@ fn execute_and_verify_calls<Runtime: frame_system::Config>(
 	submitter: sp_keyring::AccountKeyring,
 	construct_and_apply_extrinsic: fn(
 		sp_keyring::AccountKeyring,
-		<Runtime as frame_system::Config>::RuntimeCall,
+		RuntimeCallOf<Runtime>,
 	) -> sp_runtime::DispatchOutcome,
 	calls_and_verifiers: CallsAndVerifiers<Runtime>,
 ) {
diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/mod.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/mod.rs
index 11210841bd3..64ec8726599 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/mod.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/mod.rs
@@ -24,7 +24,7 @@ pub mod from_parachain;
 
 pub(crate) mod helpers;
 
-use crate::test_data;
+use crate::{test_cases::bridges_prelude::*, test_data};
 
 use asset_test_utils::BasicParachainRuntime;
 use bp_messages::{
@@ -38,12 +38,13 @@ use bridge_runtime_common::messages_xcm_extension::{
 use codec::Encode;
 use frame_support::{
 	assert_ok,
+	dispatch::GetDispatchInfo,
 	traits::{Get, OnFinalize, OnInitialize, OriginTrait},
 };
 use frame_system::pallet_prelude::BlockNumberFor;
 use parachains_common::AccountId;
 use parachains_runtimes_test_utils::{
-	mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, ValidatorIdOf,
+	mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeCallOf,
 	XcmReceivedFrom,
 };
 use sp_runtime::{traits::Zero, AccountId32};
@@ -54,6 +55,16 @@ use xcm_executor::{
 	XcmExecutor,
 };
 
+/// Common bridges exports.
+pub(crate) mod bridges_prelude {
+	pub use pallet_bridge_grandpa::{Call as BridgeGrandpaCall, Config as BridgeGrandpaConfig};
+	pub use pallet_bridge_messages::{Call as BridgeMessagesCall, Config as BridgeMessagesConfig};
+	pub use pallet_bridge_parachains::{
+		Call as BridgeParachainsCall, Config as BridgeParachainsConfig, RelayBlockHash,
+		RelayBlockNumber,
+	};
+}
+
 // Re-export test_case from assets
 pub use asset_test_utils::include_teleports_for_native_asset_works;
 
@@ -89,11 +100,10 @@ pub fn initialize_bridge_by_governance_works<Runtime, GrandpaPalletInstance>(
 	collator_session_key: CollatorSessionKeys<Runtime>,
 	runtime_para_id: u32,
 ) where
-	Runtime: BasicParachainRuntime + pallet_bridge_grandpa::Config<GrandpaPalletInstance>,
+	Runtime: BasicParachainRuntime + BridgeGrandpaConfig<GrandpaPalletInstance>,
 	GrandpaPalletInstance: 'static,
-	ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
-	<Runtime as frame_system::Config>::RuntimeCall:
-		From<pallet_bridge_grandpa::Call<Runtime, GrandpaPalletInstance>>,
+	RuntimeCallOf<Runtime>:
+		GetDispatchInfo + From<BridgeGrandpaCall<Runtime, GrandpaPalletInstance>>,
 {
 	run_test::<Runtime, _>(collator_session_key, runtime_para_id, vec![], || {
 		// check mode before
@@ -102,24 +112,18 @@ pub fn initialize_bridge_by_governance_works<Runtime, GrandpaPalletInstance>(
 			Err(())
 		);
 
-		// encode `initialize` call
-		let initialize_call =
-			<Runtime as frame_system::Config>::RuntimeCall::from(pallet_bridge_grandpa::Call::<
-				Runtime,
-				GrandpaPalletInstance,
-			>::initialize {
-				init_data: test_data::initialization_data::<Runtime, GrandpaPalletInstance>(12345),
-			})
-			.encode();
-
-		// overestimate - check weight for `pallet_bridge_grandpa::Pallet::initialize()` call
-		let require_weight_at_most =
-			<Runtime as frame_system::Config>::DbWeight::get().reads_writes(7, 7);
+		// prepare the `initialize` call
+		let initialize_call = RuntimeCallOf::<Runtime>::from(BridgeGrandpaCall::<
+			Runtime,
+			GrandpaPalletInstance,
+		>::initialize {
+			init_data: test_data::initialization_data::<Runtime, GrandpaPalletInstance>(12345),
+		});
 
 		// execute XCM with Transacts to `initialize bridge` as governance does
 		assert_ok!(RuntimeHelper::<Runtime>::execute_as_governance(
-			initialize_call,
-			require_weight_at_most
+			initialize_call.encode(),
+			initialize_call.get_dispatch_info().weight,
 		)
 		.ensure_complete());
 
@@ -137,11 +141,10 @@ pub fn change_bridge_grandpa_pallet_mode_by_governance_works<Runtime, GrandpaPal
 	collator_session_key: CollatorSessionKeys<Runtime>,
 	runtime_para_id: u32,
 ) where
-	Runtime: BasicParachainRuntime + pallet_bridge_grandpa::Config<GrandpaPalletInstance>,
+	Runtime: BasicParachainRuntime + BridgeGrandpaConfig<GrandpaPalletInstance>,
 	GrandpaPalletInstance: 'static,
-	ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
-	<Runtime as frame_system::Config>::RuntimeCall:
-		From<pallet_bridge_grandpa::Call<Runtime, GrandpaPalletInstance>>,
+	RuntimeCallOf<Runtime>:
+		GetDispatchInfo + From<BridgeGrandpaCall<Runtime, GrandpaPalletInstance>>,
 {
 	run_test::<Runtime, _>(collator_session_key, runtime_para_id, vec![], || {
 		let dispatch_set_operating_mode_call = |old_mode, new_mode| {
@@ -151,23 +154,17 @@ pub fn change_bridge_grandpa_pallet_mode_by_governance_works<Runtime, GrandpaPal
 				old_mode,
 			);
 
-			// overestimate - check weight for `pallet_bridge_grandpa::Pallet::set_operating_mode()`
-			// call
-			let require_weight_at_most =
-				<Runtime as frame_system::Config>::DbWeight::get().reads_writes(7, 7);
-
-			// encode `set_operating_mode` call
+			// prepare the `set_operating_mode` call
 			let set_operating_mode_call = <Runtime as frame_system::Config>::RuntimeCall::from(
 				pallet_bridge_grandpa::Call::<Runtime, GrandpaPalletInstance>::set_operating_mode {
 					operating_mode: new_mode,
 				},
-			)
-			.encode();
+			);
 
 			// execute XCM with Transacts to `initialize bridge` as governance does
 			assert_ok!(RuntimeHelper::<Runtime>::execute_as_governance(
-				set_operating_mode_call,
-				require_weight_at_most
+				set_operating_mode_call.encode(),
+				set_operating_mode_call.get_dispatch_info().weight,
 			)
 			.ensure_complete());
 
@@ -195,11 +192,10 @@ pub fn change_bridge_parachains_pallet_mode_by_governance_works<Runtime, Paracha
 	collator_session_key: CollatorSessionKeys<Runtime>,
 	runtime_para_id: u32,
 ) where
-	Runtime: BasicParachainRuntime + pallet_bridge_parachains::Config<ParachainsPalletInstance>,
+	Runtime: BasicParachainRuntime + BridgeParachainsConfig<ParachainsPalletInstance>,
 	ParachainsPalletInstance: 'static,
-	ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
-	<Runtime as frame_system::Config>::RuntimeCall:
-		From<pallet_bridge_parachains::Call<Runtime, ParachainsPalletInstance>>,
+	RuntimeCallOf<Runtime>:
+		GetDispatchInfo + From<BridgeParachainsCall<Runtime, ParachainsPalletInstance>>,
 {
 	run_test::<Runtime, _>(collator_session_key, runtime_para_id, vec![], || {
 		let dispatch_set_operating_mode_call = |old_mode, new_mode| {
@@ -209,23 +205,19 @@ pub fn change_bridge_parachains_pallet_mode_by_governance_works<Runtime, Paracha
 				old_mode,
 			);
 
-			// overestimate - check weight for
-			// `pallet_bridge_parachains::Pallet::set_operating_mode()` call
-			let require_weight_at_most =
-				<Runtime as frame_system::Config>::DbWeight::get().reads_writes(7, 7);
-
-			// encode `set_operating_mode` call
-			let set_operating_mode_call = <Runtime as frame_system::Config>::RuntimeCall::from(pallet_bridge_parachains::Call::<
-				Runtime,
-				ParachainsPalletInstance,
-			>::set_operating_mode {
-				operating_mode: new_mode,
-			}).encode();
+			// prepare the `set_operating_mode` call
+			let set_operating_mode_call =
+				RuntimeCallOf::<Runtime>::from(pallet_bridge_parachains::Call::<
+					Runtime,
+					ParachainsPalletInstance,
+				>::set_operating_mode {
+					operating_mode: new_mode,
+				});
 
 			// execute XCM with Transacts to `initialize bridge` as governance does
 			assert_ok!(RuntimeHelper::<Runtime>::execute_as_governance(
-				set_operating_mode_call,
-				require_weight_at_most
+				set_operating_mode_call.encode(),
+				set_operating_mode_call.get_dispatch_info().weight,
 			)
 			.ensure_complete());
 
@@ -253,11 +245,10 @@ pub fn change_bridge_messages_pallet_mode_by_governance_works<Runtime, MessagesP
 	collator_session_key: CollatorSessionKeys<Runtime>,
 	runtime_para_id: u32,
 ) where
-	Runtime: BasicParachainRuntime + pallet_bridge_messages::Config<MessagesPalletInstance>,
+	Runtime: BasicParachainRuntime + BridgeMessagesConfig<MessagesPalletInstance>,
 	MessagesPalletInstance: 'static,
-	ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
-	<Runtime as frame_system::Config>::RuntimeCall:
-		From<pallet_bridge_messages::Call<Runtime, MessagesPalletInstance>>,
+	RuntimeCallOf<Runtime>:
+		GetDispatchInfo + From<BridgeMessagesCall<Runtime, MessagesPalletInstance>>,
 {
 	run_test::<Runtime, _>(collator_session_key, runtime_para_id, vec![], || {
 		let dispatch_set_operating_mode_call = |old_mode, new_mode| {
@@ -268,23 +259,18 @@ pub fn change_bridge_messages_pallet_mode_by_governance_works<Runtime, MessagesP
 				old_mode,
 			);
 
-			// overestimate - check weight for
-			// `pallet_bridge_messages::Pallet::set_operating_mode()` call
-			let require_weight_at_most =
-				<Runtime as frame_system::Config>::DbWeight::get().reads_writes(7, 7);
-
 			// encode `set_operating_mode` call
-			let set_operating_mode_call = <Runtime as frame_system::Config>::RuntimeCall::from(pallet_bridge_messages::Call::<
+			let set_operating_mode_call = RuntimeCallOf::<Runtime>::from(BridgeMessagesCall::<
 				Runtime,
 				MessagesPalletInstance,
 			>::set_operating_mode {
 				operating_mode: new_mode,
-			}).encode();
+			});
 
 			// execute XCM with Transacts to `initialize bridge` as governance does
 			assert_ok!(RuntimeHelper::<Runtime>::execute_as_governance(
-				set_operating_mode_call,
-				require_weight_at_most
+				set_operating_mode_call.encode(),
+				set_operating_mode_call.get_dispatch_info().weight,
 			)
 			.ensure_complete());
 
@@ -337,10 +323,9 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works<
 	maybe_paid_export_message: Option<MultiAsset>,
 	prepare_configuration: impl Fn(),
 ) where
-	Runtime: BasicParachainRuntime + pallet_bridge_messages::Config<MessagesPalletInstance>,
+	Runtime: BasicParachainRuntime + BridgeMessagesConfig<MessagesPalletInstance>,
 	XcmConfig: xcm_executor::Config,
 	MessagesPalletInstance: 'static,
-	ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
 {
 	assert_ne!(runtime_para_id, sibling_parachain_id);
 	let sibling_parachain_location = MultiLocation::new(1, Parachain(sibling_parachain_id));
@@ -446,15 +431,13 @@ pub fn message_dispatch_routing_works<
 ) where
 	Runtime: BasicParachainRuntime
 		+ cumulus_pallet_xcmp_queue::Config
-		+ pallet_bridge_messages::Config<MessagesPalletInstance, InboundPayload = XcmAsPlainPayload>,
+		+ BridgeMessagesConfig<MessagesPalletInstance, InboundPayload = XcmAsPlainPayload>,
 	AllPalletsWithoutSystem:
 		OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
-	<Runtime as frame_system::Config>::AccountId:
-		Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
+	AccountIdOf<Runtime>: From<AccountId32>
+		+ Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
 	XcmConfig: xcm_executor::Config,
 	MessagesPalletInstance: 'static,
-	ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
-	<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
 	HrmpChannelOpener: frame_support::inherent::ProvideInherent<
 		Call = cumulus_pallet_parachain_system::Call<Runtime>,
 	>,
@@ -488,9 +471,10 @@ pub fn message_dispatch_routing_works<
 			NetworkWithParentCount<RuntimeNetwork, NetworkDistanceAsParentCount>,
 			AlwaysLatest,
 		>((RuntimeNetwork::get(), Here));
-		let result = <<Runtime as pallet_bridge_messages::Config<MessagesPalletInstance>>::MessageDispatch>::dispatch(
-			test_data::dispatch_message(expected_lane_id, 1, bridging_message)
-		);
+		let result =
+			<<Runtime as BridgeMessagesConfig<MessagesPalletInstance>>::MessageDispatch>::dispatch(
+				test_data::dispatch_message(expected_lane_id, 1, bridging_message),
+			);
 		assert_eq!(
 			format!("{:?}", result.dispatch_level_result),
 			format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)
@@ -515,11 +499,11 @@ pub fn message_dispatch_routing_works<
 
 		// 2.1. WITHOUT opened hrmp channel -> RoutingError
 		let result =
-			<<Runtime as pallet_bridge_messages::Config<MessagesPalletInstance>>::MessageDispatch>::dispatch(
+			<<Runtime as BridgeMessagesConfig<MessagesPalletInstance>>::MessageDispatch>::dispatch(
 				DispatchMessage {
 					key: MessageKey { lane_id: expected_lane_id, nonce: 1 },
 					data: DispatchMessageData { payload: Ok(bridging_message.clone()) },
-				}
+				},
 			);
 		assert_eq!(
 			format!("{:?}", result.dispatch_level_result),
@@ -545,12 +529,13 @@ pub fn message_dispatch_routing_works<
 			included_head,
 			&alice,
 		);
-		let result = <<Runtime as pallet_bridge_messages::Config<MessagesPalletInstance>>::MessageDispatch>::dispatch(
-			DispatchMessage {
-				key: MessageKey { lane_id: expected_lane_id, nonce: 1 },
-				data: DispatchMessageData { payload: Ok(bridging_message) },
-			}
-		);
+		let result =
+			<<Runtime as BridgeMessagesConfig<MessagesPalletInstance>>::MessageDispatch>::dispatch(
+				DispatchMessage {
+					key: MessageKey { lane_id: expected_lane_id, nonce: 1 },
+					data: DispatchMessageData { payload: Ok(bridging_message) },
+				},
+			);
 		assert_eq!(
 			format!("{:?}", result.dispatch_level_result),
 			format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)
-- 
GitLab