From 8220c980084e70be55d956a69c5ebeebe47c9b9c Mon Sep 17 00:00:00 2001
From: Serban Iorga <serban@parity.io>
Date: Sat, 13 Apr 2024 10:04:26 +0300
Subject: [PATCH] Fix zombienet-bridges-0001-asset-transfer-works (#4069)

Fixes https://github.com/paritytech/polkadot-sdk/issues/3999

---------

Co-authored-by: Branislav Kontur <bkontur@gmail.com>
---
 .../rococo-westend/bridges_rococo_westend.sh         | 12 ++++++------
 bridges/testing/framework/utils/bridges.sh           |  2 +-
 .../0002-mandatory-headers-synced-while-idle/run.sh  |  6 ------
 .../bridges_zombienet_tests_injected.Dockerfile      |  2 +-
 4 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh
index 66c9ddc037b..41aa862be57 100755
--- a/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh
+++ b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh
@@ -212,19 +212,19 @@ case "$1" in
           "ws://127.0.0.1:8943" \
           "//Alice" \
           "$ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO" \
-          $((1000000000000 + 50000000000 * 20))
+          100000000000000
       # drip SA of lane dedicated to asset hub for paying rewards for delivery
       transfer_balance \
           "ws://127.0.0.1:8943" \
           "//Alice" \
           "$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_ThisChain" \
-          $((1000000000000 + 2000000000000))
+          100000000000000
       # drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
       transfer_balance \
           "ws://127.0.0.1:8943" \
           "//Alice" \
           "$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_BridgedChain" \
-          $((1000000000000 + 2000000000000))
+          100000000000000
       # set XCM version of remote BridgeHubWestend
       force_xcm_version \
           "ws://127.0.0.1:9942" \
@@ -270,19 +270,19 @@ case "$1" in
           "ws://127.0.0.1:8945" \
           "//Alice" \
           "$ASSET_HUB_WESTEND_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WESTEND" \
-          $((1000000000000000 + 50000000000 * 20))
+          100000000000000
       # drip SA of lane dedicated to asset hub for paying rewards for delivery
       transfer_balance \
           "ws://127.0.0.1:8945" \
           "//Alice" \
           "$ON_BRIDGE_HUB_WESTEND_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_ThisChain" \
-          $((1000000000000000 + 2000000000000))
+          100000000000000
       # drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
       transfer_balance \
           "ws://127.0.0.1:8945" \
           "//Alice" \
           "$ON_BRIDGE_HUB_WESTEND_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain" \
-          $((1000000000000000 + 2000000000000))
+          100000000000000
       # set XCM version of remote BridgeHubRococo
       force_xcm_version \
           "ws://127.0.0.1:9945" \
diff --git a/bridges/testing/framework/utils/bridges.sh b/bridges/testing/framework/utils/bridges.sh
index 7c839946158..07d9e4cd50b 100755
--- a/bridges/testing/framework/utils/bridges.sh
+++ b/bridges/testing/framework/utils/bridges.sh
@@ -53,7 +53,7 @@ function call_polkadot_js_api() {
     #           With it, it just submits it to the tx pool and exits.
     # --nonce -1: means to compute transaction nonce using `system_accountNextIndex` RPC, which includes all
     #             transaction that are in the tx pool.
-    polkadot-js-api --noWait --nonce -1 "$@"
+    polkadot-js-api --nonce -1 "$@" || true
 }
 
 function generate_hex_encoded_call_data() {
diff --git a/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/run.sh b/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/run.sh
index 3a604b3876d..32419dc84f5 100755
--- a/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/run.sh
+++ b/bridges/testing/tests/0002-mandatory-headers-synced-while-idle/run.sh
@@ -24,12 +24,6 @@ echo -e "Sleeping 90s before starting relayer ...\n"
 sleep 90
 ${BASH_SOURCE%/*}/../../environments/rococo-westend/start_relayer.sh $rococo_dir $westend_dir relayer_pid
 
-# Sometimes the relayer syncs multiple parachain heads in the beginning leading to test failures.
-# See issue: https://github.com/paritytech/parity-bridges-common/issues/2838.
-# TODO: Remove this sleep after the issue is fixed.
-echo -e "Sleeping 180s before runing the tests ...\n"
-sleep 180
-
 run_zndsl ${BASH_SOURCE%/*}/rococo-to-westend.zndsl $westend_dir
 run_zndsl ${BASH_SOURCE%/*}/westend-to-rococo.zndsl $rococo_dir
 
diff --git a/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile b/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile
index 4bfb73acda0..938f5cc45a1 100644
--- a/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile
+++ b/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile
@@ -1,7 +1,7 @@
 # this image is built on top of existing Zombienet image
 ARG ZOMBIENET_IMAGE
 # this image uses substrate-relay image built elsewhere
-ARG SUBSTRATE_RELAY_IMAGE=docker.io/paritytech/substrate-relay:v2023-11-07-rococo-westend-initial-relayer
+ARG SUBSTRATE_RELAY_IMAGE=docker.io/paritytech/substrate-relay:v1.2.1
 
 # metadata
 ARG VCS_REF
-- 
GitLab