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 zombienet tests: remove old command #5434

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .gitlab/pipeline/zombienet/bridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ zombienet-bridges-0001-asset-transfer-works:
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-test.sh 0001-asset-transfer --docker
- echo "Done"

zombienet-bridges-0002-free-headers-synced-while-idle:
extends:
- .zombienet-bridges-common
script:
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0002-free-headers-synced-while-idle --docker
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-test.sh 0002-free-headers-synced-while-idle --docker
- echo "Done"
22 changes: 10 additions & 12 deletions bridges/testing/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
# Bridges Tests for Local Rococo <> Westend Bridge

This folder contains [zombienet](https://github.com/paritytech/zombienet/) based integration tests for both
onchain and offchain bridges code. Due to some
[technical difficulties](https://github.com/paritytech/parity-bridges-common/pull/2649#issue-1965339051), we
are using native zombienet provider, which means that you need to build some binaries locally.
onchain and offchain bridges code.

To start those tests, you need to:
Prerequisites for running the tests locally:

- 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;
[`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 `npm install -g @polkadot/api-cli@beta` 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`;
- copy the `substrate-relay` binary, built in the previous step, to `~/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`.
After that, any test can be run using the `run-test.sh` command.
Example: `./run-new-test.sh 0001-asset-transfer`

After that, you could run tests with the `./run-tests.sh` command. Hopefully, it'll show the
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.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ async function run(nodeName, networkInfo, args) {
// wait until we have received + delivered messages OR until timeout
await utils.pollUntil(
exitAfterSeconds,
() => { return atLeastOneMessageReceived && atLeastOneMessageDelivered; },
() => { unsubscribe(); },
() => {
return atLeastOneMessageReceived && atLeastOneMessageDelivered;
},
() => {
unsubscribe();
},
() => {
if (!atLeastOneMessageReceived) {
throw new Error("No messages received from bridged chain");
Expand All @@ -78,4 +82,4 @@ async function run(nodeName, networkInfo, args) {
);
}

module.exports = { run }
module.exports = {run}
File renamed without changes.
138 changes: 0 additions & 138 deletions bridges/testing/run-tests.sh

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Description: While relayer is active, we only sync mandatory and required Rococo (and Rococo BH) headers to Westend BH.
Network: {{ENV_PATH}}/bridge_hub_westend_local_network.toml
Creds: config

# ensure that relayer won't sync any extra headers while delivering messages and confirmations
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/only-required-headers-synced-when-active.js with "500,rococo-at-westend" within 600 seconds

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -e

# TODO: This test doesn't work. It was added at a time when we couldn't run it because we didn't have the scafolding.
# It needs to be fixed. For the moment we keep it in the repo as it is since the idea has value.
# But we don't run it in the CI.

source "${BASH_SOURCE%/*}/../../framework/utils/common.sh"
source "${BASH_SOURCE%/*}/../../framework/utils/zombienet.sh"

export ENV_PATH=`realpath ${BASH_SOURCE%/*}/../../environments/rococo-westend`

logs_dir=$TEST_DIR/logs

$ENV_PATH/spawn.sh --init &
env_pid=$!

ensure_process_file $env_pid $TEST_DIR/rococo.env 600
rococo_dir=`cat $TEST_DIR/rococo.env`
echo

ensure_process_file $env_pid $TEST_DIR/westend.env 300
westend_dir=`cat $TEST_DIR/westend.env`
echo

echo "Sending message from Rococo to Westend"
$ENV_PATH/helper.sh auto-log reserve-transfer-assets-from-asset-hub-rococo-local 5000000000000
echo

echo "Sending message from Westend to Rococo"
$ENV_PATH/helper.sh auto-log reserve-transfer-assets-from-asset-hub-westend-local 5000000000000
echo


# Start the relayer with a 30s delay
# We want to be sure that the messages won't be relayed before starting the js script in `rococo-to-westend.zndsl`
start_relayer_log=$logs_dir/start_relayer.log
echo -e "The rococo-westend relayer will be started in 30s. Logs will be available at: $start_relayer_log\n"
(sleep 30 && $ENV_PATH/start_relayer.sh \
$rococo_dir $westend_dir finality_relayer_pid parachains_relayer_pid messages_relayer_pid > $start_relayer_log)&

run_zndsl ${BASH_SOURCE%/*}/rococo-to-westend.zndsl $westend_dir

Loading