-
Notifications
You must be signed in to change notification settings - Fork 1.2k
cumulus: add asset-hub-rococo runtime based on asset-hub-kusama and add asset-bridging support to it #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
acatangiu
merged 93 commits into
paritytech:master
from
acatangiu:asset-hub-rococo-runtime
Oct 18, 2023
Merged
cumulus: add asset-hub-rococo runtime based on asset-hub-kusama and add asset-bridging support to it #1215
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 ec28f46
update new `asset-hub-rococo-runtime` with rococo-specific components
acatangiu b320b1f
asset-hub-rococo-runtime: add asset transfer over bridge capabilities
acatangiu b3c1810
asset-hub-rococo-runtime: add asset transfer over bridge tests
acatangiu 3bc4634
fix toml formatting
acatangiu 4eccdf4
add more tests to Bridge Hubs
acatangiu e3d77f8
bridge-hubs: add script for testing Rococo <> Wococo bridge
acatangiu 52c7cd5
Do not consume `msg` on `NotApplicable` for remote exporters
bkontur ff2891c
Added bridging configuration + tests for AssetHubRococo vs AssetHubWo…
bkontur 4f0776d
Merge remote-tracking branch 'origin/master' into bko-asset-hub-rococ…
bkontur f18f146
".git/.scripts/commands/fmt/fmt.sh"
a717e91
Merge branch 'master' into asset-hub-rococo-runtime
bkontur 754ed42
Added `asset-hub-(r/w)ococo` to `polkadot-parachain`
bkontur ddc09d3
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 03b1bb4
Merge branch 'master' into asset-hub-rococo-runtime
bkontur 00cfa54
Finished local run asset transfer for AssetHubRococo/AssetHubWococo
bkontur 116010f
Zombienet tweaks
bkontur ab648a5
Just paid `ExportMessage` on BridgeHubRococo/BridgeHubWococo
bkontur b78343b
Added congestion to BridgeHubs + nits
bkontur 3f3081b
fix typos
acatangiu 5d318c5
Typo
bkontur 85b7f84
Fixed benchmarks for asset-hub-rococo
bkontur 642e29e
Tweaks to BridgeHubRococo
bkontur 09e8c15
From PR review
bkontur bc44872
xcm-emulator nits
bkontur 8df113a
Merge branch 'master' into asset-hub-rococo-runtime
bkontur d64d1fc
Fix features
bkontur b20c353
Fixed
bkontur d04bf3a
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 9f0d255
Fix for benchmarks
bkontur 1faec85
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
76e513d
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 99e001c
Added xcm-emulator integration test for AssetHubRococo (as copy of As…
bkontur 3a0b3c1
Addressing pr comments for xcmp-queue
bkontur 791b88a
Added test for `AllowUnpaidTransactsFrom`
bkontur a4f3f4e
Nit
bkontur a4ef4f5
Simplify Location and AssetFilter
bkontur 713d7ad
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 33b672c
fmt
bkontur 474b8a4
ensure_configuration -> prepare_configuration
bkontur b500fbc
Constants nit
bkontur d4dc7c8
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 559b954
Add claiming relayer rewards to Ro/Wo demo
bkontur 89fc271
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 6e7e53d
Deduplicate with `build_congestion_message`
bkontur 7cbfbb2
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 42d6fe4
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 132c5a0
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 94619d7
Compile
bkontur 5f785b6
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 58c4089
Fix to compile
bkontur 14c2855
Merge remote-tracking branch 'origin/master' into asset-hub-rococo-ru…
bkontur 653b9fb
Add filtering capabilities for remote location to `NetworkExportTable`
bkontur 62bbee0
Expose `BridgeMessage` field as `pub` because it cannot be access out…
bkontur 19381bd
Move `StartsWith` and `Equals` to `xcm-builder`
bkontur 255595e
Refactored and simplified xcm stuff
bkontur ecf0688
Merge branch 'bko-xcm-builder-enhancements' into asset-hub-rococo-run…
bkontur 1269bd7
Fix import
bkontur 8dcca0f
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur c7b1625
Added generic `EqualsTo` implementation for `frame_support::traits::C…
bkontur 296dc1c
Merge remote-tracking branch 'origin/master' into bko-xcm-builder-enh…
bkontur 889e9e2
Removed import
bkontur e95ec38
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur 04cabcd
More fixes
bkontur 5fdd787
PR comments + added `LocationWithAssetFilters` useful for `XcmTelepor…
bkontur ea0997b
PR comments
bkontur 668756d
Merge branch 'bko-xcm-builder-enhancements' into asset-hub-rococo-run…
bkontur fa87f2a
Removed unnecessary import
bkontur 65761b5
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur 6c087c2
Update cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
bkontur 4d07d71
Removed unnecessary import
bkontur 39a227f
Fmt
bkontur 0cfd718
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur 34a438d
Update cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
bkontur 2555615
PR comments - removed `FellowsBodyId`
bkontur 3ade1cf
Doc
bkontur 3089154
Serban's nit + test
bkontur 2c04796
Merge branch 'bko-xcm-builder-enhancements' into asset-hub-rococo-run…
bkontur 79f6794
Removed comment
bkontur 98efacd
Changed `RuntimeVersion` to be compatible with live Rococo' AssetHub …
bkontur c26fde1
Typo
bkontur be2210a
PR comments - Added `UnpaidExecution` + refactor of `AllowTransactsFrom`
bkontur 49d45ba
Removed unnecessary barrier `AllowTransactsFrom`
bkontur 2c32b43
Update polkadot/xcm/xcm-builder/src/universal_exports.rs
bkontur ee1d681
PR comment - case with payment to the test
bkontur cfa2616
Merge remote-tracking branch 'origin/master' into bko-xcm-builder-enh…
bkontur 4941b44
Merge remote-tracking branch 'origin/bko-xcm-builder-enhancements' in…
bkontur e82b712
Update cumulus/parachains/runtimes/assets/test-utils/src/test_cases_o…
bkontur 0887912
Update cumulus/parachains/runtimes/assets/test-utils/src/test_cases_o…
bkontur 2ddf42e
Update cumulus/parachains/runtimes/assets/test-utils/src/test_cases_o…
bkontur f98ee90
Merge branch 'master' of github.com:paritytech/polkadot-sdk into asse…
acatangiu 1fb29e8
AssetHub Rococo: make all SPs trusted teleporters
acatangiu 5392057
Merge branch 'master' into asset-hub-rococo-runtime
acatangiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
cumulus/bridges/primitives/chain-asset-hub-rococo/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
49
cumulus/bridges/primitives/chain-asset-hub-rococo/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>( | ||
| 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 | ||
| } | ||
|
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 | ||
|
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); | ||
|
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) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.