Skip to content

Commit

Permalink
Bridge zombienet tests - move all test scripts to the same folder (#3333
Browse files Browse the repository at this point in the history
)

Related to #3242
  • Loading branch information
serban300 authored Feb 15, 2024
1 parent 150a360 commit 5fc7622
Show file tree
Hide file tree
Showing 58 changed files with 97 additions and 229 deletions.
1 change: 1 addition & 0 deletions .config/taplo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**",
Expand Down
5 changes: 1 addition & 4 deletions .gitlab/pipeline/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions .gitlab/pipeline/zombienet/bridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# import common functions
source "$(dirname "$0")"/bridges_common.sh
source "${BASH_SOURCE%/*}/../../utils/bridges.sh"

# Expected sovereign accounts.
#
Expand Down
3 changes: 3 additions & 0 deletions bridges/testing/environments/rococo-westend/helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

$POLKADOT_SDK_PATH/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh "$@"
8 changes: 8 additions & 0 deletions bridges/testing/environments/rococo-westend/rococo-init.zndsl
Original file line number Diff line number Diff line change
@@ -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


7 changes: 7 additions & 0 deletions bridges/testing/environments/rococo-westend/rococo.zndsl
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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

6 changes: 6 additions & 0 deletions bridges/testing/environments/rococo-westend/westend.zndsl
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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
asset-hub-rococo-collator1: run ../../environments/rococo-westend/helper.sh with "withdraw-reserve-assets-from-asset-hub-westend-local" within 120 seconds

# 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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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
asset-hub-westend-collator1: run ../../environments/rococo-westend/helper.sh with "withdraw-reserve-assets-from-asset-hub-rococo-local" within 120 seconds

# 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
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions bridges/zombienet/environments/rococo-westend/helper.sh

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions bridges/zombienet/environments/rococo-westend/rococo.zndsl

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions bridges/zombienet/environments/rococo-westend/westend.zndsl

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5fc7622

Please sign in to comment.