From 931fd3714a68d9123dd07186a3c3187cc1c15584 Mon Sep 17 00:00:00 2001
From: Branislav Kontur <bkontur@gmail.com>
Date: Thu, 23 Jan 2025 12:55:14 +0100
Subject: [PATCH] Bridges small nits/improvements (#7307)

This PR contains small fixes identified during work on the larger PR:
https://github.com/paritytech/polkadot-sdk/issues/6906.

---------

Co-authored-by: command-bot <>
(cherry picked from commit 085da479dee8e09ad3de83dbc59b304bd36b4ebe)
---
 Cargo.lock                                       |  3 ---
 bridges/bin/runtime-common/Cargo.toml            |  2 --
 bridges/bin/runtime-common/src/integrity.rs      |  9 +++++----
 .../integration-tests/emulated/common/Cargo.toml |  2 --
 .../bridge-hubs/bridge-hub-rococo/Cargo.toml     |  2 --
 .../src/bridge_to_bulletin_config.rs             |  1 +
 .../src/bridge_to_westend_config.rs              |  1 +
 .../src/bridge_to_rococo_config.rs               |  1 +
 polkadot/xcm/xcm-builder/src/barriers.rs         |  2 +-
 prdoc/pr_7307.prdoc                              | 16 ++++++++++++++++
 10 files changed, 25 insertions(+), 14 deletions(-)
 create mode 100644 prdoc/pr_7307.prdoc

diff --git a/Cargo.lock b/Cargo.lock
index 1ea9866dc82..5a6ed3919b5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2051,7 +2051,6 @@ version = "0.16.2"
 dependencies = [
  "bp-asset-hub-rococo",
  "bp-asset-hub-westend",
- "bp-bridge-hub-polkadot",
  "bp-bridge-hub-rococo",
  "bp-bridge-hub-westend",
  "bp-header-chain",
@@ -2353,7 +2352,6 @@ dependencies = [
  "bp-relayers",
  "bp-runtime",
  "bp-test-utils",
- "bp-xcm-bridge-hub",
  "frame-support",
  "frame-system",
  "log",
@@ -5139,7 +5137,6 @@ dependencies = [
  "asset-test-utils",
  "bp-messages",
  "bp-xcm-bridge-hub",
- "bridge-runtime-common",
  "cumulus-pallet-parachain-system",
  "cumulus-pallet-xcmp-queue",
  "cumulus-primitives-core",
diff --git a/bridges/bin/runtime-common/Cargo.toml b/bridges/bin/runtime-common/Cargo.toml
index def35c5cc2a..e426bab245b 100644
--- a/bridges/bin/runtime-common/Cargo.toml
+++ b/bridges/bin/runtime-common/Cargo.toml
@@ -22,7 +22,6 @@ bp-parachains.workspace = true
 bp-polkadot-core.workspace = true
 bp-relayers.workspace = true
 bp-runtime.workspace = true
-bp-xcm-bridge-hub.workspace = true
 pallet-bridge-grandpa.workspace = true
 pallet-bridge-messages.workspace = true
 pallet-bridge-parachains.workspace = true
@@ -52,7 +51,6 @@ std = [
 	"bp-polkadot-core/std",
 	"bp-relayers/std",
 	"bp-runtime/std",
-	"bp-xcm-bridge-hub/std",
 	"codec/std",
 	"frame-support/std",
 	"frame-system/std",
diff --git a/bridges/bin/runtime-common/src/integrity.rs b/bridges/bin/runtime-common/src/integrity.rs
index 535f1a26e5e..a400df1c2a5 100644
--- a/bridges/bin/runtime-common/src/integrity.rs
+++ b/bridges/bin/runtime-common/src/integrity.rs
@@ -30,7 +30,6 @@ use pallet_bridge_messages::WeightInfoExt as _;
 // Re-export to avoid include all dependencies everywhere.
 #[doc(hidden)]
 pub mod __private {
-	pub use bp_xcm_bridge_hub;
 	pub use static_assertions;
 }
 
@@ -66,9 +65,9 @@ macro_rules! assert_bridge_messages_pallet_types(
 		with_bridged_chain_messages_instance: $i:path,
 		this_chain: $this:path,
 		bridged_chain: $bridged:path,
+		expected_payload_type: $payload:path,
 	) => {
 		{
-			use $crate::integrity::__private::bp_xcm_bridge_hub::XcmAsPlainPayload;
 			use $crate::integrity::__private::static_assertions::assert_type_eq_all;
 			use bp_messages::ChainWithMessages;
 			use bp_runtime::Chain;
@@ -81,8 +80,8 @@ macro_rules! assert_bridge_messages_pallet_types(
 			assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::ThisChain, $this);
 			assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::BridgedChain, $bridged);
 
-			assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::OutboundPayload, XcmAsPlainPayload);
-			assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::InboundPayload, XcmAsPlainPayload);
+			assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::OutboundPayload, $payload);
+			assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::InboundPayload, $payload);
 		}
 	}
 );
@@ -97,6 +96,7 @@ macro_rules! assert_complete_bridge_types(
 		with_bridged_chain_messages_instance: $mi:path,
 		this_chain: $this:path,
 		bridged_chain: $bridged:path,
+		expected_payload_type: $payload:path,
 	) => {
 		$crate::assert_chain_types!(runtime: $r, this_chain: $this);
 		$crate::assert_bridge_messages_pallet_types!(
@@ -104,6 +104,7 @@ macro_rules! assert_complete_bridge_types(
 			with_bridged_chain_messages_instance: $mi,
 			this_chain: $this,
 			bridged_chain: $bridged,
+			expected_payload_type: $payload,
 		);
 	}
 );
diff --git a/cumulus/parachains/integration-tests/emulated/common/Cargo.toml b/cumulus/parachains/integration-tests/emulated/common/Cargo.toml
index 741741bab02..78380385b45 100644
--- a/cumulus/parachains/integration-tests/emulated/common/Cargo.toml
+++ b/cumulus/parachains/integration-tests/emulated/common/Cargo.toml
@@ -62,5 +62,3 @@ pallet-bridge-messages.workspace = true
 pallet-bridge-messages.default-features = true
 pallet-xcm-bridge-hub.workspace = true
 pallet-xcm-bridge-hub.default-features = true
-bridge-runtime-common.workspace = true
-bridge-runtime-common.default-features = true
diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
index 80750ca00c7..f45b3b1f9a0 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
+++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml
@@ -79,7 +79,6 @@ parachains-common.workspace = true
 testnet-parachains-constants = { features = ["rococo"], workspace = true }
 bp-asset-hub-rococo.workspace = true
 bp-asset-hub-westend.workspace = true
-bp-bridge-hub-polkadot.workspace = true
 bp-bridge-hub-rococo.workspace = true
 bp-bridge-hub-westend.workspace = true
 bp-header-chain.workspace = true
@@ -123,7 +122,6 @@ default = ["std"]
 std = [
 	"bp-asset-hub-rococo/std",
 	"bp-asset-hub-westend/std",
-	"bp-bridge-hub-polkadot/std",
 	"bp-bridge-hub-rococo/std",
 	"bp-bridge-hub-westend/std",
 	"bp-header-chain/std",
diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs
index ea927534e71..39b5fa85c81 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs
@@ -204,6 +204,7 @@ mod tests {
 			with_bridged_chain_messages_instance: WithRococoBulletinMessagesInstance,
 			this_chain: bp_bridge_hub_rococo::BridgeHubRococo,
 			bridged_chain: bp_polkadot_bulletin::PolkadotBulletin,
+			expected_payload_type: XcmAsPlainPayload,
 		);
 
 		// we can't use `assert_complete_bridge_constants` here, because there's a trick with
diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs
index 97a28f99af0..067eb214ffa 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs
@@ -292,6 +292,7 @@ mod tests {
 			with_bridged_chain_messages_instance: WithBridgeHubWestendMessagesInstance,
 			this_chain: bp_bridge_hub_rococo::BridgeHubRococo,
 			bridged_chain: bp_bridge_hub_westend::BridgeHubWestend,
+			expected_payload_type: XcmAsPlainPayload,
 		);
 
 		assert_complete_with_parachain_bridge_constants::<
diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs
index 39f64a82ace..47b628a8aeb 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs
@@ -320,6 +320,7 @@ mod tests {
 			with_bridged_chain_messages_instance: WithBridgeHubRococoMessagesInstance,
 			this_chain: bp_bridge_hub_westend::BridgeHubWestend,
 			bridged_chain: bp_bridge_hub_rococo::BridgeHubRococo,
+			expected_payload_type: XcmAsPlainPayload,
 		);
 
 		assert_complete_with_parachain_bridge_constants::<
diff --git a/polkadot/xcm/xcm-builder/src/barriers.rs b/polkadot/xcm/xcm-builder/src/barriers.rs
index 5d95005eb66..6e29c173ce9 100644
--- a/polkadot/xcm/xcm-builder/src/barriers.rs
+++ b/polkadot/xcm/xcm-builder/src/barriers.rs
@@ -484,7 +484,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
 					if matches!(origin, Location { parents: 1, interior: Here }) =>
 				{
 					log::warn!(
-						target: "xcm::barrier",
+						target: "xcm::barriers",
 						"Unexpected ReserveAssetDeposited from the Relay Chain",
 					);
 					Ok(ControlFlow::Continue(()))
diff --git a/prdoc/pr_7307.prdoc b/prdoc/pr_7307.prdoc
new file mode 100644
index 00000000000..b27aace0bd1
--- /dev/null
+++ b/prdoc/pr_7307.prdoc
@@ -0,0 +1,16 @@
+title: Bridges small nits/improvements
+doc:
+- audience: Runtime Dev
+  description: |
+      This PR introduces a new `expected_payload_type` parameter to the Bridges `assert_complete_bridge_types` macro.
+crates:
+- name: bridge-runtime-common
+  bump: patch
+- name: bridge-hub-rococo-runtime
+  bump: patch
+- name: bridge-hub-westend-runtime
+  bump: patch
+- name: staging-xcm-builder
+  bump: patch
+- name: emulated-integration-tests-common
+  bump: patch
-- 
GitLab