Skip to content

Commit 9de8837

Browse files
[stable2412] Backport #7383 (#7393)
Backport #7383 into `stable2412` from bkontur. 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: Branislav Kontur <bkontur@gmail.com>
1 parent 1139f17 commit 9de8837

15 files changed

Lines changed: 382 additions & 345 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@
145145

146146
use bp_messages::{LaneState, MessageNonce};
147147
use bp_runtime::{AccountIdOf, BalanceOf, RangeInclusiveExt};
148-
pub use bp_xcm_bridge_hub::{Bridge, BridgeId, BridgeState, LocalXcmChannelManager};
149-
use bp_xcm_bridge_hub::{BridgeLocations, BridgeLocationsError};
148+
use bp_xcm_bridge_hub::BridgeLocationsError;
149+
pub use bp_xcm_bridge_hub::{
150+
Bridge, BridgeId, BridgeLocations, BridgeState, LocalXcmChannelManager,
151+
};
150152
use frame_support::{traits::fungible::MutateHold, DefaultNoBound};
151153
use frame_system::Config as SystemConfig;
152154
use pallet_bridge_messages::{Config as BridgeMessagesConfig, LanesManagerError};

cumulus/pallets/xcmp-queue/src/bridging.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
4545
}
4646
}
4747

48-
/// Adapter implementation for `bp_xcm_bridge_hub_router::XcmChannelStatusProvider` which checks
49-
/// only `OutboundXcmpStatus` for defined `SiblingParaId` if is suspended.
48+
/// Adapter implementation for `bp_xcm_bridge::ChannelStatusProvider` and/or
49+
/// `bp_xcm_bridge_hub_router::XcmChannelStatusProvider` which checks only `OutboundXcmpStatus`
50+
/// for defined `Location` if is suspended.
5051
pub struct OutXcmpChannelStatusProvider<Runtime>(core::marker::PhantomData<Runtime>);
51-
impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
52-
for OutXcmpChannelStatusProvider<Runtime>
53-
{
52+
impl<Runtime: crate::Config> OutXcmpChannelStatusProvider<Runtime> {
5453
fn is_congested(with: &Location) -> bool {
5554
// handle congestion only for a sibling parachain locations.
5655
let sibling_para_id: ParaId = match with.unpack() {
@@ -88,6 +87,14 @@ impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
8887
}
8988
}
9089

90+
impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
91+
for OutXcmpChannelStatusProvider<Runtime>
92+
{
93+
fn is_congested(with: &Location) -> bool {
94+
Self::is_congested(with)
95+
}
96+
}
97+
9198
#[cfg(feature = "runtime-benchmarks")]
9299
pub fn suspend_channel_for_benchmarks<T: crate::Config>(target: ParaId) {
93100
pallet::Pallet::<T>::suspend_channel(target)

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pallet-xcm.workspace = true
2727
xcm-executor.workspace = true
2828
xcm-runtime-apis.workspace = true
2929
pallet-bridge-messages.workspace = true
30-
pallet-xcm-bridge-hub.workspace = true
3130
cumulus-pallet-xcmp-queue.workspace = true
3231
emulated-integration-tests-common.workspace = true
3332
parachains-common.workspace = true

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pallet-xcm.workspace = true
2828
xcm-executor.workspace = true
2929
xcm-runtime-apis.workspace = true
3030
pallet-bridge-messages.workspace = true
31-
pallet-xcm-bridge-hub.workspace = true
3231
cumulus-pallet-xcmp-queue.workspace = true
3332
emulated-integration-tests-common.workspace = true
3433
parachains-common.workspace = true

cumulus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ sp-io.workspace = true
2020
sp-keyring.workspace = true
2121
sp-keyring.default-features = true
2222
sp-runtime.workspace = true
23+
sp-std.workspace = true
2324
sp-tracing.workspace = true
2425
sp-tracing.default-features = true
2526
pallet-balances.workspace = true
@@ -42,13 +43,11 @@ bp-polkadot-core.workspace = true
4243
bp-relayers.workspace = true
4344
bp-runtime.workspace = true
4445
bp-test-utils.workspace = true
45-
bp-xcm-bridge-hub.workspace = true
4646
pallet-bridge-grandpa.workspace = true
4747
pallet-bridge-parachains.workspace = true
4848
pallet-bridge-messages = { features = ["test-helpers"], workspace = true }
4949
pallet-bridge-relayers.workspace = true
5050
pallet-xcm-bridge-hub.workspace = true
51-
bridge-runtime-common.workspace = true
5251

5352
[features]
5453
default = ["std"]
@@ -61,8 +60,6 @@ std = [
6160
"bp-relayers/std",
6261
"bp-runtime/std",
6362
"bp-test-utils/std",
64-
"bp-xcm-bridge-hub/std",
65-
"bridge-runtime-common/std",
6663
"codec/std",
6764
"cumulus-pallet-parachain-system/std",
6865
"cumulus-pallet-xcmp-queue/std",
@@ -83,6 +80,7 @@ std = [
8380
"sp-core/std",
8481
"sp-io/std",
8582
"sp-runtime/std",
83+
"sp-std/std",
8684
"xcm-builder/std",
8785
"xcm-executor/std",
8886
"xcm/std",

cumulus/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern crate alloc;
2424
pub use bp_test_utils::test_header;
2525
pub use parachains_runtimes_test_utils::*;
2626
use sp_runtime::Perbill;
27-
pub use test_cases::helpers::{
27+
pub use test_cases::helpers::for_pallet_xcm_bridge_hub::{
2828
ensure_opened_bridge, open_bridge_with_extrinsic, open_bridge_with_storage,
2929
};
3030

cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
use crate::{
2121
test_cases::{bridges_prelude::*, helpers, run_test},
2222
test_data,
23+
test_data::XcmAsPlainPayload,
2324
};
2425

2526
use alloc::{boxed::Box, vec};
2627
use bp_header_chain::ChainWithGrandpa;
2728
use bp_messages::UnrewardedRelayersState;
2829
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
29-
use bp_xcm_bridge_hub::XcmAsPlainPayload;
3030
use frame_support::traits::{OnFinalize, OnInitialize};
3131
use frame_system::pallet_prelude::BlockNumberFor;
3232
use pallet_bridge_messages::{BridgedChainOf, LaneIdOf, ThisChainOf};

cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use crate::{
2121
test_cases::{bridges_prelude::*, helpers, run_test},
2222
test_data,
23+
test_data::XcmAsPlainPayload,
2324
};
2425

2526
use alloc::{boxed::Box, vec};
@@ -28,7 +29,6 @@ use bp_messages::UnrewardedRelayersState;
2829
use bp_polkadot_core::parachains::ParaHash;
2930
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
3031
use bp_runtime::{Chain, Parachain};
31-
use bp_xcm_bridge_hub::XcmAsPlainPayload;
3232
use frame_support::traits::{OnFinalize, OnInitialize};
3333
use frame_system::pallet_prelude::BlockNumberFor;
3434
use pallet_bridge_messages::{BridgedChainOf, LaneIdOf, ThisChainOf};

0 commit comments

Comments
 (0)