From 21a1f7eeb770cdd1eb026dfda8d5d682f861cb6a Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Tue, 14 Jun 2022 10:38:39 +0200 Subject: [PATCH] error handling for local testnet REST query (#3739) When querying `ALTAIR_FORK_EPOCH` fails, the `launch_local_testnet` script got stuck because comparing `CURRENT_FORK_EPOCH` against it would keep failing with `[: : integer expression expected`. Querying `ALTAIR_FORK_EPOCH` is now retried until a number is returned. --- scripts/launch_local_testnet.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/launch_local_testnet.sh b/scripts/launch_local_testnet.sh index 6fee993c9..d6dda1b4f 100755 --- a/scripts/launch_local_testnet.sh +++ b/scripts/launch_local_testnet.sh @@ -727,9 +727,16 @@ done # light clients if [ "$LC_NODES" -ge "1" ]; then echo "Waiting for Altair finalization" - ALTAIR_FORK_EPOCH="$( - "${CURL_BINARY}" -s "http://localhost:${BASE_REST_PORT}/eth/v1/config/spec" | \ - "${JQ_BINARY}" -r '.data.ALTAIR_FORK_EPOCH')" + while :; do + ALTAIR_FORK_EPOCH="$( + "${CURL_BINARY}" -s "http://localhost:${BASE_REST_PORT}/eth/v1/config/spec" | \ + "${JQ_BINARY}" -r '.data.ALTAIR_FORK_EPOCH')" + if [ "${ALTAIR_FORK_EPOCH}" -eq "${ALTAIR_FORK_EPOCH}" ]; then # check for number + break + fi + echo "ALTAIR_FORK_EPOCH: ${ALTAIR_FORK_EPOCH}" + sleep 1 + done while :; do CURRENT_FORK_EPOCH="$( "${CURL_BINARY}" -s "http://localhost:${BASE_REST_PORT}/eth/v1/beacon/states/finalized/fork" | \