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

Bridge testing: Add manual test for P<>K asset transfer #3429

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
10 changes: 5 additions & 5 deletions .gitlab/pipeline/zombienet/bridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/
variables:
DOCKER_IMAGES_VERSION: ${CI_COMMIT_SHORT_SHA}
- !reference [.build-refs, rules]
- !reference [ .build-refs, rules ]
before_script:
- echo "Zombienet Tests Config"
- echo "${ZOMBIENET_IMAGE}"
Expand Down Expand Up @@ -48,16 +48,16 @@
# copy logs of westend nodes
- cp -r /tmp/bridges-tests-run-*/bridge_hub_westend_local_network/*.log ./zombienet-logs/

zombienet-bridges-0001-asset-transfer-works:
zombienet-bridges-0001-rococo-westend-asset-transfer:
extends:
- .zombienet-bridges-common
script:
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0001-asset-transfer --docker
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0001-rococo-westend-asset-transfer --docker
- echo "Done"

zombienet-bridges-0002-mandatory-headers-synced-while-idle:
zombienet-bridges-0002-rococo-westend-mandatory-headers-synced-while-idle:
extends:
- .zombienet-bridges-common
script:
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0002-mandatory-headers-synced-while-idle --docker
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0002-rococo-westend-mandatory-headers-synced-while-idle --docker
- echo "Done"
34 changes: 24 additions & 10 deletions bridges/testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,37 @@ To start those tests, you need to:

- download latest [zombienet release](https://github.com/paritytech/zombienet/releases);

- build Polkadot binary by running `cargo build -p polkadot --release --features fast-runtime` command in the
[`polkadot-sdk`](https://github.com/paritytech/polkadot-sdk) repository clone;
- build Polkadot binary by running `cargo build -p polkadot --release --features fast-runtime` 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;
[`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 `npm install -g @polkadot/api-cli@beta` to install it);
`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.
[`parity-bridges-common`](https://github.com/paritytech/parity-bridges-common) repository clone.

- copy fresh `substrate-relay` binary, built in previous point, to the `~/local_bridge_testing/bin/substrate-relay`;

- change the `POLKADOT_SDK_PATH` and `ZOMBIENET_BINARY_PATH` (and ensure that the nearby variables
have correct values) in the `./run-tests.sh`.
- change the `ZOMBIENET_BINARY_PATH` (and ensure that the nearby variables have correct values) in
the `./run-new-test.sh`.

After that, you could run tests with the `./run-tests.sh` command. Hopefully, it'll show the
"All tests have completed successfully" message in the end. Otherwise, it'll print paths to zombienet
process logs, which, in turn, may be used to track locations of all spinned relay and parachain nodes.
Extra steps for the Polkadot<>Kusama test:

- clone the [`polkadot-fellows/runtimes`](https://github.com/polkadot-fellows/runtimes) locally and do the following
adaptations (as an example see:
https://github.com/serban300/runtimes/commit/4e5da529e8b3543e0400a6e524d5e883db1610ed):
- Add the `sudo` pallet to the Polkadot and Kusama runtimes and give sudo rights to Alice.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use a sudofi to add pallet to runtimes. For chain specs, maybe: maybe we could patch chain-spec-generator for that? I.e. add sudo feature? Alternatively, we could prepare a chain spec patch and a jq call to patch chain spec, generated by chain-spec-generator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also: please do not consider this as a requirement - the current version looks good as is, but we may improve it in the future)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I didn't know about sudofi. Will try.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudofi doesn't seem to work correctly on the runtimes repo, and I'm not sure if we could patch the chain spec. For example I don't know if we could open the HRMP channels by patching the chain spec. I would keep this step manual for the moment and maybe improve it in the future.

- Modify the Polkadot and Kusama runtimes such that the epoch time = 1 minute. The `chain-spec-generator` can't be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also suggest to automate this step by etiher fixing the chain-spec-generator tool, or by preparing a json patch + calling jq

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Opened a PR in the runtimes repo: polkadot-fellows/runtimes#196

compiled with the `fast-runtime` feature.
- Modify the Polkadot BridgeHub and the Kusama BridgeHub genesis config in order to make Alice bridge owner.
serban300 marked this conversation as resolved.
Show resolved Hide resolved

- build the chain spec generator by running `cargo build --release -p chain-spec-generator` command in the
[`polkadot-fellows/runtimes`](https://github.com/polkadot-fellows/runtimes) repository clone.

- copy fresh `chain-spec-generator` binary, built in previous point to `~/local_bridge_testing/bin/chain-spec-generator`

After that, you could run tests with the `./run-new-test.sh <test>` command. Hopefully, it'll complete successfully.
Otherwise, it'll print paths to zombienet logs and command logs, which can be used for debugging failures.
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 = "{{CHAIN_SPEC_GEN_BINARY}} {% 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 = "{{CHAIN_SPEC_GEN_BINARY}} {% 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
Loading