Skip to content

Commit 47155f8

Browse files
paritytech-cmd-bot-polkadot-sdk[bot]franciscoaguirreEgorPopelyaev
authored
[stable2407] Backport #5913 (#6004)
Backport #5913 into `stable2407` from franciscoaguirre. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: Egor_P <egor@parity.io>
1 parent 88c3250 commit 47155f8

File tree

12 files changed

+388
-36
lines changed

12 files changed

+388
-36
lines changed

Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bridges/modules/xcm-bridge-hub-router/src/lib.rs

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub mod pallet {
9696
/// Origin of the sibling bridge hub that is allowed to report bridge status.
9797
type BridgeHubOrigin: EnsureOrigin<Self::RuntimeOrigin>;
9898
/// Actual message sender (`HRMP` or `DMP`) to the sibling bridge hub location.
99-
type ToBridgeHubSender: SendXcm + InspectMessageQueues;
99+
type ToBridgeHubSender: SendXcm;
100100
/// Underlying channel with the sibling bridge hub. It must match the channel, used
101101
/// by the `Self::ToBridgeHubSender`.
102102
type WithBridgeHubChannel: XcmChannelStatusProvider;
@@ -398,12 +398,12 @@ impl<T: Config<I>, I: 'static> SendXcm for Pallet<T, I> {
398398
}
399399

400400
impl<T: Config<I>, I: 'static> InspectMessageQueues for Pallet<T, I> {
401-
fn clear_messages() {
402-
ViaBridgeHubExporter::<T, I>::clear_messages()
403-
}
401+
fn clear_messages() {}
404402

403+
/// This router needs to implement `InspectMessageQueues` but doesn't have to
404+
/// return any messages, since it just reuses the `XcmpQueue` router.
405405
fn get_messages() -> Vec<(VersionedLocation, Vec<VersionedXcm<()>>)> {
406-
ViaBridgeHubExporter::<T, I>::get_messages()
406+
Vec::new()
407407
}
408408
}
409409

@@ -648,34 +648,13 @@ mod tests {
648648
}
649649

650650
#[test]
651-
fn get_messages_works() {
651+
fn get_messages_does_not_return_anything() {
652652
run_test(|| {
653653
assert_ok!(send_xcm::<XcmBridgeHubRouter>(
654654
(Parent, Parent, GlobalConsensus(BridgedNetworkId::get()), Parachain(1000)).into(),
655655
vec![ClearOrigin].into()
656656
));
657-
assert_eq!(
658-
XcmBridgeHubRouter::get_messages(),
659-
vec![(
660-
VersionedLocation::V4((Parent, Parachain(1002)).into()),
661-
vec![VersionedXcm::V4(
662-
Xcm::builder()
663-
.withdraw_asset((Parent, 1_002_000))
664-
.buy_execution((Parent, 1_002_000), Unlimited)
665-
.set_appendix(
666-
Xcm::builder_unsafe()
667-
.deposit_asset(AllCounted(1), (Parent, Parachain(1000)))
668-
.build()
669-
)
670-
.export_message(
671-
Kusama,
672-
Parachain(1000),
673-
Xcm::builder_unsafe().clear_origin().build()
674-
)
675-
.build()
676-
)],
677-
),],
678-
);
657+
assert_eq!(XcmBridgeHubRouter::get_messages(), vec![]);
679658
});
680659
}
681660
}

cumulus/pallets/parachain-system/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,11 @@ impl<T: Config> InspectMessageQueues for Pallet<T> {
16231623
.map(|encoded_message| VersionedXcm::<()>::decode(&mut &encoded_message[..]).unwrap())
16241624
.collect();
16251625

1626-
vec![(VersionedLocation::V4(Parent.into()), messages)]
1626+
if messages.is_empty() {
1627+
vec![]
1628+
} else {
1629+
vec![(VersionedLocation::from(Location::parent()), messages)]
1630+
}
16271631
}
16281632
}
16291633

0 commit comments

Comments
 (0)