mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
8428f678fe
# Note for reviewer
Most changes are just syntax changes necessary for the new version.
Most important files should be the ones under the `xcm` folder.
# Description
Added XCMv4.
## Removed `Multi` prefix
The following types have been renamed:
- MultiLocation -> Location
- MultiAsset -> Asset
- MultiAssets -> Assets
- InteriorMultiLocation -> InteriorLocation
- MultiAssetFilter -> AssetFilter
- VersionedMultiAsset -> VersionedAsset
- WildMultiAsset -> WildAsset
- VersionedMultiLocation -> VersionedLocation
In order to fix a name conflict, the `Assets` in `xcm-executor` were
renamed to `HoldingAssets`, as they represent assets in holding.
## Removed `Abstract` asset id
It was not being used anywhere and this simplifies the code.
Now assets are just constructed as follows:
```rust
let asset: Asset = (AssetId(Location::new(1, Here)), 100u128).into();
```
No need for specifying `Concrete` anymore.
## Outcome is now a named fields struct
Instead of
```rust
pub enum Outcome {
Complete(Weight),
Incomplete(Weight, Error),
Error(Error),
}
```
we now have
```rust
pub enum Outcome {
Complete { used: Weight },
Incomplete { used: Weight, error: Error },
Error { error: Error },
}
```
## Added Reanchorable trait
Now both locations and assets implement this trait, making it easier to
reanchor both.
## New syntax for building locations and junctions
Now junctions are built using the following methods:
```rust
let location = Location {
parents: 1,
interior: [Parachain(1000), PalletInstance(50), GeneralIndex(1984)].into()
};
```
or
```rust
let location = Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]);
```
And they are matched like so:
```rust
match location.unpack() {
(1, [Parachain(id)]) => ...
(0, Here) => ...,
(1, [_]) => ...,
}
```
This syntax is mandatory in v4, and has been also implemented for v2 and
v3 for easier migration.
This was needed to make all sizes smaller.
# TODO
- [x] Scaffold v4
- [x] Port github.com/paritytech/polkadot/pull/7236
- [x] Remove `Multi` prefix
- [x] Remove `Abstract` asset id
---------
Co-authored-by: command-bot <>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
- Bridge-hub Parachains
- Requirements for local run/testing
- How to test local Rococo <-> Westend bridge
- Run Rococo/Westend chains with zombienet
- Init bridge and run relayer between BridgeHubRococo and BridgeHubWestend
- Initialize configuration for transfer asset over bridge (ROCs/WNDs)
- Send messages - transfer asset over bridge (ROCs/WNDs)
- Claim relayer's rewards on BridgeHubRococo and BridgeHubWestend
- How to test local BridgeHubKusama/BridgeHubPolkadot
Bridge-hub Parachains
BridgeHub(s) are system parachains that will house trustless bridges from the local ecosystem to others. The current trustless bridges planned for the BridgeHub(s) are:
BridgeHubPolkadotsystem parachain:- Polkadot <-> Kusama bridge
- Polkadot <-> Ethereum bridge (Snowbridge)
BridgeHubKusamasystem parachain:- Kusama <-> Polkadot bridge
- Kusama <-> Ethereum bridge The high-level responsibilities of each bridge living on BridgeHub:
- sync finality proofs between relay chains (or equivalent)
- sync finality proofs between BridgeHub parachains
- pass (XCM) messages between different BridgeHub parachains
Requirements for local run/testing
# Prepare empty directory for testing
mkdir -p ~/local_bridge_testing/bin
mkdir -p ~/local_bridge_testing/logs
---
# 1. Install zombienet
Go to: https://github.com/paritytech/zombienet/releases
Copy the apropriate binary (zombienet-linux) from the latest release to ~/local_bridge_testing/bin
---
# 2. Build polkadot binary
We need polkadot binary with "fast-runtime" feature:
cd <polkadot-sdk-git-repo-dir>
cargo build --release --features fast-runtime --bin polkadot
cp target/release/polkadot ~/local_bridge_testing/bin/polkadot
cargo build --release --features fast-runtime --bin polkadot-prepare-worker
cp target/release/polkadot-prepare-worker ~/local_bridge_testing/bin/polkadot-prepare-worker
cargo build --release --features fast-runtime --bin polkadot-execute-worker
cp target/release/polkadot-execute-worker ~/local_bridge_testing/bin/polkadot-execute-worker
---
# 3. Build substrate-relay binary
git clone https://github.com/paritytech/parity-bridges-common.git
cd parity-bridges-common
# checkout desired branch or use master:
# git checkout -b master --track origin/master
# `polkadot-staging` (recommended) is stabilized and compatible for Cumulus releases
# `master` is latest development
git checkout -b polkadot-staging --track origin/polkadot-staging
cargo build --release -p substrate-relay
cp target/release/substrate-relay ~/local_bridge_testing/bin/substrate-relay
---
# 4. Build cumulus polkadot-parachain binary
cd <polkadot-sdk-git-repo-dir>
cargo build --release -p polkadot-parachain-bin
cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain
cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-asset-hub
How to test local Rococo <-> Westend bridge
Run Rococo/Westend chains with zombienet
cd <polkadot-sdk-git-repo-dir>
# Rococo + BridgeHubRococo + AssetHub for Rococo (mirroring Kusama)
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_ROCOCO=~/local_bridge_testing/bin/polkadot-parachain-asset-hub \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml
cd <polkadot-sdk-git-repo-dir>
# Westend + BridgeHubWestend + AssetHub for Westend (mirroring Polkadot)
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_WESTEND=~/local_bridge_testing/bin/polkadot-parachain-asset-hub \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml
Init bridge and run relayer between BridgeHubRococo and BridgeHubWestend
Accounts of BridgeHub parachains:
Bobis pallet owner of all bridge pallets
Run with script
cd <polkadot-sdk-git-repo-dir>
./cumulus/scripts/bridges_rococo_westend.sh run-relay
Check relay-chain headers relaying:
- Rococo parachain: - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8943#/chainstate - Pallet: bridgeWestendGrandpa - Keys: bestFinalized()
- Westend parachain: - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8945#/chainstate - Pallet: bridgeRococoGrandpa - Keys: bestFinalized()
Check parachain headers relaying:
- Rococo parachain: - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8943#/chainstate - Pallet: bridgeWestendParachains - Keys: parasInfo(None)
- Westend parachain: - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8945#/chainstate - Pallet: bridgeRococoParachains - Keys: parasInfo(None)
Initialize configuration for transfer asset over bridge (ROCs/WNDs)
This initialization does several things:
- creates
ForeignAssetsfor wrappedROCs/wrappedWNDs - drips SA for AssetHubRococo on AssetHubWestend (and vice versa) which holds reserved assets on source chains
cd <polkadot-sdk-git-repo-dir>
./cumulus/scripts/bridges_rococo_westend.sh init-asset-hub-rococo-local
./cumulus/scripts/bridges_rococo_westend.sh init-bridge-hub-rococo-local
./cumulus/scripts/bridges_rococo_westend.sh init-asset-hub-westend-local
./cumulus/scripts/bridges_rococo_westend.sh init-bridge-hub-westend-local
Send messages - transfer asset over bridge (ROCs/WNDs)
Do reserve-backed transfers:
cd <polkadot-sdk-git-repo-dir>
# ROCs from Rococo's Asset Hub to Westend's.
./cumulus/scripts/bridges_rococo_westend.sh reserve-transfer-assets-from-asset-hub-rococo-local
cd <polkadot-sdk-git-repo-dir>
# WNDs from Westend's Asset Hub to Rococo's.
./cumulus/scripts/bridges_rococo_westend.sh reserve-transfer-assets-from-asset-hub-westend-local
- open explorers: (see zombienets)
- AssetHubRococo (see events
xcmpQueue.XcmpMessageSent,polkadotXcm.Attempted) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9910#/explorer - BridgeHubRococo (see
bridgeWestendMessages.MessageAccepted) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer - BridgeHubWestend (see
bridgeRococoMessages.MessagesReceived,xcmpQueue.XcmpMessageSent) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8945#/explorer - AssetHubWestend (see
foreignAssets.Issued,xcmpQueue.Success) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9010#/explorer - BridgeHubRocococ (see
bridgeWestendMessages.MessagesDelivered) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer
- AssetHubRococo (see events
Do reserve withdraw transfers: (when previous is finished)
cd <polkadot-sdk-git-repo-dir>
# wrappedWNDs from Rococo's Asset Hub to Westend's.
./cumulus/scripts/bridges_rococo_westend.sh withdraw-reserve-assets-from-asset-hub-rococo-local
cd <polkadot-sdk-git-repo-dir>
# wrappedROCs from Westend's Asset Hub to Rococo's.
./cumulus/scripts/bridges_rococo_westend.sh withdraw-reserve-assets-from-asset-hub-westend-local
Claim relayer's rewards on BridgeHubRococo and BridgeHubWestend
Accounts of BridgeHub parachains:
//Charlieis relayer account on BridgeHubRococo//Charlieis relayer account on BridgeHubWestend
cd <polkadot-sdk-git-repo-dir>
# Claim rewards on BridgeHubWestend:
./cumulus/scripts/bridges_rococo_westend.sh claim-rewards-bridge-hub-rococo-local
# Claim rewards on BridgeHubWestend:
./cumulus/scripts/bridges_rococo_westend.sh claim-rewards-bridge-hub-westend-local
- open explorers: (see zombienets)
- BridgeHubRococo (see 2x
bridgeRelayers.RewardPaid) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer - BridgeHubWestend (see 2x
bridgeRelayers.RewardPaid) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8945#/explorer
- BridgeHubRococo (see 2x
How to test local BridgeHubKusama/BridgeHubPolkadot
TODO: see # !!! READ HERE above
