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 all 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
44 changes: 43 additions & 1 deletion bridges/modules/relayers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ pub mod pallet {
rewards_account_params,
new_reward,
);

Self::deposit_event(Event::<T>::RewardRegistered {
relayer: relayer.clone(),
rewards_account_params,
reward,
});
},
);
}
Expand Down Expand Up @@ -369,6 +375,15 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// Relayer reward has been registered and may be claimed later.
RewardRegistered {
/// Relayer account that can claim reward.
relayer: T::AccountId,
/// Relayer can claim reward from this account.
rewards_account_params: RewardsAccountParams,
/// Reward amount.
reward: T::Reward,
},
/// Reward has been paid to the relayer.
RewardPaid {
/// Relayer account that has been rewarded.
Expand Down Expand Up @@ -455,7 +470,7 @@ mod tests {
use super::*;
use mock::{RuntimeEvent as TestEvent, *};

use crate::Event::RewardPaid;
use crate::Event::{RewardPaid, RewardRegistered};
use bp_messages::LaneId;
use bp_relayers::RewardsAccountOwner;
use frame_support::{
Expand All @@ -470,6 +485,33 @@ mod tests {
System::<TestRuntime>::reset_events();
}

#[test]
fn register_relayer_reward_emit_event() {
run_test(|| {
get_ready_for_events();

Pallet::<TestRuntime>::register_relayer_reward(
TEST_REWARDS_ACCOUNT_PARAMS,
&REGULAR_RELAYER,
100,
);

// Check if the `RewardRegistered` event was emitted.
assert_eq!(
System::<TestRuntime>::events().last(),
Some(&EventRecord {
phase: Phase::Initialization,
event: TestEvent::Relayers(RewardRegistered {
relayer: REGULAR_RELAYER,
rewards_account_params: TEST_REWARDS_ACCOUNT_PARAMS,
reward: 100
}),
topics: vec![],
}),
);
});
}

#[test]
fn root_cant_claim_anything() {
run_test(|| {
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",
]
Loading
Loading