From 5fc7622cb312f2d32ec8365012ee0a49622db8c8 Mon Sep 17 00:00:00 2001 From: Serban Iorga Date: Thu, 15 Feb 2024 13:56:58 +0100 Subject: [PATCH] Bridge zombienet tests - move all test scripts to the same folder (#3333) Related to https://github.com/paritytech/polkadot-sdk/issues/3242 --- .config/taplo.toml | 1 + .gitlab/pipeline/build.yml | 5 +-- .gitlab/pipeline/zombienet/bridges.yml | 8 ++-- bridges/{zombienet => testing}/README.md | 0 .../bridge_hub_rococo_local_network.toml | 0 .../bridge_hub_westend_local_network.toml | 0 .../rococo-westend}/bridges_rococo_westend.sh | 2 +- .../environments/rococo-westend/helper.sh | 3 ++ .../rococo-westend/rococo-init.zndsl | 8 ++++ .../environments/rococo-westend/rococo.zndsl | 7 ++++ .../environments/rococo-westend/spawn.sh | 4 +- .../rococo-westend/start_relayer.sh | 0 .../rococo-westend/westend-init.zndsl | 7 ++++ .../environments/rococo-westend/westend.zndsl | 6 +++ .../best-finalized-header-at-bridged-chain.js | 0 .../js-helpers}/chains/rococo-at-westend.js | 0 .../js-helpers}/chains/westend-at-rococo.js | 0 .../native-assets-balance-increased.js | 0 ...only-mandatory-headers-synced-when-idle.js | 0 .../only-required-headers-synced-when-idle.js | 0 .../js-helpers}/relayer-rewards.js | 0 .../helpers => testing/js-helpers}/utils.js | 0 .../js-helpers}/wait-hrmp-channel-opened.js | 0 .../js-helpers}/wrapped-assets-balance.js | 0 .../{zombienet => testing}/run-new-test.sh | 0 bridges/{zombienet => testing}/run-tests.sh | 2 +- .../scripts/invoke-script.sh | 2 +- .../scripts/start-relayer.sh | 2 +- .../scripts/sync-exit.sh | 0 .../roc-reaches-westend.zndsl | 12 ++++++ .../tests/0001-asset-transfer/run.sh | 0 .../wnd-reaches-rococo.zndsl | 12 ++++++ .../wroc-reaches-rococo.zndsl | 4 +- .../wwnd-reaches-westend.zndsl | 4 +- .../rococo-to-westend.zndsl | 4 +- .../run.sh | 0 .../westend-to-rococo.zndsl | 4 +- ...ynced-while-active-rococo-to-westend.zndsl | 6 +-- ...ynced-while-active-westend-to-rococo.zndsl | 6 +-- .../testing/utils/bridges.sh | 2 +- .../{zombienet => testing}/utils/common.sh | 0 .../utils}/generate_hex_encoded_call/index.js | 0 .../package-lock.json | 0 .../generate_hex_encoded_call/package.json | 0 .../{zombienet => testing}/utils/zombienet.sh | 0 .../environments/rococo-westend/helper.sh | 3 -- .../rococo-westend/rococo-init.zndsl | 8 ---- .../environments/rococo-westend/rococo.zndsl | 7 ---- .../rococo-westend/westend-init.zndsl | 7 ---- .../environments/rococo-westend/westend.zndsl | 6 --- ...set-transfer-works-rococo-to-westend.zndsl | 39 ------------------- ...set-transfer-works-westend-to-rococo.zndsl | 39 ------------------- .../roc-reaches-westend.zndsl | 12 ------ .../wnd-reaches-rococo.zndsl | 12 ------ ...-synced-while-idle-rococo-to-westend.zndsl | 26 ------------- ...-synced-while-idle-westend-to-rococo.zndsl | 26 ------------- .../parachains/runtimes/bridge-hubs/README.md | 26 ++++++------- ...ridges_zombienet_tests_injected.Dockerfile | 4 +- 58 files changed, 97 insertions(+), 229 deletions(-) rename bridges/{zombienet => testing}/README.md (100%) rename {cumulus/zombienet/bridge-hubs => bridges/testing/environments/rococo-westend}/bridge_hub_rococo_local_network.toml (100%) rename {cumulus/zombienet/bridge-hubs => bridges/testing/environments/rococo-westend}/bridge_hub_westend_local_network.toml (100%) rename {cumulus/scripts => bridges/testing/environments/rococo-westend}/bridges_rococo_westend.sh (99%) create mode 100755 bridges/testing/environments/rococo-westend/helper.sh create mode 100644 bridges/testing/environments/rococo-westend/rococo-init.zndsl create mode 100644 bridges/testing/environments/rococo-westend/rococo.zndsl rename bridges/{zombienet => testing}/environments/rococo-westend/spawn.sh (90%) rename bridges/{zombienet => testing}/environments/rococo-westend/start_relayer.sh (100%) create mode 100644 bridges/testing/environments/rococo-westend/westend-init.zndsl create mode 100644 bridges/testing/environments/rococo-westend/westend.zndsl rename bridges/{zombienet/helpers => testing/js-helpers}/best-finalized-header-at-bridged-chain.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/chains/rococo-at-westend.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/chains/westend-at-rococo.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/native-assets-balance-increased.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/only-mandatory-headers-synced-when-idle.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/only-required-headers-synced-when-idle.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/relayer-rewards.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/utils.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/wait-hrmp-channel-opened.js (100%) rename bridges/{zombienet/helpers => testing/js-helpers}/wrapped-assets-balance.js (100%) rename bridges/{zombienet => testing}/run-new-test.sh (100%) rename bridges/{zombienet => testing}/run-tests.sh (98%) rename bridges/{zombienet => testing}/scripts/invoke-script.sh (62%) rename bridges/{zombienet => testing}/scripts/start-relayer.sh (63%) rename bridges/{zombienet => testing}/scripts/sync-exit.sh (100%) create mode 100644 bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl rename bridges/{zombienet => testing}/tests/0001-asset-transfer/run.sh (100%) create mode 100644 bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl rename bridges/{zombienet => testing}/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl (65%) rename bridges/{zombienet => testing}/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl (65%) rename bridges/{zombienet => testing}/tests/0002-mandatory-headers-synced-while-idle/rococo-to-westend.zndsl (58%) rename bridges/{zombienet => testing}/tests/0002-mandatory-headers-synced-while-idle/run.sh (100%) rename bridges/{zombienet => testing}/tests/0002-mandatory-headers-synced-while-idle/westend-to-rococo.zndsl (58%) rename bridges/{zombienet => testing}/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl (77%) rename bridges/{zombienet => testing}/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl (77%) rename cumulus/scripts/bridges_common.sh => bridges/testing/utils/bridges.sh (99%) rename bridges/{zombienet => testing}/utils/common.sh (100%) rename {cumulus/scripts => bridges/testing/utils}/generate_hex_encoded_call/index.js (100%) rename {cumulus/scripts => bridges/testing/utils}/generate_hex_encoded_call/package-lock.json (100%) rename {cumulus/scripts => bridges/testing/utils}/generate_hex_encoded_call/package.json (100%) rename bridges/{zombienet => testing}/utils/zombienet.sh (100%) delete mode 100755 bridges/zombienet/environments/rococo-westend/helper.sh delete mode 100644 bridges/zombienet/environments/rococo-westend/rococo-init.zndsl delete mode 100644 bridges/zombienet/environments/rococo-westend/rococo.zndsl delete mode 100644 bridges/zombienet/environments/rococo-westend/westend-init.zndsl delete mode 100644 bridges/zombienet/environments/rococo-westend/westend.zndsl delete mode 100644 bridges/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl delete mode 100644 bridges/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl delete mode 100644 bridges/zombienet/tests/0001-asset-transfer/roc-reaches-westend.zndsl delete mode 100644 bridges/zombienet/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl delete mode 100644 bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-rococo-to-westend.zndsl delete mode 100644 bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl diff --git a/.config/taplo.toml b/.config/taplo.toml index f5d0b7021ba8..a45204923cff 100644 --- a/.config/taplo.toml +++ b/.config/taplo.toml @@ -2,6 +2,7 @@ # ignore zombienet as they do some deliberate custom toml stuff exclude = [ + "bridges/testing/**", "cumulus/zombienet/**", "polkadot/node/malus/integrationtests/**", "polkadot/zombienet_tests/**", diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml index 42aabc2635d4..53c47e5ff5ae 100644 --- a/.gitlab/pipeline/build.yml +++ b/.gitlab/pipeline/build.yml @@ -408,8 +408,5 @@ prepare-bridges-zombienet-artifacts: - .collect-artifacts before_script: - mkdir -p ./artifacts/bridges-polkadot-sdk/bridges - - mkdir -p ./artifacts/bridges-polkadot-sdk/cumulus/zombienet script: - - cp -r bridges/zombienet ./artifacts/bridges-polkadot-sdk/bridges/zombienet - - cp -r cumulus/scripts ./artifacts/bridges-polkadot-sdk/cumulus/scripts - - cp -r cumulus/zombienet/bridge-hubs ./artifacts/bridges-polkadot-sdk/cumulus/zombienet/bridge-hubs + - cp -r bridges/testing ./artifacts/bridges-polkadot-sdk/bridges/testing diff --git a/.gitlab/pipeline/zombienet/bridges.yml b/.gitlab/pipeline/zombienet/bridges.yml index 16cabad6ccab..f7c32d21c551 100644 --- a/.gitlab/pipeline/zombienet/bridges.yml +++ b/.gitlab/pipeline/zombienet/bridges.yml @@ -28,8 +28,8 @@ variables: BRIDGES_ZOMBIENET_TESTS_IMAGE_TAG: ${DOCKER_IMAGES_VERSION} BRIDGES_ZOMBIENET_TESTS_IMAGE: "docker.io/paritypr/bridges-zombienet-tests" - GH_DIR: "https://github.com/paritytech/polkadot-sdk/tree/${CI_COMMIT_SHA}/bridges/zombienet" - LOCAL_DIR: "/builds/parity/mirrors/polkadot-sdk/bridges/zombienet" + GH_DIR: "https://github.com/paritytech/polkadot-sdk/tree/${CI_COMMIT_SHA}/bridges/testing" + LOCAL_DIR: "/builds/parity/mirrors/polkadot-sdk/bridges/testing" FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1 RUN_IN_CONTAINER: "1" artifacts: @@ -51,12 +51,12 @@ zombienet-bridges-0001-asset-transfer-works: extends: - .zombienet-bridges-common script: - - /home/nonroot/bridges-polkadot-sdk/bridges/zombienet/run-new-test.sh 0001-asset-transfer --docker + - /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0001-asset-transfer --docker - echo "Done" zombienet-bridges-0002-mandatory-headers-synced-while-idle: extends: - .zombienet-bridges-common script: - - /home/nonroot/bridges-polkadot-sdk/bridges/zombienet/run-new-test.sh 0002-mandatory-headers-synced-while-idle --docker + - /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0002-mandatory-headers-synced-while-idle --docker - echo "Done" diff --git a/bridges/zombienet/README.md b/bridges/testing/README.md similarity index 100% rename from bridges/zombienet/README.md rename to bridges/testing/README.md diff --git a/cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml b/bridges/testing/environments/rococo-westend/bridge_hub_rococo_local_network.toml similarity index 100% rename from cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml rename to bridges/testing/environments/rococo-westend/bridge_hub_rococo_local_network.toml diff --git a/cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml b/bridges/testing/environments/rococo-westend/bridge_hub_westend_local_network.toml similarity index 100% rename from cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml rename to bridges/testing/environments/rococo-westend/bridge_hub_westend_local_network.toml diff --git a/cumulus/scripts/bridges_rococo_westend.sh b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh similarity index 99% rename from cumulus/scripts/bridges_rococo_westend.sh rename to bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh index 7bde5ede77fd..84764cdaca38 100755 --- a/cumulus/scripts/bridges_rococo_westend.sh +++ b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh @@ -1,7 +1,7 @@ #!/bin/bash # import common functions -source "$(dirname "$0")"/bridges_common.sh +source "${BASH_SOURCE%/*}/../../utils/bridges.sh" # Expected sovereign accounts. # diff --git a/bridges/testing/environments/rococo-westend/helper.sh b/bridges/testing/environments/rococo-westend/helper.sh new file mode 100755 index 000000000000..211a5b53b3d9 --- /dev/null +++ b/bridges/testing/environments/rococo-westend/helper.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +$POLKADOT_SDK_PATH/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh "$@" diff --git a/bridges/testing/environments/rococo-westend/rococo-init.zndsl b/bridges/testing/environments/rococo-westend/rococo-init.zndsl new file mode 100644 index 000000000000..145f2df73a6e --- /dev/null +++ b/bridges/testing/environments/rococo-westend/rococo-init.zndsl @@ -0,0 +1,8 @@ +Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back +Network: ./bridge_hub_rococo_local_network.toml +Creds: config + +# ensure that initialization has completed +asset-hub-rococo-collator1: js-script ../../js-helpers/wait-hrmp-channel-opened.js with "1013" within 300 seconds + + diff --git a/bridges/testing/environments/rococo-westend/rococo.zndsl b/bridges/testing/environments/rococo-westend/rococo.zndsl new file mode 100644 index 000000000000..bd8681af2196 --- /dev/null +++ b/bridges/testing/environments/rococo-westend/rococo.zndsl @@ -0,0 +1,7 @@ +Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back +Network: ./bridge_hub_rococo_local_network.toml +Creds: config + +# relay is already started - let's wait until with-Westend GRANPDA pallet is initialized at Rococo +bridge-hub-rococo-collator1: js-script ../../js-helpers/best-finalized-header-at-bridged-chain.js with "Westend,0" within 400 seconds + diff --git a/bridges/zombienet/environments/rococo-westend/spawn.sh b/bridges/testing/environments/rococo-westend/spawn.sh similarity index 90% rename from bridges/zombienet/environments/rococo-westend/spawn.sh rename to bridges/testing/environments/rococo-westend/spawn.sh index 550eee04bd6e..5a0d65ce65db 100755 --- a/bridges/zombienet/environments/rococo-westend/spawn.sh +++ b/bridges/testing/environments/rococo-westend/spawn.sh @@ -26,11 +26,11 @@ done logs_dir=$TEST_DIR/logs helper_script="${BASH_SOURCE%/*}/helper.sh" -rococo_def=$POLKADOT_SDK_PATH/cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml +rococo_def=${BASH_SOURCE%/*}/bridge_hub_rococo_local_network.toml start_zombienet $TEST_DIR $rococo_def rococo_dir rococo_pid echo -westend_def=$POLKADOT_SDK_PATH/cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml +westend_def=${BASH_SOURCE%/*}/bridge_hub_westend_local_network.toml start_zombienet $TEST_DIR $westend_def westend_dir westend_pid echo diff --git a/bridges/zombienet/environments/rococo-westend/start_relayer.sh b/bridges/testing/environments/rococo-westend/start_relayer.sh similarity index 100% rename from bridges/zombienet/environments/rococo-westend/start_relayer.sh rename to bridges/testing/environments/rococo-westend/start_relayer.sh diff --git a/bridges/testing/environments/rococo-westend/westend-init.zndsl b/bridges/testing/environments/rococo-westend/westend-init.zndsl new file mode 100644 index 000000000000..2f8e665d592d --- /dev/null +++ b/bridges/testing/environments/rococo-westend/westend-init.zndsl @@ -0,0 +1,7 @@ +Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back +Network: ./bridge_hub_westend_local_network.toml +Creds: config + +# ensure that initialization has completed +asset-hub-westend-collator1: js-script ../../js-helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds + diff --git a/bridges/testing/environments/rococo-westend/westend.zndsl b/bridges/testing/environments/rococo-westend/westend.zndsl new file mode 100644 index 000000000000..c75ae579d27a --- /dev/null +++ b/bridges/testing/environments/rococo-westend/westend.zndsl @@ -0,0 +1,6 @@ +Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back +Network: ./bridge_hub_westend_local_network.toml +Creds: config + +# relay is already started - let's wait until with-Rococo GRANPDA pallet is initialized at Westend +bridge-hub-westend-collator1: js-script ../../js-helpers/best-finalized-header-at-bridged-chain.js with "Rococo,0" within 400 seconds diff --git a/bridges/zombienet/helpers/best-finalized-header-at-bridged-chain.js b/bridges/testing/js-helpers/best-finalized-header-at-bridged-chain.js similarity index 100% rename from bridges/zombienet/helpers/best-finalized-header-at-bridged-chain.js rename to bridges/testing/js-helpers/best-finalized-header-at-bridged-chain.js diff --git a/bridges/zombienet/helpers/chains/rococo-at-westend.js b/bridges/testing/js-helpers/chains/rococo-at-westend.js similarity index 100% rename from bridges/zombienet/helpers/chains/rococo-at-westend.js rename to bridges/testing/js-helpers/chains/rococo-at-westend.js diff --git a/bridges/zombienet/helpers/chains/westend-at-rococo.js b/bridges/testing/js-helpers/chains/westend-at-rococo.js similarity index 100% rename from bridges/zombienet/helpers/chains/westend-at-rococo.js rename to bridges/testing/js-helpers/chains/westend-at-rococo.js diff --git a/bridges/zombienet/helpers/native-assets-balance-increased.js b/bridges/testing/js-helpers/native-assets-balance-increased.js similarity index 100% rename from bridges/zombienet/helpers/native-assets-balance-increased.js rename to bridges/testing/js-helpers/native-assets-balance-increased.js diff --git a/bridges/zombienet/helpers/only-mandatory-headers-synced-when-idle.js b/bridges/testing/js-helpers/only-mandatory-headers-synced-when-idle.js similarity index 100% rename from bridges/zombienet/helpers/only-mandatory-headers-synced-when-idle.js rename to bridges/testing/js-helpers/only-mandatory-headers-synced-when-idle.js diff --git a/bridges/zombienet/helpers/only-required-headers-synced-when-idle.js b/bridges/testing/js-helpers/only-required-headers-synced-when-idle.js similarity index 100% rename from bridges/zombienet/helpers/only-required-headers-synced-when-idle.js rename to bridges/testing/js-helpers/only-required-headers-synced-when-idle.js diff --git a/bridges/zombienet/helpers/relayer-rewards.js b/bridges/testing/js-helpers/relayer-rewards.js similarity index 100% rename from bridges/zombienet/helpers/relayer-rewards.js rename to bridges/testing/js-helpers/relayer-rewards.js diff --git a/bridges/zombienet/helpers/utils.js b/bridges/testing/js-helpers/utils.js similarity index 100% rename from bridges/zombienet/helpers/utils.js rename to bridges/testing/js-helpers/utils.js diff --git a/bridges/zombienet/helpers/wait-hrmp-channel-opened.js b/bridges/testing/js-helpers/wait-hrmp-channel-opened.js similarity index 100% rename from bridges/zombienet/helpers/wait-hrmp-channel-opened.js rename to bridges/testing/js-helpers/wait-hrmp-channel-opened.js diff --git a/bridges/zombienet/helpers/wrapped-assets-balance.js b/bridges/testing/js-helpers/wrapped-assets-balance.js similarity index 100% rename from bridges/zombienet/helpers/wrapped-assets-balance.js rename to bridges/testing/js-helpers/wrapped-assets-balance.js diff --git a/bridges/zombienet/run-new-test.sh b/bridges/testing/run-new-test.sh similarity index 100% rename from bridges/zombienet/run-new-test.sh rename to bridges/testing/run-new-test.sh diff --git a/bridges/zombienet/run-tests.sh b/bridges/testing/run-tests.sh similarity index 98% rename from bridges/zombienet/run-tests.sh rename to bridges/testing/run-tests.sh index 42818a5cdf36..6149d9912653 100755 --- a/bridges/zombienet/run-tests.sh +++ b/bridges/testing/run-tests.sh @@ -28,7 +28,7 @@ done # assuming that we'll be using native provide && all processes will be executing locally # (we need absolute paths here, because they're used when scripts are called by zombienet from tmp folders) export POLKADOT_SDK_PATH=`realpath $(dirname "$0")/../..` -export BRIDGE_TESTS_FOLDER=$POLKADOT_SDK_PATH/bridges/zombienet/tests +export BRIDGE_TESTS_FOLDER=$POLKADOT_SDK_PATH/bridges/testing/tests # set pathc to binaries if [ "$ZOMBIENET_DOCKER_PATHS" -eq 1 ]; then diff --git a/bridges/zombienet/scripts/invoke-script.sh b/bridges/testing/scripts/invoke-script.sh similarity index 62% rename from bridges/zombienet/scripts/invoke-script.sh rename to bridges/testing/scripts/invoke-script.sh index 1f814cd08562..cd0557b071bb 100755 --- a/bridges/zombienet/scripts/invoke-script.sh +++ b/bridges/testing/scripts/invoke-script.sh @@ -2,6 +2,6 @@ INVOKE_LOG=`mktemp -p $TEST_FOLDER invoke.XXXXX` -pushd $POLKADOT_SDK_PATH/cumulus/scripts +pushd $POLKADOT_SDK_PATH/bridges/testing/environments/rococo-westend ./bridges_rococo_westend.sh $1 >$INVOKE_LOG 2>&1 popd diff --git a/bridges/zombienet/scripts/start-relayer.sh b/bridges/testing/scripts/start-relayer.sh similarity index 63% rename from bridges/zombienet/scripts/start-relayer.sh rename to bridges/testing/scripts/start-relayer.sh index 630fd7316fe4..38ea62fad524 100755 --- a/bridges/zombienet/scripts/start-relayer.sh +++ b/bridges/testing/scripts/start-relayer.sh @@ -2,6 +2,6 @@ RELAY_LOG=`mktemp -p $TEST_FOLDER relay.XXXXX` -pushd $POLKADOT_SDK_PATH/cumulus/scripts +pushd $POLKADOT_SDK_PATH/bridges/testing/environments/rococo-westend ./bridges_rococo_westend.sh run-relay >$RELAY_LOG 2>&1& popd diff --git a/bridges/zombienet/scripts/sync-exit.sh b/bridges/testing/scripts/sync-exit.sh similarity index 100% rename from bridges/zombienet/scripts/sync-exit.sh rename to bridges/testing/scripts/sync-exit.sh diff --git a/bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl b/bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl new file mode 100644 index 000000000000..203c95b73eb2 --- /dev/null +++ b/bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl @@ -0,0 +1,12 @@ +Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back +Network: ../../environments/rococo-westend/bridge_hub_westend_local_network.toml +Creds: config + +# send ROC to //Alice from Rococo AH to Westend AH +asset-hub-westend-collator1: run ../../environments/rococo-westend/helper.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 120 seconds + +# check that //Alice received the ROC on Westend AH +asset-hub-westend-collator1: js-script ../../js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Rococo" within 300 seconds + +# check that the relayer //Charlie is rewarded by Westend AH +bridge-hub-westend-collator1: js-script ../../js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726F,ThisChain,0" within 30 seconds diff --git a/bridges/zombienet/tests/0001-asset-transfer/run.sh b/bridges/testing/tests/0001-asset-transfer/run.sh similarity index 100% rename from bridges/zombienet/tests/0001-asset-transfer/run.sh rename to bridges/testing/tests/0001-asset-transfer/run.sh diff --git a/bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl b/bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl new file mode 100644 index 000000000000..bbd95db9cfda --- /dev/null +++ b/bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl @@ -0,0 +1,12 @@ +Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back +Network: ../../environments/rococo-westend/bridge_hub_rococo_local_network.toml +Creds: config + +# send WND to //Alice from Westend AH to Rococo AH +asset-hub-rococo-collator1: run ../../environments/rococo-westend/helper.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 120 seconds + +# check that //Alice received the WND on Rococo AH +asset-hub-rococo-collator1: js-script ../../js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Westend" within 300 seconds + +# check that the relayer //Charlie is rewarded by Rococo AH +bridge-hub-rococo-collator1: js-script ../../js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,ThisChain,0" within 30 seconds diff --git a/bridges/zombienet/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl b/bridges/testing/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl similarity index 65% rename from bridges/zombienet/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl rename to bridges/testing/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl index 7fbdecadeaef..4c0a4675234e 100644 --- a/bridges/zombienet/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl +++ b/bridges/testing/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl @@ -1,5 +1,5 @@ Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml +Network: ../../environments/rococo-westend/bridge_hub_westend_local_network.toml Creds: config # send wROC back to Alice from Westend AH to Rococo AH @@ -7,4 +7,4 @@ asset-hub-rococo-collator1: run ../../environments/rococo-westend/helper.sh with # check that //Alice received the wROC on Rococo AH # (we wait until //Alice account increases here - there are no other transactions that may increase it) -asset-hub-rococo-collator1: js-script ../../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 300 seconds +asset-hub-rococo-collator1: js-script ../../js-helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 300 seconds diff --git a/bridges/zombienet/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl b/bridges/testing/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl similarity index 65% rename from bridges/zombienet/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl rename to bridges/testing/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl index 662e88752688..3acded97d5cc 100644 --- a/bridges/zombienet/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl +++ b/bridges/testing/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl @@ -1,5 +1,5 @@ Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml +Network: ../../environments/rococo-westend/bridge_hub_westend_local_network.toml Creds: config # send wWND back to Alice from Rococo AH to Westend AH @@ -7,4 +7,4 @@ asset-hub-westend-collator1: run ../../environments/rococo-westend/helper.sh wit # check that //Alice received the wWND on Westend AH # (we wait until //Alice account increases here - there are no other transactions that may increase it) -asset-hub-westend-collator1: js-script ../../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 300 seconds +asset-hub-westend-collator1: js-script ../../js-helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 300 seconds diff --git a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/rococo-to-westend.zndsl b/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/rococo-to-westend.zndsl similarity index 58% rename from bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/rococo-to-westend.zndsl rename to bridges/testing/tests/0002-mandatory-headers-synced-while-idle/rococo-to-westend.zndsl index d4283b361296..82a1a103b14a 100644 --- a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/rococo-to-westend.zndsl +++ b/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/rococo-to-westend.zndsl @@ -1,8 +1,8 @@ Description: While relayer is idle, we only sync mandatory Rococo (and a single Rococo BH) headers to Westend BH. -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml +Network: ../../environments/rococo-westend/bridge_hub_westend_local_network.toml Creds: config # ensure that relayer is only syncing mandatory headers while idle. This includes both headers that were # generated while relay was offline and those in the next 100 seconds while script is active. -bridge-hub-westend-collator1: js-script ../../helpers/only-mandatory-headers-synced-when-idle.js with "300,rococo-at-westend" within 600 seconds +bridge-hub-westend-collator1: js-script ../../js-helpers/only-mandatory-headers-synced-when-idle.js with "300,rococo-at-westend" within 600 seconds diff --git a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/run.sh b/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/run.sh similarity index 100% rename from bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/run.sh rename to bridges/testing/tests/0002-mandatory-headers-synced-while-idle/run.sh diff --git a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/westend-to-rococo.zndsl b/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/westend-to-rococo.zndsl similarity index 58% rename from bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/westend-to-rococo.zndsl rename to bridges/testing/tests/0002-mandatory-headers-synced-while-idle/westend-to-rococo.zndsl index 1ea4c92a3458..865813246252 100644 --- a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle/westend-to-rococo.zndsl +++ b/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/westend-to-rococo.zndsl @@ -1,7 +1,7 @@ Description: While relayer is idle, we only sync mandatory Westend (and a single Westend BH) headers to Rococo BH. -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml +Network: ../../environments/rococo-westend/bridge_hub_rococo_local_network.toml Creds: config # ensure that relayer is only syncing mandatory headers while idle. This includes both headers that were # generated while relay was offline and those in the next 100 seconds while script is active. -bridge-hub-rococo-collator1: js-script ../../helpers/only-mandatory-headers-synced-when-idle.js with "300,westend-at-rococo" within 600 seconds +bridge-hub-rococo-collator1: js-script ../../js-helpers/only-mandatory-headers-synced-when-idle.js with "300,westend-at-rococo" within 600 seconds diff --git a/bridges/zombienet/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl b/bridges/testing/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl similarity index 77% rename from bridges/zombienet/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl rename to bridges/testing/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl index a4960344f0a0..07b91481dc7c 100644 --- a/bridges/zombienet/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl +++ b/bridges/testing/tests/0003-required-headers-synced-while-active-rococo-to-westend.zndsl @@ -1,5 +1,5 @@ Description: While relayer is active, we only sync mandatory and required Rococo (and Rococo BH) headers to Westend BH. -Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml +Network: ../environments/rococo-westend/bridge_hub_westend_local_network.toml Creds: config # step 1: initialize Westend AH @@ -9,7 +9,7 @@ asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-asset-hu bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 60 seconds # step 3: ensure that initialization has completed -asset-hub-westend-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds +asset-hub-westend-collator1: js-script ../js-helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds # step 4: send message from Westend to Rococo asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 60 seconds @@ -20,7 +20,7 @@ asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "reserve-trans # (it is started by sibling 0003-required-headers-synced-while-active-westend-to-rococo.zndsl) # step 6: ensure that relayer won't sync any extra headers while delivering messages and confirmations -bridge-hub-westend-collator1: js-script ../helpers/only-required-headers-synced-when-active.js with "500,rococo-at-westend" within 600 seconds +bridge-hub-westend-collator1: js-script ../js-helpers/only-required-headers-synced-when-active.js with "500,rococo-at-westend" within 600 seconds # wait until other network test has completed OR exit with an error too asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/bridges/zombienet/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl b/bridges/testing/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl similarity index 77% rename from bridges/zombienet/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl rename to bridges/testing/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl index 33c3ceebcf84..a6b11fc24052 100644 --- a/bridges/zombienet/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl +++ b/bridges/testing/tests/0003-required-headers-synced-while-active-westend-to-rococo.zndsl @@ -1,5 +1,5 @@ Description: While relayer is active, we only sync mandatory and required Westend (and Westend BH) headers to Rococo BH. -Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml +Network: ../environments/rococo-westend/bridge_hub_rococo_local_network.toml Creds: config # step 1: initialize Rococo AH @@ -9,7 +9,7 @@ asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-asset-hub bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 60 seconds # step 3: ensure that initialization has completed -asset-hub-rococo-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1013" within 600 seconds +asset-hub-rococo-collator1: js-script ../js-helpers/wait-hrmp-channel-opened.js with "1013" within 600 seconds # step 4: send message from Rococo to Westend asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 60 seconds @@ -20,7 +20,7 @@ asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "reserve-transf bridge-hub-rococo-collator1: run ../scripts/start-relayer.sh within 60 seconds # step 6: ensure that relayer won't sync any extra headers while delivering messages and confirmations -bridge-hub-rococo-collator1: js-script ../helpers/only-required-headers-synced-when-active.js with "500,westend-at-rococo" within 600 seconds +bridge-hub-rococo-collator1: js-script ../js-helpers/only-required-headers-synced-when-active.js with "500,westend-at-rococo" within 600 seconds # wait until other network test has completed OR exit with an error too asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/cumulus/scripts/bridges_common.sh b/bridges/testing/utils/bridges.sh similarity index 99% rename from cumulus/scripts/bridges_common.sh rename to bridges/testing/utils/bridges.sh index 2064dbbb5b85..cfde5dfd26b7 100755 --- a/cumulus/scripts/bridges_common.sh +++ b/bridges/testing/utils/bridges.sh @@ -65,7 +65,7 @@ function generate_hex_encoded_call_data() { shift echo "Input params: $@" - node $(dirname "$0")/generate_hex_encoded_call "$type" "$endpoint" "$output" "$@" + node ${BASH_SOURCE%/*}/../utils/generate_hex_encoded_call "$type" "$endpoint" "$output" "$@" local retVal=$? if [ $type != "check" ]; then diff --git a/bridges/zombienet/utils/common.sh b/bridges/testing/utils/common.sh similarity index 100% rename from bridges/zombienet/utils/common.sh rename to bridges/testing/utils/common.sh diff --git a/cumulus/scripts/generate_hex_encoded_call/index.js b/bridges/testing/utils/generate_hex_encoded_call/index.js similarity index 100% rename from cumulus/scripts/generate_hex_encoded_call/index.js rename to bridges/testing/utils/generate_hex_encoded_call/index.js diff --git a/cumulus/scripts/generate_hex_encoded_call/package-lock.json b/bridges/testing/utils/generate_hex_encoded_call/package-lock.json similarity index 100% rename from cumulus/scripts/generate_hex_encoded_call/package-lock.json rename to bridges/testing/utils/generate_hex_encoded_call/package-lock.json diff --git a/cumulus/scripts/generate_hex_encoded_call/package.json b/bridges/testing/utils/generate_hex_encoded_call/package.json similarity index 100% rename from cumulus/scripts/generate_hex_encoded_call/package.json rename to bridges/testing/utils/generate_hex_encoded_call/package.json diff --git a/bridges/zombienet/utils/zombienet.sh b/bridges/testing/utils/zombienet.sh similarity index 100% rename from bridges/zombienet/utils/zombienet.sh rename to bridges/testing/utils/zombienet.sh diff --git a/bridges/zombienet/environments/rococo-westend/helper.sh b/bridges/zombienet/environments/rococo-westend/helper.sh deleted file mode 100755 index 049693e0e293..000000000000 --- a/bridges/zombienet/environments/rococo-westend/helper.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -$POLKADOT_SDK_PATH/cumulus/scripts/bridges_rococo_westend.sh "$@" diff --git a/bridges/zombienet/environments/rococo-westend/rococo-init.zndsl b/bridges/zombienet/environments/rococo-westend/rococo-init.zndsl deleted file mode 100644 index ae3e3e7cb67f..000000000000 --- a/bridges/zombienet/environments/rococo-westend/rococo-init.zndsl +++ /dev/null @@ -1,8 +0,0 @@ -Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml -Creds: config - -# ensure that initialization has completed -asset-hub-rococo-collator1: js-script ../../helpers/wait-hrmp-channel-opened.js with "1013" within 300 seconds - - diff --git a/bridges/zombienet/environments/rococo-westend/rococo.zndsl b/bridges/zombienet/environments/rococo-westend/rococo.zndsl deleted file mode 100644 index 7ecb05ceefa3..000000000000 --- a/bridges/zombienet/environments/rococo-westend/rococo.zndsl +++ /dev/null @@ -1,7 +0,0 @@ -Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml -Creds: config - -# relay is already started - let's wait until with-Westend GRANPDA pallet is initialized at Rococo -bridge-hub-rococo-collator1: js-script ../../helpers/best-finalized-header-at-bridged-chain.js with "Westend,0" within 400 seconds - diff --git a/bridges/zombienet/environments/rococo-westend/westend-init.zndsl b/bridges/zombienet/environments/rococo-westend/westend-init.zndsl deleted file mode 100644 index 3b3e4bd91e22..000000000000 --- a/bridges/zombienet/environments/rococo-westend/westend-init.zndsl +++ /dev/null @@ -1,7 +0,0 @@ -Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml -Creds: config - -# ensure that initialization has completed -asset-hub-westend-collator1: js-script ../../helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds - diff --git a/bridges/zombienet/environments/rococo-westend/westend.zndsl b/bridges/zombienet/environments/rococo-westend/westend.zndsl deleted file mode 100644 index b3864d12a0e3..000000000000 --- a/bridges/zombienet/environments/rococo-westend/westend.zndsl +++ /dev/null @@ -1,6 +0,0 @@ -Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml -Creds: config - -# relay is already started - let's wait until with-Rococo GRANPDA pallet is initialized at Westend -bridge-hub-westend-collator1: js-script ../../helpers/best-finalized-header-at-bridged-chain.js with "Rococo,0" within 400 seconds diff --git a/bridges/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl b/bridges/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl deleted file mode 100644 index 82d1eee2f45c..000000000000 --- a/bridges/zombienet/tests/0001-asset-transfer-works-rococo-to-westend.zndsl +++ /dev/null @@ -1,39 +0,0 @@ -Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back -Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml -Creds: config - -# step 0: start relayer -# (started by sibling 0001-asset-transfer-works-westend-to-rococo.zndsl test) - -# step 1: initialize Westend AH -asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-westend-local" within 60 seconds - -# step 2: initialize Westend bridge hub -bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 60 seconds - -# step 3: ensure that initialization has completed -asset-hub-westend-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds - -# step 4: relay is already started - let's wait until with-Rococo GRANPDA pallet is initialized at Westend -bridge-hub-westend-collator1: js-script ../helpers/best-finalized-header-at-bridged-chain.js with "Rococo,0" within 400 seconds - -# step 5: send WND to //Alice on Rococo AH -# (that's a required part of a sibling 0001-asset-transfer-works-westend-to-rococo.zndsl test) -asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 60 seconds - -# step 6: elsewhere Rococo has sent ROC to //Alice - let's wait for it -asset-hub-westend-collator1: js-script ../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Rococo" within 600 seconds - -# step 7: check that the relayer //Charlie is rewarded by both our AH and target AH -bridge-hub-westend-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726f,BridgedChain,0" within 300 seconds -bridge-hub-westend-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726F,ThisChain,0" within 300 seconds - -# step 8: send wROC back to Alice at Rococo AH -asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-westend-local" within 60 seconds - -# step 9: elsewhere Rococo has sent wWND to //Alice - let's wait for it -# (we wait until //Alice account increases here - there are no other transactionc that may increase it) -asset-hub-westend-collator1: js-script ../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 600 seconds - -# wait until other network test has completed OR exit with an error too -asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/bridges/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl b/bridges/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl deleted file mode 100644 index acfe0df03d26..000000000000 --- a/bridges/zombienet/tests/0001-asset-transfer-works-westend-to-rococo.zndsl +++ /dev/null @@ -1,39 +0,0 @@ -Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back -Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml -Creds: config - -# step 0: start relayer -bridge-hub-rococo-collator1: run ../scripts/start-relayer.sh within 60 seconds - -# step 1: initialize Rococo AH -asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-rococo-local" within 60 seconds - -# step 2: initialize Rococo bridge hub -bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 60 seconds - -# step 3: ensure that initialization has completed -asset-hub-rococo-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1013" within 600 seconds - -# step 4: relay is already started - let's wait until with-Westend GRANPDA pallet is initialized at Rococo -bridge-hub-rococo-collator1: js-script ../helpers/best-finalized-header-at-bridged-chain.js with "Westend,0" within 400 seconds - -# step 5: send ROC to //Alice on Westend AH -# (that's a required part of a sibling 0001-asset-transfer-works-rococo-to-westend.zndsl test) -asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 60 seconds - -# step 6: elsewhere Westend has sent WND to //Alice - let's wait for it -asset-hub-rococo-collator1: js-script ../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Westend" within 600 seconds - -# step 7: check that the relayer //Charlie is rewarded by both our AH and target AH -bridge-hub-rococo-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,BridgedChain,0" within 300 seconds -bridge-hub-rococo-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,ThisChain,0" within 300 seconds - -# step 8: send wWND back to Alice at Westend AH -asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-rococo-local" within 60 seconds - -# step 9: elsewhere Westend has sent wROC to //Alice - let's wait for it -# (we wait until //Alice account increases here - there are no other transactionc that may increase it) -asset-hub-rococo-collator1: js-script ../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 600 seconds - -# wait until other network test has completed OR exit with an error too -asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/bridges/zombienet/tests/0001-asset-transfer/roc-reaches-westend.zndsl b/bridges/zombienet/tests/0001-asset-transfer/roc-reaches-westend.zndsl deleted file mode 100644 index c7fb73a88c0d..000000000000 --- a/bridges/zombienet/tests/0001-asset-transfer/roc-reaches-westend.zndsl +++ /dev/null @@ -1,12 +0,0 @@ -Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml -Creds: config - -# send ROC to //Alice from Rococo AH to Westend AH -asset-hub-westend-collator1: run ../../environments/rococo-westend/helper.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 120 seconds - -# check that //Alice received the ROC on Westend AH -asset-hub-westend-collator1: js-script ../../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Rococo" within 300 seconds - -# check that the relayer //Charlie is rewarded by Westend AH -bridge-hub-westend-collator1: js-script ../../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726F,ThisChain,0" within 30 seconds diff --git a/bridges/zombienet/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl b/bridges/zombienet/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl deleted file mode 100644 index 91ce8e5cbff9..000000000000 --- a/bridges/zombienet/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl +++ /dev/null @@ -1,12 +0,0 @@ -Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back -Network: ../../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml -Creds: config - -# send WND to //Alice from Westend AH to Rococo AH -asset-hub-rococo-collator1: run ../../environments/rococo-westend/helper.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 120 seconds - -# check that //Alice received the WND on Rococo AH -asset-hub-rococo-collator1: js-script ../../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Westend" within 300 seconds - -# check that the relayer //Charlie is rewarded by Rococo AH -bridge-hub-rococo-collator1: js-script ../../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,ThisChain,0" within 30 seconds diff --git a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-rococo-to-westend.zndsl b/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-rococo-to-westend.zndsl deleted file mode 100644 index eb6a75c373c7..000000000000 --- a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-rococo-to-westend.zndsl +++ /dev/null @@ -1,26 +0,0 @@ -Description: While relayer is idle, we only sync mandatory Rococo (and a single Rococo BH) headers to Westend BH. -Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml -Creds: config - -# step 1: initialize Westend bridge hub -bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 60 seconds - -# step 2: sleep some time before starting relayer. We want to sleep for at least 1 session, which is expected to -# be 60 seconds for test environment. -sleep 120 seconds - -# step 3: start relayer -# (it is started by the sibling 0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl test file) - -# it also takes some time for relayer to initialize bridge, so let's sleep for 5 minutes to be sure that parachain -# header has been synced - -# step 4: ensure that relayer is only syncing mandatory headers while idle. This includes both headers that were -# born while relay was offline and those in the next 100 seconds while script is active. -bridge-hub-westend-collator1: js-script ../helpers/only-mandatory-headers-synced-when-idle.js with "300,rococo-at-westend" within 600 seconds - -# wait until other network test has completed OR exit with an error too -asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds - -# wait until other network test has completed OR exit with an error too -asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl b/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl deleted file mode 100644 index 728d54d586a9..000000000000 --- a/bridges/zombienet/tests/0002-mandatory-headers-synced-while-idle-westend-to-rococo.zndsl +++ /dev/null @@ -1,26 +0,0 @@ -Description: While relayer is idle, we only sync mandatory Westend (and a single Westend BH) headers to Rococo BH. -Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml -Creds: config - -# step 1: initialize Rococo bridge hub -bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 60 seconds - -# step 2: sleep some time before starting relayer. We want to sleep for at least 1 session, which is expected to -# be 60 seconds for test environment. -sleep 120 seconds - -# step 3: start relayer -bridge-hub-rococo-collator1: run ../scripts/start-relayer.sh within 60 seconds - -# it also takes some time for relayer to initialize bridge, so let's sleep for 5 minutes to be sure that parachain -# header has been synced - -# step 4: ensure that relayer is only syncing mandatory headers while idle. This includes both headers that were -# born while relay was offline and those in the next 100 seconds while script is active. -bridge-hub-rococo-collator1: js-script ../helpers/only-mandatory-headers-synced-when-idle.js with "300,westend-at-rococo" within 600 seconds - -# wait until other network test has completed OR exit with an error too -asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds - -# wait until other network test has completed OR exit with an error too -asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds diff --git a/cumulus/parachains/runtimes/bridge-hubs/README.md b/cumulus/parachains/runtimes/bridge-hubs/README.md index 4e9403bf25ee..c858532295dd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/README.md +++ b/cumulus/parachains/runtimes/bridge-hubs/README.md @@ -91,7 +91,7 @@ cd # Rococo + BridgeHubRococo + AssetHub for Rococo (mirroring Kusama) POLKADOT_BINARY=~/local_bridge_testing/bin/polkadot \ POLKADOT_PARACHAIN_BINARY=~/local_bridge_testing/bin/polkadot-parachain \ - ~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml + ~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./bridges/testing/environments/rococo-westend/bridge_hub_rococo_local_network.toml ``` ``` @@ -100,7 +100,7 @@ cd # Westend + BridgeHubWestend + AssetHub for Westend (mirroring Polkadot) POLKADOT_BINARY=~/local_bridge_testing/bin/polkadot \ POLKADOT_PARACHAIN_BINARY=~/local_bridge_testing/bin/polkadot-parachain \ - ~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml + ~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./bridges/testing/environments/rococo-westend/bridge_hub_westend_local_network.toml ``` ### Init bridge and run relayer between BridgeHubRococo and BridgeHubWestend @@ -112,7 +112,7 @@ POLKADOT_PARACHAIN_BINARY=~/local_bridge_testing/bin/polkadot-parachain \ ``` cd -./cumulus/scripts/bridges_rococo_westend.sh run-relay +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh run-relay ``` **Check relay-chain headers relaying:** @@ -135,10 +135,10 @@ This initialization does several things: ``` cd -./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 +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh init-asset-hub-rococo-local +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh init-bridge-hub-rococo-local +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh init-asset-hub-westend-local +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh init-bridge-hub-westend-local ``` ### Send messages - transfer asset over bridge (ROCs/WNDs) @@ -148,13 +148,13 @@ Do reserve-backed transfers: cd # ROCs from Rococo's Asset Hub to Westend's. -./cumulus/scripts/bridges_rococo_westend.sh reserve-transfer-assets-from-asset-hub-rococo-local +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh reserve-transfer-assets-from-asset-hub-rococo-local ``` ``` cd # WNDs from Westend's Asset Hub to Rococo's. -./cumulus/scripts/bridges_rococo_westend.sh reserve-transfer-assets-from-asset-hub-westend-local +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh reserve-transfer-assets-from-asset-hub-westend-local ``` - open explorers: (see zombienets) @@ -169,13 +169,13 @@ Do reserve withdraw transfers: (when previous is finished) cd # wrappedWNDs from Rococo's Asset Hub to Westend's. -./cumulus/scripts/bridges_rococo_westend.sh withdraw-reserve-assets-from-asset-hub-rococo-local +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh withdraw-reserve-assets-from-asset-hub-rococo-local ``` ``` cd # wrappedROCs from Westend's Asset Hub to Rococo's. -./cumulus/scripts/bridges_rococo_westend.sh withdraw-reserve-assets-from-asset-hub-westend-local +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh withdraw-reserve-assets-from-asset-hub-westend-local ``` ### Claim relayer's rewards on BridgeHubRococo and BridgeHubWestend @@ -188,10 +188,10 @@ cd cd # Claim rewards on BridgeHubWestend: -./cumulus/scripts/bridges_rococo_westend.sh claim-rewards-bridge-hub-rococo-local +./bridges/testing/environments/rococo-westend/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 +./bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh claim-rewards-bridge-hub-westend-local ``` - open explorers: (see zombienets) diff --git a/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile b/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile index ec8881c5a338..fde9cc6e7cf3 100644 --- a/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile +++ b/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile @@ -22,7 +22,7 @@ LABEL io.parity.image.authors="devops-team@parity.io" \ io.parity.image.source="https://github.com/paritytech/polkadot-sdk/blob/${VCS_REF}/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile" \ io.parity.image.revision="${VCS_REF}" \ io.parity.image.created="${BUILD_DATE}" \ - io.parity.image.documentation="https://github.com/paritytech/polkadot-sdk/bridges/zombienet" + io.parity.image.documentation="https://github.com/paritytech/polkadot-sdk/bridges/testing" # show backtraces ENV RUST_BACKTRACE 1 @@ -45,7 +45,7 @@ RUN mkdir -p /home/nonroot/bridges-polkadot-sdk COPY ./artifacts/bridges-polkadot-sdk /home/nonroot/bridges-polkadot-sdk # also prepare `generate_hex_encoded_call` for running RUN set -eux; \ - cd /home/nonroot/bridges-polkadot-sdk/cumulus/scripts/generate_hex_encoded_call; \ + cd /home/nonroot/bridges-polkadot-sdk/bridges/testing/utils/generate_hex_encoded_call; \ npm install # check if executable works in this container