Skip to content

Commit

Permalink
Add P<>K bridge asset transfer test
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Feb 23, 2024
1 parent 6930a5b commit 8144578
Show file tree
Hide file tree
Showing 18 changed files with 808 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 8144578

Please sign in to comment.