Skip to content

Commit

Permalink
Add P<>K bridge manual zombienet test for asset transfer (#198)
Browse files Browse the repository at this point in the history
<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [x] Does not require a CHANGELOG entry

This PR adds a P<>K bridge zombienet test which checks the following:
- transfering DOT from AssetHub Polkadot to AssetHub Kusama works
- transfering wDOT from AssetHub Kusama to AssetHub Polkadot works
- transfering KSM from AssetHub Kusama to AssetHub Polkadot works
- transfering wKSM from AssetHub Polkadot to AssetHub Kusama works

The test is meant to be ran manually as per the instructions in the
`README.md` and is based on the naive bridge testing "orchestrator"
defined in the `polkadot-sdk` repo:
https://github.com/paritytech/polkadot-sdk/tree/master/bridges/testing .
The "orchestrator" is downloaded using `git sparse checkout` directly
from the `polkadot-sdk` repo (I couldn't find a better way to package
the `bash` and `js` files on which the test depends).

Proposing to add the test in this repo as per the feedback from the
bridges team and since this way it would be more convenient to run it
before a release or when performing a change to the bridge hubs for
example. If there are concerns about this, the second option would be to
add it to the `parity-bridges-common` repo.

Closes: paritytech/polkadot-sdk#3400
  • Loading branch information
serban300 authored May 1, 2024
1 parent 0fd1a91 commit 6d5a7a1
Show file tree
Hide file tree
Showing 18 changed files with 790 additions and 0 deletions.
30 changes: 30 additions & 0 deletions integration-tests/bridges/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Bridges Tests for Local Polkadot <> Kusama Bridge

This folder contains zombienet based integration test for both onchain and offchain bridges code.
The tests are designed to be run manually.

To start a test, you need to:

- download latest [zombienet release](https://github.com/paritytech/zombienet/releases) to
`~/local_bridge_testing/bin/zombienet`.

- build Polkadot binary by running `cargo build -p polkadot --release` command in the
[`polkadot-sdk`](https://github.com/paritytech/polkadot-sdk) repository clone.

- build Polkadot Parachain binary by running `cargo build -p polkadot-parachain-bin --release` command in the
[`polkadot-sdk`](https://github.com/paritytech/polkadot-sdk) repository clone.

- ensure that you have [`node`](https://nodejs.org/en) installed. Additionally, we'll need globally installed
`polkadot/api-cli` package (use `yarn global add @polkadot/api-cli` to install it).

- build Substrate relay by running `cargo build -p substrate-relay --release` command in the
[`parity-bridges-common`](https://github.com/paritytech/parity-bridges-common) repository clone. Copy the binary to `~/local_bridge_testing/bin/substrate-relay`.

- add the `sudo` pallet to the Polkadot and Kusama runtimes and give sudo rights to Alice. With this change build
the chain spec generator by running `cargo build --release -p chain-spec-generator --features fast-runtime`
command. Copy the binary to `~/local_bridge_testing/bin/chain-spec-generator`.

- change the `POLKADOT_BINARY` and `POLKADOT_PARACHAIN_BINARY` paths (and ensure that the nearby variables
have correct values) in the `./run-test.sh`.

After that, you can run `./run-tests.sh <test_name>` command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[settings]
node_spawn_timeout = 240

[relaychain]
default_command = "{{POLKADOT_BINARY}}"
default_args = ["-lparachain=debug,xcm=trace"]
chain = "kusama-local"
chain_spec_command = "{{CHAIN_SPEC_GEN_BINARY}} {% raw %} {{chainName}} {% endraw %}"

[[relaychain.nodes]]
name = "alice"
validator = true
rpc_port = 9935
ws_port = 9945
balance = 2000000000000

[[relaychain.nodes]]
name = "bob"
validator = true
rpc_port = 9936
ws_port = 9946
balance = 2000000000000

[[relaychain.nodes]]
name = "charlie"
validator = true
rpc_port = 9937
ws_port = 9947
balance = 2000000000000

[[parachains]]
id = 1000
chain = "asset-hub-kusama-local"
chain_spec_command = "{{CHAIN_SPEC_GEN_BINARY}} {% raw %} {{chainName}} {% endraw %}"
cumulus_based = true

[[parachains.collators]]
name = "asset-hub-kusama-collator-1"
rpc_port = 9011
ws_port = 9010
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
]

[[parachains.collators]]
name = "asset-hub-kusama-collator-2"
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
]

[[parachains]]
id = 1002
chain = "bridge-hub-kusama-local"
chain_spec_command = "{{ENV_PATH}}/generate_bh_spec.sh Polkadot {% raw %} {{chainName}} {% endraw %}"
cumulus_based = true

# run alice as parachain collator
[[parachains.collators]]
name = "bridge-hub-kusama-collator-1"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY}}"
rpc_port = 8935
ws_port = 8945
args = [
"-lparachain=debug,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
]

# run bob as parachain collator
[[parachains.collators]]
name = "bridge-hub-kusama-collator-2"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY}}"
rpc_port = 8936
ws_port = 8946
args = [
"-lparachain=trace,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[settings]
node_spawn_timeout = 240

[relaychain]
default_command = "{{POLKADOT_BINARY}}"
default_args = ["-lparachain=debug,xcm=trace"]
chain = "polkadot-local"
chain_spec_command = "{{CHAIN_SPEC_GEN_BINARY}} {% raw %} {{chainName}} {% endraw %}"

[[relaychain.nodes]]
name = "alice"
validator = true
rpc_port = 9932
ws_port = 9942
balance = 2000000000000

[[relaychain.nodes]]
name = "bob"
validator = true
rpc_port = 9933
ws_port = 9943
balance = 2000000000000

[[relaychain.nodes]]
name = "charlie"
validator = true
rpc_port = 9934
ws_port = 9944
balance = 2000000000000

[[parachains]]
id = 1000
chain = "asset-hub-polkadot-local"
chain_spec_command = "{{CHAIN_SPEC_GEN_BINARY}} {% raw %} {{chainName}} {% endraw %}"
cumulus_based = true

[[parachains.collators]]
name = "asset-hub-polkadot-collator-1"
rpc_port = 9911
ws_port = 9910
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
]

[[parachains.collators]]
name = "asset-hub-polkadot-collator-2"
command = "{{POLKADOT_PARACHAIN_BINARY}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace"
]

[[parachains]]
id = 1002
chain = "bridge-hub-polkadot-local"
chain_spec_command = "{{ENV_PATH}}/generate_bh_spec.sh Kusama {% raw %} {{chainName}} {% endraw %}"
cumulus_based = true

[[parachains.collators]]
name = "bridge-hub-polkadot-collator-1"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY}}"
rpc_port = 8933
ws_port = 8943
args = [
"-lparachain=debug,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
]

[[parachains.collators]]
name = "bridge-hub-polkadot-collator-2"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY}}"
rpc_port = 8934
ws_port = 8944
args = [
"-lparachain=trace,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace"
]
Loading

0 comments on commit 6d5a7a1

Please sign in to comment.