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

## Summary

Asset bridging support for AssetHub**Rococo** <-> AssetHub**Wococo** was
added [here](https://github.com/paritytech/polkadot-sdk/pull/1215), so
now we aim to bridge AssetHub**Rococo** and AssetHub**Westend**. (And
perhaps retire AssetHubWococo and the Wococo chains).

## Solution

**bridge-hub-westend-runtime**
- added new runtime as a copy of `bridge-hub-rococo-runtime`
- added support for bridging to `BridgeHubRococo`
- added tests and benchmarks

**bridge-hub-rococo-runtime**
- added support for bridging to `BridgeHubWestend`
- added tests and benchmarks
- internal refactoring by splitting bridge configuration per network,
e.g., `bridge_to_whatevernetwork_config.rs`.

**asset-hub-rococo-runtime**
- added support for asset bridging to `AssetHubWestend` (allows to
receive only WNDs)
- added new xcm router for `Westend`
- added tests and benchmarks

**asset-hub-westend-runtime**
- added support for asset bridging to `AssetHubRococo` (allows to
receive only ROCs)
- added new xcm router for `Rococo`
- added tests and benchmarks

## Deployment

All changes will be deployed as a part of
https://github.com/paritytech/polkadot-sdk/issues/1988.

## TODO

- [x] benchmarks for all pallet instances
- [x] integration tests
- [x] local run scripts


Relates to:
https://github.com/paritytech/parity-bridges-common/issues/2602
Relates to: https://github.com/paritytech/polkadot-sdk/issues/1988

---------

Co-authored-by: command-bot <>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
Branislav Kontur
2023-11-02 00:39:49 +01:00
committed by GitHub
parent c66ae375e6
commit 1b1fab0da3
112 changed files with 10028 additions and 1638 deletions
@@ -249,15 +249,15 @@ fn reserve_transfer_native_asset_from_relay_to_system_para_fails() {
test.set_dispatchable::<Rococo>(relay_reserve_transfer_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
let delivery_fees = Rococo::execute_with(|| {
xcm_helpers::transfer_assets_delivery_fees::<
<RococoXcmConfig as xcm_executor::Config>::XcmSender,
>(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
});
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after);
assert_eq!(receiver_balance_before, receiver_balance_after);
}
@@ -38,7 +38,10 @@ fn relay_origin_assertions(t: RelayToSystemParaTest) {
}
fn system_para_dest_assertions(_t: RelayToSystemParaTest) {
AssetHubWestend::assert_dmp_queue_error(Error::WeightNotComputable);
AssetHubWestend::assert_dmp_queue_incomplete(
Some(Weight::from_parts(31_352_000, 1489)),
Some(Error::UntrustedReserveLocation),
);
}
fn system_para_to_relay_assertions(_t: SystemParaToRelayTest) {
@@ -64,7 +64,7 @@ fn example() {
outcome: Outcome::Complete(_),
..
}) => {},
RuntimeEvent::BridgeRococoToWococoMessages(pallet_bridge_messages::Event::MessageAccepted {
RuntimeEvent::BridgeWococoMessages(pallet_bridge_messages::Event::MessageAccepted {
lane_id: LaneId([0, 0, 0, 1]),
nonce: 1,
}) => {},
@@ -669,16 +669,14 @@ pub mod bridge_hub_rococo {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
bridge_wococo_to_rococo_messages:
bridge_hub_rococo_runtime::BridgeWococoToRococoMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
bridge_rococo_to_wococo_messages:
bridge_hub_rococo_runtime::BridgeRococoToWococoMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
bridge_rococo_messages: bridge_hub_rococo_runtime::BridgeRococoMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
bridge_wococo_messages: bridge_hub_rococo_runtime::BridgeWococoMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
..Default::default()
};