Skip to content

Commit

Permalink
Bridges small nits/improvements (#7307)
Browse files Browse the repository at this point in the history
This PR contains small fixes identified during work on the larger PR:
#6906.

---------

Co-authored-by: command-bot <>
(cherry picked from commit 085da47)
  • Loading branch information
bkontur committed Jan 29, 2025
1 parent 008650b commit 931fd37
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 14 deletions.
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions bridges/bin/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions bridges/bin/runtime-common/src/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
}
);
Expand All @@ -97,13 +96,15 @@ 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!(
runtime: $r,
with_bridged_chain_messages_instance: $mi,
this_chain: $this,
bridged_chain: $bridged,
expected_payload_type: $payload,
);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::<
Expand Down
2 changes: 1 addition & 1 deletion polkadot/xcm/xcm-builder/src/barriers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(()))
Expand Down
16 changes: 16 additions & 0 deletions prdoc/pr_7307.prdoc
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 931fd37

Please sign in to comment.