Skip to content

Commit

Permalink
BACKPORT-CONFLICT
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur authored and github-actions[bot] committed Jan 29, 2025
1 parent 008650b commit 1e69297
Show file tree
Hide file tree
Showing 15 changed files with 570 additions and 335 deletions.
91 changes: 91 additions & 0 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions bridges/modules/xcm-bridge-hub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@

use bp_messages::{LaneState, MessageNonce};
use bp_runtime::{AccountIdOf, BalanceOf, RangeInclusiveExt};
pub use bp_xcm_bridge_hub::{Bridge, BridgeId, BridgeState, LocalXcmChannelManager};
use bp_xcm_bridge_hub::{BridgeLocations, BridgeLocationsError};
use bp_xcm_bridge_hub::BridgeLocationsError;
pub use bp_xcm_bridge_hub::{
Bridge, BridgeId, BridgeLocations, BridgeState, LocalXcmChannelManager,
};
use frame_support::{traits::fungible::MutateHold, DefaultNoBound};
use frame_system::Config as SystemConfig;
use pallet_bridge_messages::{Config as BridgeMessagesConfig, LanesManagerError};
Expand Down
17 changes: 12 additions & 5 deletions cumulus/pallets/xcmp-queue/src/bridging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
}
}

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

impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
for OutXcmpChannelStatusProvider<Runtime>
{
fn is_congested(with: &Location) -> bool {
Self::is_congested(with)
}
}

#[cfg(feature = "runtime-benchmarks")]
pub fn suspend_channel_for_benchmarks<T: crate::Config>(target: ParaId) {
pallet::Pallet::<T>::suspend_channel(target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ workspace = true
[dependencies]
codec = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
<<<<<<< HEAD
hex-literal = { workspace = true, default-features = true }
sp-core.workspace = true
frame-support.workspace = true
Expand All @@ -34,6 +35,33 @@ parachains-common.workspace = true
parachains-common.default-features = true
rococo-system-emulated-network.workspace = true
rococo-westend-system-emulated-network.workspace = true
=======

# Substrate
frame-support = { workspace = true }
pallet-asset-conversion = { workspace = true }
pallet-assets = { workspace = true }
pallet-balances = { workspace = true }
pallet-message-queue = { workspace = true, default-features = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }

# Polkadot
pallet-xcm = { workspace = true }
xcm = { workspace = true }
xcm-executor = { workspace = true }
xcm-runtime-apis = { workspace = true }

# Bridges
pallet-bridge-messages = { workspace = true }

# Cumulus
cumulus-pallet-xcmp-queue = { workspace = true }
emulated-integration-tests-common = { workspace = true }
parachains-common = { workspace = true, default-features = true }
rococo-system-emulated-network = { workspace = true }
rococo-westend-system-emulated-network = { workspace = true }
>>>>>>> ada12be6 (Bridges small nits/improvements (#7383))
testnet-parachains-constants = { features = ["rococo", "westend"], workspace = true, default-features = true }
snowbridge-core.workspace = true
snowbridge-router-primitives.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ hex-literal = { workspace = true, default-features = true }
codec = { workspace = true }
log = { workspace = true }
scale-info = { workspace = true }
<<<<<<< HEAD
frame-support.workspace = true
pallet-assets.workspace = true
pallet-asset-conversion.workspace = true
Expand All @@ -34,6 +35,34 @@ emulated-integration-tests-common.workspace = true
parachains-common.workspace = true
parachains-common.default-features = true
rococo-westend-system-emulated-network.workspace = true
=======

# Substrate
frame-support = { workspace = true }
pallet-asset-conversion = { workspace = true }
pallet-assets = { workspace = true }
pallet-balances = { workspace = true }
pallet-message-queue = { workspace = true, default-features = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }

# Polkadot
pallet-xcm = { workspace = true }
xcm = { workspace = true }
xcm-executor = { workspace = true }
xcm-runtime-apis = { workspace = true }

# Bridges
pallet-bridge-messages = { workspace = true }

# Cumulus
asset-hub-westend-runtime = { workspace = true }
bridge-hub-westend-runtime = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
emulated-integration-tests-common = { workspace = true }
parachains-common = { workspace = true, default-features = true }
rococo-westend-system-emulated-network = { workspace = true }
>>>>>>> ada12be6 (Bridges small nits/improvements (#7383))
testnet-parachains-constants = { features = ["rococo", "westend"], workspace = true, default-features = true }
asset-hub-westend-runtime.workspace = true
bridge-hub-westend-runtime.workspace = true
Expand Down
43 changes: 43 additions & 0 deletions cumulus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ workspace = true
codec = { features = ["derive", "max-encoded-len"], workspace = true }
impl-trait-for-tuples = { workspace = true }
log = { workspace = true }
<<<<<<< HEAD
frame-support.workspace = true
frame-system.workspace = true
sp-core.workspace = true
Expand Down Expand Up @@ -45,6 +46,44 @@ bp-test-utils.workspace = true
bp-xcm-bridge-hub.workspace = true
pallet-bridge-grandpa.workspace = true
pallet-bridge-parachains.workspace = true
=======

# Substrate
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-balances = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-utility = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-keyring = { workspace = true, default-features = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
sp-tracing = { workspace = true, default-features = true }

# Cumulus
asset-test-utils = { workspace = true, default-features = true }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
parachains-common = { workspace = true }
parachains-runtimes-test-utils = { workspace = true }

# Polkadot
pallet-xcm = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }

# Bridges
bp-header-chain = { workspace = true }
bp-messages = { workspace = true }
bp-parachains = { workspace = true }
bp-polkadot-core = { workspace = true }
bp-relayers = { workspace = true }
bp-runtime = { workspace = true }
bp-test-utils = { workspace = true }
pallet-bridge-grandpa = { workspace = true }
>>>>>>> ada12be6 (Bridges small nits/improvements (#7383))
pallet-bridge-messages = { features = ["test-helpers"], workspace = true }
pallet-bridge-relayers.workspace = true
pallet-xcm-bridge-hub.workspace = true
Expand All @@ -61,8 +100,11 @@ std = [
"bp-relayers/std",
"bp-runtime/std",
"bp-test-utils/std",
<<<<<<< HEAD
"bp-xcm-bridge-hub/std",
"bridge-runtime-common/std",
=======
>>>>>>> ada12be6 (Bridges small nits/improvements (#7383))
"codec/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcmp-queue/std",
Expand All @@ -83,6 +125,7 @@ std = [
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern crate alloc;
pub use bp_test_utils::test_header;
pub use parachains_runtimes_test_utils::*;
use sp_runtime::Perbill;
pub use test_cases::helpers::{
pub use test_cases::helpers::for_pallet_xcm_bridge_hub::{
ensure_opened_bridge, open_bridge_with_extrinsic, open_bridge_with_storage,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
use crate::{
test_cases::{bridges_prelude::*, helpers, run_test},
test_data,
test_data::XcmAsPlainPayload,
};

use alloc::{boxed::Box, vec};
use bp_header_chain::ChainWithGrandpa;
use bp_messages::UnrewardedRelayersState;
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_xcm_bridge_hub::XcmAsPlainPayload;
use frame_support::traits::{OnFinalize, OnInitialize};
use frame_system::pallet_prelude::BlockNumberFor;
use pallet_bridge_messages::{BridgedChainOf, LaneIdOf, ThisChainOf};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use crate::{
test_cases::{bridges_prelude::*, helpers, run_test},
test_data,
test_data::XcmAsPlainPayload,
};

use alloc::{boxed::Box, vec};
Expand All @@ -28,7 +29,6 @@ use bp_messages::UnrewardedRelayersState;
use bp_polkadot_core::parachains::ParaHash;
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_runtime::{Chain, Parachain};
use bp_xcm_bridge_hub::XcmAsPlainPayload;
use frame_support::traits::{OnFinalize, OnInitialize};
use frame_system::pallet_prelude::BlockNumberFor;
use pallet_bridge_messages::{BridgedChainOf, LaneIdOf, ThisChainOf};
Expand Down
Loading

0 comments on commit 1e69297

Please sign in to comment.