Skip to content

Commit

Permalink
Migrate test 0002 to new orchestrator
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Feb 13, 2024
1 parent 5abe478 commit e60d777
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .gitlab/pipeline/zombienet/bridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ zombienet-bridges-0001-asset-transfer-works:
script:
- /home/nonroot/bridges-polkadot-sdk/bridges/zombienet/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
- echo "Done"
3 changes: 2 additions & 1 deletion bridges/zombienet/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module.exports = {
const bestBridgedParachainHeader = await apiAtParent.query[bridgedChain.parachainsPalletName].parasInfo(bridgedChain.bridgedBridgeHubParaId);;
const hasBestBridgedParachainHeader = bestBridgedParachainHeader.isSome;

const oldParachainHeaders = hasBestBridgedParachainHeader ? 1: 0;
// we expect to see: no more than `1` bridged parachain header if there were no parachain header before.
const maxNewParachainHeaders = hasBestBridgedParachainHeader ? 0 : 1;
const newParachainHeaders = module.exports.countParachainHeaderImports(bridgedChain, currentEvents);
Expand All @@ -98,6 +99,6 @@ module.exports = {
throw new Error("Unexpected parachain header import: " + newParachainHeaders + " / " + maxNewParachainHeaders);
}

return newParachainHeaders;
return oldParachainHeaders + newParachainHeaders;
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +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
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

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

set -e

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

# We use `--relayer-delay` in order to 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.
${BASH_SOURCE%/*}/../../environments/rococo-westend/spawn.sh &
env_pid=$!

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

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

# Sleep for some time before starting the relayer. We want to sleep for at least 1 session,
# which is expected to be 60 seconds for the test environment.
echo -e "Sleeping 180s before starting relayer ...\n"
sleep 180
${BASH_SOURCE%/*}/../../environments/rococo-westend/start_relayer.sh $rococo_dir $westend_dir relayer_pid

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

Original file line number Diff line number Diff line change
@@ -0,0 +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
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

0 comments on commit e60d777

Please sign in to comment.