Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
d6044a0
add `asset-hub-rococo-runtime` as a copy of `asset-hub-kusama-runtime`
acatangiu Sep 8, 2023
ec28f46
update new `asset-hub-rococo-runtime` with rococo-specific components
acatangiu Sep 8, 2023
b320b1f
asset-hub-rococo-runtime: add asset transfer over bridge capabilities
acatangiu Sep 8, 2023
b3c1810
asset-hub-rococo-runtime: add asset transfer over bridge tests
acatangiu Sep 8, 2023
3bc4634
fix toml formatting
acatangiu Sep 8, 2023
4eccdf4
add more tests to Bridge Hubs
acatangiu Sep 8, 2023
e3d77f8
bridge-hubs: add script for testing Rococo <> Wococo bridge
acatangiu Sep 11, 2023
52c7cd5
Do not consume `msg` on `NotApplicable` for remote exporters
bkontur Sep 12, 2023
ff2891c
Added bridging configuration + tests for AssetHubRococo vs AssetHubWo…
bkontur Sep 13, 2023
4f0776d
Merge remote-tracking branch 'origin/master' into bko-asset-hub-rococ…
bkontur Sep 13, 2023
f18f146
".git/.scripts/commands/fmt/fmt.sh"
Sep 13, 2023
a717e91
Merge branch 'master' into asset-hub-rococo-runtime
bkontur Sep 13, 2023
754ed42
Added `asset-hub-(r/w)ococo` to `polkadot-parachain`
bkontur Sep 13, 2023
ddc09d3
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Sep 13, 2023
03b1bb4
Merge branch 'master' into asset-hub-rococo-runtime
bkontur Sep 14, 2023
00cfa54
Finished local run asset transfer for AssetHubRococo/AssetHubWococo
bkontur Sep 14, 2023
116010f
Zombienet tweaks
bkontur Sep 14, 2023
ab648a5
Just paid `ExportMessage` on BridgeHubRococo/BridgeHubWococo
bkontur Sep 15, 2023
b78343b
Added congestion to BridgeHubs + nits
bkontur Sep 15, 2023
3f3081b
fix typos
acatangiu Sep 15, 2023
5d318c5
Typo
bkontur Sep 15, 2023
85b7f84
Fixed benchmarks for asset-hub-rococo
bkontur Sep 15, 2023
642e29e
Tweaks to BridgeHubRococo
bkontur Sep 15, 2023
09e8c15
From PR review
bkontur Sep 15, 2023
bc44872
xcm-emulator nits
bkontur Sep 15, 2023
8df113a
Merge branch 'master' into asset-hub-rococo-runtime
bkontur Sep 15, 2023
d64d1fc
Fix features
bkontur Sep 15, 2023
b20c353
Fixed
bkontur Sep 15, 2023
d04bf3a
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Sep 19, 2023
9f0d255
Fix for benchmarks
bkontur Sep 19, 2023
1faec85
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Sep 19, 2023
76e513d
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Sep 19, 2023
99e001c
Added xcm-emulator integration test for AssetHubRococo (as copy of As…
bkontur Sep 20, 2023
3a0b3c1
Addressing pr comments for xcmp-queue
bkontur Sep 21, 2023
791b88a
Added test for `AllowUnpaidTransactsFrom`
bkontur Sep 21, 2023
a4f3f4e
Nit
bkontur Sep 21, 2023
a4ef4f5
Simplify Location and AssetFilter
bkontur Sep 21, 2023
713d7ad
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Sep 21, 2023
33b672c
fmt
bkontur Sep 21, 2023
474b8a4
ensure_configuration -> prepare_configuration
bkontur Sep 22, 2023
b500fbc
Constants nit
bkontur Sep 22, 2023
d4dc7c8
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Sep 25, 2023
559b954
Add claiming relayer rewards to Ro/Wo demo
bkontur Sep 27, 2023
89fc271
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Sep 27, 2023
6e7e53d
Deduplicate with `build_congestion_message`
bkontur Sep 27, 2023
7cbfbb2
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Sep 27, 2023
42d6fe4
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Oct 3, 2023
132c5a0
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Oct 4, 2023
94619d7
Compile
bkontur Oct 5, 2023
5f785b6
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Oct 5, 2023
58c4089
Fix to compile
bkontur Oct 5, 2023
14c2855
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur Oct 5, 2023
653b9fb
Add filtering capabilities for remote location to `NetworkExportTable`
bkontur Oct 11, 2023
62bbee0
Expose `BridgeMessage` field as `pub` because it cannot be access out…
bkontur Oct 11, 2023
19381bd
Move `StartsWith` and `Equals` to `xcm-builder`
bkontur Oct 11, 2023
255595e
Refactored and simplified xcm stuff
bkontur Oct 11, 2023
ecf0688
Merge branch 'bko-xcm-builder-enhancements' into asset-hub-rococo-run…
bkontur Oct 11, 2023
1269bd7
Fix import
bkontur Oct 11, 2023
8dcca0f
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur Oct 11, 2023
c7b1625
Added generic `EqualsTo` implementation for `frame_support::traits::C…
bkontur Oct 11, 2023
296dc1c
Merge remote-tracking branch 'origin/master' into bko-xcm-builder-enh…
bkontur Oct 11, 2023
889e9e2
Removed import
bkontur Oct 11, 2023
e95ec38
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur Oct 11, 2023
04cabcd
More fixes
bkontur Oct 12, 2023
5fdd787
PR comments + added `LocationWithAssetFilters` useful for `XcmTelepor…
bkontur Oct 13, 2023
ea0997b
PR comments
bkontur Oct 14, 2023
668756d
Merge branch 'bko-xcm-builder-enhancements' into asset-hub-rococo-run…
bkontur Oct 15, 2023
fa87f2a
Removed unnecessary import
bkontur Oct 15, 2023
65761b5
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur Oct 15, 2023
6c087c2
Update cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
bkontur Oct 15, 2023
4d07d71
Removed unnecessary import
bkontur Oct 15, 2023
39a227f
Fmt
bkontur Oct 15, 2023
0cfd718
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur Oct 15, 2023
34a438d
Update cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
bkontur Oct 16, 2023
2555615
PR comments - removed `FellowsBodyId`
bkontur Oct 16, 2023
3ade1cf
Doc
bkontur Oct 16, 2023
3089154
Serban's nit + test
bkontur Oct 16, 2023
2c04796
Merge branch 'bko-xcm-builder-enhancements' into asset-hub-rococo-run…
bkontur Oct 16, 2023
79f6794
Removed comment
bkontur Oct 16, 2023
98efacd
Changed `RuntimeVersion` to be compatible with live Rococo' AssetHub …
bkontur Oct 16, 2023
c26fde1
Typo
bkontur Oct 16, 2023
be2210a
PR comments - Added `UnpaidExecution` + refactor of `AllowTransactsFrom`
bkontur Oct 16, 2023
49d45ba
Removed unnecessary barrier `AllowTransactsFrom`
bkontur Oct 16, 2023
2c32b43
Update polkadot/xcm/xcm-builder/src/universal_exports.rs
bkontur Oct 17, 2023
ee1d681
PR comment - case with payment to the test
bkontur Oct 17, 2023
cfa2616
Merge remote-tracking branch 'origin/master' into bko-xcm-builder-enh…
bkontur Oct 17, 2023
4941b44
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur Oct 17, 2023
e82b712
Update cumulus/parachains/runtimes/assets/test-utils/src/test_cases_o…
bkontur Oct 17, 2023
0887912
Update cumulus/parachains/runtimes/assets/test-utils/src/test_cases_o…
bkontur Oct 17, 2023
2ddf42e
Update cumulus/parachains/runtimes/assets/test-utils/src/test_cases_o…
bkontur Oct 17, 2023
f98ee90
Merge branch 'master' of github.com:paritytech/polkadot-sdk into asse…
acatangiu Oct 17, 2023
1fb29e8
AssetHub Rococo: make all SPs trusted teleporters
acatangiu Oct 17, 2023
5392057
Merge branch 'master' into asset-hub-rococo-runtime
acatangiu Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ members = [
"cumulus/parachains/pallets/ping",
"cumulus/parachains/runtimes/assets/asset-hub-kusama",
"cumulus/parachains/runtimes/assets/asset-hub-polkadot",
"cumulus/parachains/runtimes/assets/asset-hub-rococo",
"cumulus/parachains/runtimes/assets/asset-hub-westend",
"cumulus/parachains/runtimes/assets/common",
"cumulus/parachains/runtimes/assets/test-utils",
Expand Down
26 changes: 26 additions & 0 deletions cumulus/bridges/primitives/chain-asset-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "bp-asset-hub-rococo"
description = "Primitives of AssetHubRococo parachain runtime."
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }

# Substrate Dependencies
frame-support = { path = "../../../../substrate/frame/support", default-features = false }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false }

[features]
default = [ "std" ]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"frame-support/std",
"scale-info/std",
]
49 changes: 49 additions & 0 deletions cumulus/bridges/primitives/chain-asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.

// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

//! Module with configuration which reflects AssetHubRococo runtime setup.

#![cfg_attr(not(feature = "std"), no_std)]

use codec::{Decode, Encode};
use scale_info::TypeInfo;

pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;

/// `AssetHubRococo` Runtime `Call` enum.
///
/// The enum represents a subset of possible `Call`s we can send to `AssetHubRococo` chain.
/// Ideally this code would be auto-generated from metadata, because we want to
/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s.
///
/// All entries here (like pretty much in the entire file) must be kept in sync with
/// `AssetHubRococo` `construct_runtime`, so that we maintain SCALE-compatibility.
#[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call {
/// `ToPolkadotXcmRouter` bridge pallet.
#[codec(index = 43)]
ToPolkadotXcmRouter(XcmBridgeHubRouterCall),
}

frame_support::parameter_types! {
/// Some sane weight to execute `xcm::Transact(pallet-xcm-bridge-hub-router::Call::report_bridge_status)`.
pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144);

/// Base delivery fee to `BridgeHubRococo`.
/// (initially was calculated `170733333` + `10%` by test `BridgeHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer`)
pub const BridgeHubRococoBaseFeeInDots: u128 = 187806666;
}
5 changes: 5 additions & 0 deletions cumulus/pallets/xcmp-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ cumulus-primitives-core = { path = "../../primitives/core", default-features = f
# Optional import for benchmarking
frame-benchmarking = { path = "../../../substrate/frame/benchmarking", default-features = false, optional = true}

# Bridges
bp-xcm-bridge-hub-router = { path = "../../bridges/primitives/xcm-bridge-hub-router", default-features = false, optional = true }

[dev-dependencies]

# Substrate
Expand All @@ -43,6 +46,7 @@ cumulus-pallet-parachain-system = { path = "../parachain-system" }
[features]
default = [ "std" ]
std = [
"bp-xcm-bridge-hub-router?/std",
"codec/std",
"cumulus-primitives-core/std",
"frame-benchmarking?/std",
Expand Down Expand Up @@ -77,3 +81,4 @@ try-runtime = [
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
]
bridging = [ "bp-xcm-bridge-hub-router" ]
116 changes: 116 additions & 0 deletions cumulus/pallets/xcmp-queue/src/bridging.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::pallet;
use cumulus_primitives_core::ParaId;
use frame_support::pallet_prelude::Get;

/// Adapter implementation for `bp_xcm_bridge_hub_router::XcmChannelStatusProvider` which checks
/// both `OutboundXcmpStatus` and `InboundXcmpStatus` for defined `ParaId` if any of those is
/// suspended.
pub struct InboundAndOutboundXcmpChannelCongestionStatusProvider<SiblingBridgeHubParaId, Runtime>(
Comment thread
bkontur marked this conversation as resolved.
Outdated
sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>,
);
impl<SiblingBridgeHubParaId: Get<ParaId>, Runtime: crate::Config>
bp_xcm_bridge_hub_router::XcmChannelStatusProvider
for InboundAndOutboundXcmpChannelCongestionStatusProvider<SiblingBridgeHubParaId, Runtime>
{
fn is_congested() -> bool {
// if the outbound channel with recipient is suspended, it means that one of further
// bridge queues (e.g. bridge queue between two bridge hubs) is overloaded, so we shall
// take larger fee for our outbound messages
let sibling_bridge_hub_id: ParaId = SiblingBridgeHubParaId::get();
let outbound_channels = pallet::OutboundXcmpStatus::<Runtime>::get();
let outbound_channel =
outbound_channels.iter().find(|c| c.recipient == sibling_bridge_hub_id);
let is_outbound_channel_suspended =
outbound_channel.map(|c| c.is_suspended()).unwrap_or(false);
if is_outbound_channel_suspended {
return true
}
Comment thread
bkontur marked this conversation as resolved.
Outdated

// if the inbound channel with recipient is suspended, it means that we are unable to
// receive congestion reports from the bridge hub. So we assume the bridge pipeline is
// congested too
let inbound_channels = pallet::InboundXcmpStatus::<Runtime>::get();
let inbound_channel = inbound_channels.iter().find(|c| c.sender == sibling_bridge_hub_id);
let is_inbound_channel_suspended =
inbound_channel.map(|c| c.is_suspended()).unwrap_or(false);
if is_inbound_channel_suspended {
return true
}

// TODO: https://github.com/paritytech/cumulus/pull/2342 - once this PR is merged, we may
// remove the following code
Comment thread
bkontur marked this conversation as resolved.
Outdated
//
// if the outbound channel has at least `N` pages enqueued, let's assume it is congested.
// Normally, the chain with a few opened HRMP channels, will "send" pages at every block.
// Having `N` pages means that for last `N` blocks we either have not sent any messages,
// or have sent signals.
const MAX_OUTBOUND_PAGES_BEFORE_CONGESTION: u16 = 4;
let is_outbound_channel_congested = outbound_channel.map(|c| c.queued_pages()).unwrap_or(0);
Comment thread
bkontur marked this conversation as resolved.
Outdated
is_outbound_channel_congested > MAX_OUTBOUND_PAGES_BEFORE_CONGESTION
}
}

/// Adapter implementation for `bp_xcm_bridge_hub_router::XcmChannelStatusProvider` which checks
/// only `OutboundXcmpStatus` for defined `SiblingParaId` if is suspended.
pub struct OutboundXcmpChannelCongestionStatusProvider<SiblingBridgeHubParaId, Runtime>(
sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>,
);
impl<SiblingParaId: Get<ParaId>, Runtime: crate::Config>
bp_xcm_bridge_hub_router::XcmChannelStatusProvider
for OutboundXcmpChannelCongestionStatusProvider<SiblingParaId, Runtime>
{
fn is_congested() -> bool {
// let's find the channel with the sibling parachain
let sibling_para_id: cumulus_primitives_core::ParaId = SiblingParaId::get();
let outbound_channels = pallet::OutboundXcmpStatus::<Runtime>::get();
let channel_with_sibling_parachain =
outbound_channels.iter().find(|c| c.recipient == sibling_para_id);

// no channel => it is empty, so not congested
let channel_with_sibling_parachain = match channel_with_sibling_parachain {
Some(channel_with_sibling_parachain) => channel_with_sibling_parachain,
None => return false,
};

// suspended channel => it is congested
if channel_with_sibling_parachain.is_suspended() {
return true
}

// TODO: the following restriction is arguable, we may live without that, assuming that
// there can't be more than some `N` messages queued at the bridge queue (at the source BH)
// AND before accepting next (or next-after-next) delivery transaction, we'll receive the
// suspension signal from the target parachain and stop accepting delivery transactions

// it takes some time for target parachain to suspend inbound channel with the target BH and
// during that we will keep accepting new message delivery transactions. Let's also reject
// new deliveries if there are too many "pages" (concatenated XCM messages) in the target BH
// -> target parachain queue.
const MAX_QUEUED_PAGES_BEFORE_DEACTIVATION: u16 = 4;
if channel_with_sibling_parachain.queued_pages() > MAX_QUEUED_PAGES_BEFORE_DEACTIVATION {
return true
}

true
}
}

#[cfg(feature = "runtime-benchmarks")]
pub fn suspend_channel_for_benchmarks<T: crate::Config>(target: ParaId) {
pallet::Pallet::<T>::suspend_channel(target)
}
19 changes: 19 additions & 0 deletions cumulus/pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ mod tests;

#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
#[cfg(feature = "bridging")]
pub mod bridging;
pub mod weights;
pub use weights::WeightInfo;

Expand Down Expand Up @@ -400,6 +402,13 @@ pub struct InboundChannelDetails {
message_metadata: Vec<(RelayBlockNumber, XcmpMessageFormat)>,
}

impl InboundChannelDetails {
#[cfg(feature = "bridging")]
Comment thread
bkontur marked this conversation as resolved.
Outdated
pub(crate) fn is_suspended(&self) -> bool {
Comment thread
serban300 marked this conversation as resolved.
Outdated
self.state == InboundState::Suspended
}
}

/// Struct containing detailed information about the outbound channel.
#[derive(Clone, Eq, PartialEq, Encode, Decode, TypeInfo)]
pub struct OutboundChannelDetails {
Expand Down Expand Up @@ -435,6 +444,16 @@ impl OutboundChannelDetails {
self.state = OutboundState::Suspended;
self
}

#[cfg(feature = "bridging")]
pub(crate) fn is_suspended(&self) -> bool {
self.state == OutboundState::Suspended
}

#[cfg(feature = "bridging")]
pub(crate) fn queued_pages(&self) -> u16 {
self.last_index.saturating_sub(self.first_index)
}
}

#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
Expand Down
Loading