Skip to content
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

[testnet] Add AssetHubRococo <-> AssetHubWestend asset bridging support #1967

Merged
merged 60 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f941f65
Inject bridging pallets and cfg for `BridgeHubWestend`
bkontur Oct 24, 2023
5516787
Add `ToWestendXcmRouter` to the `AssetHubRococo` + allow asset bridging
bkontur Oct 24, 2023
0a969c8
Align testnet system parachain runtimes using `RelayTreasuryLocation`…
bkontur Oct 25, 2023
2d88d83
Align testnet system parachain runtimes using `RelayTreasuryLocation`…
bkontur Oct 25, 2023
515e02b
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Oct 25, 2023
b4b5361
Setup `TrustedReserve` on `asset-hub-rococo`
bkontur Oct 25, 2023
fca14bb
Merge branch 'master' of https://github.com/paritytech/polkadot-sdk i…
Oct 25, 2023
8a8d218
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Oct 25, 2023
c7d9949
Adjusted test weights
bkontur Oct 25, 2023
9f46e8b
Merge remote-tracking branch 'origin/bko-testnet-nits' into bko-bridg…
bkontur Oct 25, 2023
1920fa3
".git/.scripts/commands/fmt/fmt.sh"
Oct 25, 2023
1297cfd
Adjusted test weights + moved assert before checking balances
bkontur Oct 25, 2023
7c6c1e5
Merge remote-tracking branch 'origin/master' into bko-testnet-nits
bkontur Oct 25, 2023
ad0eecc
Merge remote-tracking branch 'origin/bko-testnet-nits' into bko-bridg…
bkontur Oct 25, 2023
aacec45
Add `ToRococoXcmRouter` to the `AssetHubWestend` + allow asset bridging
bkontur Oct 25, 2023
49ac6a8
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Oct 26, 2023
1c19674
AssetHubRococo - `XcmReserveTransferFilter` back to `Everything` (all…
bkontur Oct 26, 2023
c54fd9e
Removed TODO for correct delivery fee estimation
bkontur Oct 26, 2023
7ea5055
Removed TODO from test-case for hard-coded delivery fee estimation
bkontur Oct 26, 2023
0bea911
clippy
bkontur Oct 26, 2023
b0dd90d
clippy
bkontur Oct 26, 2023
65ed92f
Refactored `assert_matches_reserve_asset_deposited_instructions`
bkontur Oct 26, 2023
125a72a
Merge remote-tracking branch 'origin/bko-removed-todo-for-delivery-fe…
bkontur Oct 26, 2023
0554baa
Fixed tests
bkontur Oct 26, 2023
df688dd
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Oct 26, 2023
adc3c44
Weights and benchmarks
bkontur Oct 26, 2023
87e83ea
Bridges primitives update
bkontur Oct 26, 2023
13cae39
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Oct 26, 2023
2b45e93
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Oct 26, 2023
2b1dc96
".git/.scripts/commands/bench/bench.sh" --subcommand=xcm --runtime=as…
Oct 26, 2023
1632b2f
Git apply patches from:
bkontur Oct 27, 2023
2d1e785
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Oct 27, 2023
38bd9f9
Added separated bridge-hub-westend-runtime
bkontur Oct 27, 2023
cdee670
Removed westend flavor from BHR
bkontur Oct 27, 2023
d503966
Benchmarks for BHR
bkontur Oct 27, 2023
5737dc7
Benchmarks for BridgeHubWestend
bkontur Oct 27, 2023
f0405f8
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Oct 27, 2023
95f0d0b
Local run for Rococo<>Westend
bkontur Oct 30, 2023
80fbcbf
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Oct 30, 2023
b8c70f8
Removed TODO
bkontur Oct 30, 2023
93be52a
Old comment
bkontur Oct 30, 2023
4ccfd7f
Fix Instances
bkontur Oct 30, 2023
089159c
Unify `Parachain` vs `Parachains`
bkontur Oct 30, 2023
0c75f31
Simplify `MessageExporter` for BHR
bkontur Oct 31, 2023
5c8eba1
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Oct 31, 2023
c5db0ad
Add licence attr in Cargo.toml
bkontur Oct 31, 2023
dfdfcb4
Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Car…
bkontur Nov 1, 2023
818bb3e
Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src…
bkontur Nov 1, 2023
19f1c2f
Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src…
bkontur Nov 1, 2023
f8d620c
Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src…
bkontur Nov 1, 2023
51dac4e
Docs
bkontur Nov 1, 2023
a83bdbb
Use westend constants for test
bkontur Nov 1, 2023
7efa43a
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Nov 1, 2023
03e95b3
Fix FeeManager after rebase
bkontur Nov 1, 2023
960b644
More fixes after rebase to master
bkontur Nov 1, 2023
5f5d991
Merge remote-tracking branch 'origin/master' into bko-bridge-rococo-w…
bkontur Nov 1, 2023
773fee8
Change spec_version to `1_003_000`
bkontur Nov 1, 2023
09540ec
Squashed 'bridges/' changes from 277f0d5496..b5c43bbf37
bkontur Nov 1, 2023
e92faeb
Merge commit '09540ece72090196aed24ecd6551665d049a35c2' into bko-brid…
bkontur Nov 1, 2023
4af2f09
Fix README
bkontur Nov 1, 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
127 changes: 126 additions & 1 deletion Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ members = [
"bridges/primitives/chain-asset-hub-kusama",
"bridges/primitives/chain-asset-hub-polkadot",
"bridges/primitives/chain-asset-hub-rococo",
"bridges/primitives/chain-asset-hub-westend",
"bridges/primitives/chain-asset-hub-wococo",
"bridges/primitives/chain-bridge-hub-cumulus",
"bridges/primitives/chain-bridge-hub-kusama",
"bridges/primitives/chain-bridge-hub-polkadot",
"bridges/primitives/chain-bridge-hub-rococo",
"bridges/primitives/chain-bridge-hub-westend",
"bridges/primitives/chain-bridge-hub-wococo",
"bridges/primitives/chain-kusama",
"bridges/primitives/chain-polkadot",
"bridges/primitives/chain-polkadot-bulletin",
"bridges/primitives/chain-rococo",
"bridges/primitives/chain-westend",
"bridges/primitives/chain-wococo",
"bridges/primitives/header-chain",
"bridges/primitives/messages",
Expand Down Expand Up @@ -78,6 +81,7 @@ members = [
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama",
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-polkadot",
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo",
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend",
"cumulus/parachains/runtimes/bridge-hubs/test-utils",
"cumulus/parachains/runtimes/collectives/collectives-polkadot",
"cumulus/parachains/runtimes/contracts/contracts-rococo",
Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/xcm-bridge-hub-router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ impl<T: Config<I>, I: 'static> SendXcm for Pallet<T, I> {
// just use exporter to validate destination and insert instructions to pay message fee
// at the sibling/child bridge hub
//
// the cost will include both cost of: (1) to-sibling bridg hub delivery (returned by
// the cost will include both cost of: (1) to-sibling bridge hub delivery (returned by
// the `Config::ToBridgeHubSender`) and (2) to-bridged bridge hub delivery (returned by
// `Self::exporter_for`)
ViaBridgeHubExporter::<T, I>::validate(dest, xcm)
Expand Down
7 changes: 5 additions & 2 deletions bridges/primitives/chain-asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ pub enum Call {
/// `ToWococoXcmRouter` bridge pallet.
#[codec(index = 43)]
ToWococoXcmRouter(XcmBridgeHubRouterCall),
/// `ToWestendXcmRouter` bridge pallet.
#[codec(index = 45)]
ToWestendXcmRouter(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 by test `BridgeHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer`)
pub const BridgeHubRococoBaseFeeInRocs: u128 = 1214739988;
/// (initially was calculated by test `BridgeHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + 33%)
pub const BridgeHubRococoBaseFeeInRocs: u128 = 1624803349;
}

/// Identifier of AssetHubRococo in the Rococo relay chain.
Expand Down
26 changes: 26 additions & 0 deletions bridges/primitives/chain-asset-hub-westend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "bp-asset-hub-westend"
description = "Primitives of AssetHubWestend 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.10.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",
]
52 changes: 52 additions & 0 deletions bridges/primitives/chain-asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// 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 AssetHubWestend 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;

/// `AssetHubWestend` Runtime `Call` enum.
///
/// The enum represents a subset of possible `Call`s we can send to `AssetHubWestend` 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
/// `AssetHubWestend` `construct_runtime`, so that we maintain SCALE-compatibility.
#[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call {
/// `ToRococoXcmRouter` bridge pallet.
#[codec(index = 34)]
ToRococoXcmRouter(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 `BridgeHubWestend`.
/// (initially was calculated by test `BridgeHubWestend::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + 33%)
pub const BridgeHubWestendBaseFeeInWocs: u128 = 1624803349;
}

/// Identifier of AssetHubWestend in the Westend relay chain.
pub const ASSET_HUB_WESTEND_PARACHAIN_ID: u32 = 1000;
4 changes: 2 additions & 2 deletions bridges/primitives/chain-asset-hub-wococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ frame_support::parameter_types! {
pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144);

/// Base delivery fee to `BridgeHubWococo`.
/// (initially was calculated by test `BridgeHubWococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer`)
pub const BridgeHubWococoBaseFeeInWocs: u128 = 1214739988;
/// (initially was calculated by test `BridgeHubWococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + 33%)
pub const BridgeHubWococoBaseFeeInWocs: u128 = 1624803349;
}

/// Identifier of AssetHubWococo in the Wococo relay chain.
Expand Down
8 changes: 5 additions & 3 deletions bridges/primitives/chain-bridge-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ pub type Address = MultiAddress<AccountId, ()>;
pub const BRIDGE_HUB_ROCOCO_PARACHAIN_ID: u32 = 1013;

/// Name of the With-BridgeHubRococo messages pallet instance that is deployed at bridged chains.
pub const WITH_BRIDGE_HUB_WOCOCO_TO_ROCOCO_MESSAGES_PALLET_NAME: &str =
"BridgeWococoToRococoMessages";
pub const WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessages";

/// Name of the With-BridgeHubRococo bridge-relayers pallet instance that is deployed at bridged
/// chains.
pub const WITH_BRIDGE_HUB_ROCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers";

/// Pallet index of `BridgeRococoToWococoMessages: pallet_bridge_messages::<Instance1>`.
/// Pallet index of `BridgeWococoMessages: pallet_bridge_messages::<Instance1>`.
pub const WITH_BRIDGE_ROCOCO_TO_WOCOCO_MESSAGES_PALLET_INDEX: u8 = 46;

/// Pallet index of `BridgeWestendMessages: pallet_bridge_messages::<Instance3>`.
pub const WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX: u8 = 51;

decl_bridge_finality_runtime_apis!(bridge_hub_rococo);
decl_bridge_messages_runtime_apis!(bridge_hub_rococo);
Loading
Loading