From 850253352d0322f2b6b58c6a8832d6348e05cbb1 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 14:30:49 -0400 Subject: [PATCH 01/13] fix(ci): add wait_for_sequence_gte helper to run_tests.sh --- tests/samourai-crew/run_tests.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/samourai-crew/run_tests.sh b/tests/samourai-crew/run_tests.sh index 97b00d1..afbbb0f 100755 --- a/tests/samourai-crew/run_tests.sh +++ b/tests/samourai-crew/run_tests.sh @@ -19,6 +19,27 @@ export KEY="runner" export PASSWORD="runner1234" export KEY_ADDR="${RUNNER_ADDR}" +# Poll auth/accounts until the account sequence is >= EXPECTED. +# Exits 0 (non-fatal) after 30s even if not reached — tests will surface the real error. +wait_for_sequence_gte() { + EXPECTED="$1" + RETRIES=30 + printf " Waiting for account sequence >= %s ..." "$EXPECTED" + while [ "$RETRIES" -gt 0 ]; do + CURR=$(gnokey query "auth/accounts/$KEY_ADDR" \ + -remote "$REMOTE" 2>/dev/null \ + | grep -oE '"sequence":"[0-9]+"' | grep -oE '[0-9]+$') + if [ -n "$CURR" ] && [ "$CURR" -ge "$EXPECTED" ]; then + echo " done (seq=$CURR)" + return 0 + fi + RETRIES=$((RETRIES - 1)) + sleep 1 + done + echo " WARNING: timed out waiting for sequence >= $EXPECTED, continuing" + return 0 +} + echo "Remote : $REMOTE" echo "Chain : $CHAINID" echo "Mode : $MODE" From d621e0dc5aa1d3bf07b92d35d1e17f4d6a16aa79 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 14:31:13 -0400 Subject: [PATCH 02/13] fix(ci): surface key import errors in run_tests.sh --- tests/samourai-crew/run_tests.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/samourai-crew/run_tests.sh b/tests/samourai-crew/run_tests.sh index afbbb0f..6bec3d3 100755 --- a/tests/samourai-crew/run_tests.sh +++ b/tests/samourai-crew/run_tests.sh @@ -60,19 +60,31 @@ while [ "$RETRIES" -gt 0 ]; do done # --- import all keys before CLA signing --- -printf "%s\n%s\n%s\n" "$RUNNER_MNEMONIC" "$PASSWORD" "$PASSWORD" | \ - gnokey add "$KEY" -recover -insecure-password-stdin=true \ - -home "$GNOKEY_HOME" > /dev/null 2>&1 +import_key() { + IK_NAME="$1" + IK_MNEMONIC="$2" + printf " Importing key %s ... " "$IK_NAME" + OUT=$(printf "%s\n%s\n%s\n" "$IK_MNEMONIC" "$PASSWORD" "$PASSWORD" | \ + gnokey add "$IK_NAME" -recover -insecure-password-stdin=true \ + -home "$GNOKEY_HOME" 2>&1) + if echo "$OUT" | grep -qiE "already exists"; then + echo "already exists, skipping" + elif echo "$OUT" | grep -qiE "error|failed|panic"; then + echo "FAILED" + echo "$OUT" + exit 1 + else + echo "OK" + fi +} + +import_key "$KEY" "$RUNNER_MNEMONIC" if [ -n "$STRESS_MNEMONIC_2" ] && [ "$STRESS_MNEMONIC_2" != "TODO_REPLACE_STRESS_MNEMONIC_2" ]; then - printf "%s\n%s\n%s\n" "$STRESS_MNEMONIC_2" "$PASSWORD" "$PASSWORD" | \ - gnokey add "stress_2" -recover -insecure-password-stdin=true \ - -home "$GNOKEY_HOME" > /dev/null 2>&1 + import_key "stress_2" "$STRESS_MNEMONIC_2" fi if [ -n "$STRESS_MNEMONIC_3" ] && [ "$STRESS_MNEMONIC_3" != "TODO_REPLACE_STRESS_MNEMONIC_3" ]; then - printf "%s\n%s\n%s\n" "$STRESS_MNEMONIC_3" "$PASSWORD" "$PASSWORD" | \ - gnokey add "stress_3" -recover -insecure-password-stdin=true \ - -home "$GNOKEY_HOME" > /dev/null 2>&1 + import_key "stress_3" "$STRESS_MNEMONIC_3" fi # --- sign CLA if required by the network --- From 9df8f9f1d5a32177a6dd5527c5fda102c4ddec2b Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 14:31:50 -0400 Subject: [PATCH 03/13] fix(ci): replace blind sleep 10 with sequence polling after CLA signing --- tests/samourai-crew/run_tests.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/samourai-crew/run_tests.sh b/tests/samourai-crew/run_tests.sh index 6bec3d3..c3974f9 100755 --- a/tests/samourai-crew/run_tests.sh +++ b/tests/samourai-crew/run_tests.sh @@ -110,20 +110,36 @@ sign_cla() { -insecure-password-stdin=true \ -home "$GNOKEY_HOME" \ "$SIGNER_KEY" 2>&1) - if echo "$OUT" | grep -q "OK\|already signed\|TX HASH"; then - echo "OK" + if echo "$OUT" | grep -q "OK!\|TX HASH"; then + echo "signed" + return 1 # 1 = tx was sent, sequence incremented + elif echo "$OUT" | grep -qiE "already signed"; then + echo "already signed" + return 0 # 0 = no tx sent, sequence unchanged else - echo "signed or skipped" + echo "ERROR" + echo "$OUT" + exit 1 fi } if [ -n "$CLA_HASH" ]; then echo "Signing CLA (hash: $CLA_HASH)..." + SEQ_BEFORE=$(gnokey query "auth/accounts/$KEY_ADDR" \ + -remote "$REMOTE" 2>/dev/null \ + | grep -oE '"sequence":"[0-9]+"' | grep -oE '[0-9]+$') + SEQ_BEFORE="${SEQ_BEFORE:-0}" + sign_cla "$KEY" + CLA_SENT=$? + gnokey list -home "$GNOKEY_HOME" 2>/dev/null | grep -oE '^[0-9]+\. [^ ]+' | awk '{print $2}' | while read -r k; do [ "$k" != "$KEY" ] && sign_cla "$k" done - sleep 10 + + if [ "$CLA_SENT" -eq 1 ]; then + wait_for_sequence_gte $((SEQ_BEFORE + 1)) + fi fi echo "" From c2501d54bb88e28db3143c5f90e310c48c0d92a9 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:07:53 -0400 Subject: [PATCH 04/13] fix(stress): add wait_for_package helper in stress/common.sh --- tests/samourai-crew/stress/common.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/samourai-crew/stress/common.sh diff --git a/tests/samourai-crew/stress/common.sh b/tests/samourai-crew/stress/common.sh new file mode 100644 index 0000000..517e23a --- /dev/null +++ b/tests/samourai-crew/stress/common.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Shared helpers for stress test scripts. +# REMOTE must be exported by the caller (run_tests.sh via env). + +# Poll vm/qeval until the package is accessible (max 30s). +# Non-fatal on timeout — the subsequent transactions will surface the real error. +wait_for_package() { + PKG="$1" + RETRIES=30 + printf " Waiting for package to be indexed ..." + while [ "$RETRIES" -gt 0 ]; do + if gnokey query "vm/qeval" -remote "$REMOTE" \ + -data "${PKG}.Render(\"\")" > /dev/null 2>&1; then + echo " ready" + return 0 + fi + RETRIES=$((RETRIES - 1)) + sleep 1 + done + echo " WARNING: timed out after 30s, continuing" + return 0 +} From 2dec8460cceba7f4e258e38e952228d4cc393e8d Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:08:27 -0400 Subject: [PATCH 05/13] fix(stress): wait for package indexing before launching txs in sybil_chaos --- tests/samourai-crew/stress/sybil_chaos.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/samourai-crew/stress/sybil_chaos.sh b/tests/samourai-crew/stress/sybil_chaos.sh index 6485d17..f3b8eb1 100755 --- a/tests/samourai-crew/stress/sybil_chaos.sh +++ b/tests/samourai-crew/stress/sybil_chaos.sh @@ -7,6 +7,8 @@ # stress_1 (=KEY), stress_2, stress_3 keys imported in GNOKEY_HOME SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +# shellcheck source=common.sh +. "$SCRIPT_DIR/common.sh" TX_PER_ACCOUNT="${TX_PER_ACCOUNT:-10}" SUFFIX=$(date +%s) COUNTER_PKGPATH="gno.land/r/${KEY_ADDR}/stress/chaos${SUFFIX}" @@ -38,6 +40,7 @@ echo "$PASSWORD" | gnokey maketx addpkg \ -broadcast -chainid "$CHAINID" -remote "$REMOTE" \ -insecure-password-stdin=true -home "$GNOKEY_HOME" \ "$KEY" > /dev/null || { echo "FAIL: could not deploy counter"; exit 1; } +wait_for_package "$COUNTER_PKGPATH" cat > "$TMPDIR/increment.gno" << EOF package main From ec19ba81718fc5138543ebd67b43fdb5554de78a Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:09:31 -0400 Subject: [PATCH 06/13] fix(stress): wait for package indexing before launching txs in sybil_precision --- tests/samourai-crew/stress/sybil_precision.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/samourai-crew/stress/sybil_precision.sh b/tests/samourai-crew/stress/sybil_precision.sh index d183d83..d4c2f2c 100644 --- a/tests/samourai-crew/stress/sybil_precision.sh +++ b/tests/samourai-crew/stress/sybil_precision.sh @@ -3,6 +3,8 @@ # sends txs sequentially with a small delay. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +# shellcheck source=common.sh +. "$SCRIPT_DIR/common.sh" TX_PER_ACCOUNT="${TX_PER_ACCOUNT:-10}" TX_DELAY="${TX_DELAY:-0.8}" SUFFIX=$(date +%s) @@ -34,6 +36,7 @@ echo "$PASSWORD" | gnokey maketx addpkg \ -broadcast -chainid "$CHAINID" -remote "$REMOTE" \ -insecure-password-stdin=true -home "$GNOKEY_HOME" \ "$KEY" > /dev/null || { echo "FAIL: could not deploy counter"; exit 1; } +wait_for_package "$COUNTER_PKGPATH" cat > "$TMPDIR/increment.gno" << EOF package main From 8db07e62d51195d6c2b32e8b482fbf98e43cca41 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:10:08 -0400 Subject: [PATCH 07/13] fix(stress): wait for package indexing before launching txs in sybil_salted_chaos --- tests/samourai-crew/stress/sybil_salted_chaos.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/samourai-crew/stress/sybil_salted_chaos.sh b/tests/samourai-crew/stress/sybil_salted_chaos.sh index 14a4abb..b9f42c4 100755 --- a/tests/samourai-crew/stress/sybil_salted_chaos.sh +++ b/tests/samourai-crew/stress/sybil_salted_chaos.sh @@ -3,6 +3,8 @@ # salt per tx to prevent transaction deduplication. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +# shellcheck source=common.sh +. "$SCRIPT_DIR/common.sh" TX_PER_ACCOUNT="${TX_PER_ACCOUNT:-10}" SUFFIX=$(date +%s) COUNTER_PKGPATH="gno.land/r/${KEY_ADDR}/stress/salted${SUFFIX}" @@ -33,6 +35,7 @@ echo "$PASSWORD" | gnokey maketx addpkg \ -broadcast -chainid "$CHAINID" -remote "$REMOTE" \ -insecure-password-stdin=true -home "$GNOKEY_HOME" \ "$KEY" > /dev/null || { echo "FAIL: could not deploy counter"; exit 1; } +wait_for_package "$COUNTER_PKGPATH" cat > "$TMPDIR/increment.gno" << EOF package main From 7cbec9ce797b70d6f660bd66f36f7c6b9f99eb62 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:36:31 -0400 Subject: [PATCH 08/13] fix(stress): add get_sequence and wait_for_sequence_gte to stress/common.sh --- tests/samourai-crew/stress/common.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/samourai-crew/stress/common.sh b/tests/samourai-crew/stress/common.sh index 517e23a..0feec89 100644 --- a/tests/samourai-crew/stress/common.sh +++ b/tests/samourai-crew/stress/common.sh @@ -20,3 +20,31 @@ wait_for_package() { echo " WARNING: timed out after 30s, continuing" return 0 } + +# Return the current committed sequence for ADDR (empty string on error). +get_sequence() { + ADDR="$1" + gnokey query "auth/accounts/$ADDR" \ + -remote "$REMOTE" 2>/dev/null \ + | grep -oE '"sequence":"[0-9]+"' | grep -oE '[0-9]+$' +} + +# Poll auth/accounts until the account sequence for ADDR is >= EXPECTED (max 30s). +# Non-fatal on timeout — subsequent transactions will surface the real error. +wait_for_sequence_gte() { + ADDR="$1" + EXPECTED="$2" + RETRIES=30 + printf " Waiting for account sequence >= %s ..." "$EXPECTED" + while [ "$RETRIES" -gt 0 ]; do + CURR=$(get_sequence "$ADDR") + if [ -n "$CURR" ] && [ "$CURR" -ge "$EXPECTED" ]; then + echo " done (seq=$CURR)" + return 0 + fi + RETRIES=$((RETRIES - 1)) + sleep 1 + done + echo " WARNING: timed out waiting for sequence >= $EXPECTED, continuing" + return 0 +} From da69cc2c5aec5091b87211bea0f2c03cb4c7b7b9 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:37:40 -0400 Subject: [PATCH 09/13] fix(stress): wait for runner sequence after deploy in sybil_chaos --- tests/samourai-crew/stress/sybil_chaos.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/samourai-crew/stress/sybil_chaos.sh b/tests/samourai-crew/stress/sybil_chaos.sh index f3b8eb1..f91ed52 100755 --- a/tests/samourai-crew/stress/sybil_chaos.sh +++ b/tests/samourai-crew/stress/sybil_chaos.sh @@ -33,6 +33,8 @@ echo "" echo "Deploying counter realm..." cp "$SCRIPT_DIR/../realms/counter/counter.gno" "$TMPDIR/counter.gno" printf 'module = "%s"\ngno = "0.9"\n' "$COUNTER_PKGPATH" > "$TMPDIR/gnomod.toml" +SEQ_BEFORE=$(get_sequence "$KEY_ADDR") +SEQ_BEFORE="${SEQ_BEFORE:-0}" echo "$PASSWORD" | gnokey maketx addpkg \ -pkgpath "$COUNTER_PKGPATH" \ -pkgdir "$TMPDIR" \ @@ -41,6 +43,7 @@ echo "$PASSWORD" | gnokey maketx addpkg \ -insecure-password-stdin=true -home "$GNOKEY_HOME" \ "$KEY" > /dev/null || { echo "FAIL: could not deploy counter"; exit 1; } wait_for_package "$COUNTER_PKGPATH" +wait_for_sequence_gte "$KEY_ADDR" $((SEQ_BEFORE + 1)) cat > "$TMPDIR/increment.gno" << EOF package main From 9eea1876bf24478eaa8c57b1975b656b80d06b1c Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:37:40 -0400 Subject: [PATCH 10/13] fix(stress): wait for runner sequence after deploy in sybil_precision --- tests/samourai-crew/stress/sybil_precision.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/samourai-crew/stress/sybil_precision.sh b/tests/samourai-crew/stress/sybil_precision.sh index d4c2f2c..7bf2444 100644 --- a/tests/samourai-crew/stress/sybil_precision.sh +++ b/tests/samourai-crew/stress/sybil_precision.sh @@ -29,6 +29,8 @@ echo "" echo "Deploying counter realm..." cp "$SCRIPT_DIR/../realms/counter/counter.gno" "$TMPDIR/counter.gno" printf 'module = "%s"\ngno = "0.9"\n' "$COUNTER_PKGPATH" > "$TMPDIR/gnomod.toml" +SEQ_BEFORE=$(get_sequence "$KEY_ADDR") +SEQ_BEFORE="${SEQ_BEFORE:-0}" echo "$PASSWORD" | gnokey maketx addpkg \ -pkgpath "$COUNTER_PKGPATH" \ -pkgdir "$TMPDIR" \ @@ -37,6 +39,7 @@ echo "$PASSWORD" | gnokey maketx addpkg \ -insecure-password-stdin=true -home "$GNOKEY_HOME" \ "$KEY" > /dev/null || { echo "FAIL: could not deploy counter"; exit 1; } wait_for_package "$COUNTER_PKGPATH" +wait_for_sequence_gte "$KEY_ADDR" $((SEQ_BEFORE + 1)) cat > "$TMPDIR/increment.gno" << EOF package main From 2d9dd31bc2bf1df47c4bd5473d71f6356aeeab02 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 15:37:40 -0400 Subject: [PATCH 11/13] fix(stress): wait for runner sequence after deploy in sybil_salted_chaos --- tests/samourai-crew/stress/sybil_salted_chaos.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/samourai-crew/stress/sybil_salted_chaos.sh b/tests/samourai-crew/stress/sybil_salted_chaos.sh index b9f42c4..6e760ff 100755 --- a/tests/samourai-crew/stress/sybil_salted_chaos.sh +++ b/tests/samourai-crew/stress/sybil_salted_chaos.sh @@ -28,6 +28,8 @@ echo "" echo "Deploying counter realm..." cp "$SCRIPT_DIR/../realms/counter/counter.gno" "$TMPDIR/counter.gno" printf 'module = "%s"\ngno = "0.9"\n' "$COUNTER_PKGPATH" > "$TMPDIR/gnomod.toml" +SEQ_BEFORE=$(get_sequence "$KEY_ADDR") +SEQ_BEFORE="${SEQ_BEFORE:-0}" echo "$PASSWORD" | gnokey maketx addpkg \ -pkgpath "$COUNTER_PKGPATH" \ -pkgdir "$TMPDIR" \ @@ -36,6 +38,7 @@ echo "$PASSWORD" | gnokey maketx addpkg \ -insecure-password-stdin=true -home "$GNOKEY_HOME" \ "$KEY" > /dev/null || { echo "FAIL: could not deploy counter"; exit 1; } wait_for_package "$COUNTER_PKGPATH" +wait_for_sequence_gte "$KEY_ADDR" $((SEQ_BEFORE + 1)) cat > "$TMPDIR/increment.gno" << EOF package main From e340a8257b491cbdd53a49f55cdb4685d1a7fef8 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 16:23:43 -0400 Subject: [PATCH 12/13] fix(ci): broaden get_sequence regex to handle all gnokey auth/accounts formats --- tests/samourai-crew/run_tests.sh | 4 ++-- tests/samourai-crew/stress/common.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/samourai-crew/run_tests.sh b/tests/samourai-crew/run_tests.sh index c3974f9..c511551 100755 --- a/tests/samourai-crew/run_tests.sh +++ b/tests/samourai-crew/run_tests.sh @@ -28,7 +28,7 @@ wait_for_sequence_gte() { while [ "$RETRIES" -gt 0 ]; do CURR=$(gnokey query "auth/accounts/$KEY_ADDR" \ -remote "$REMOTE" 2>/dev/null \ - | grep -oE '"sequence":"[0-9]+"' | grep -oE '[0-9]+$') + | grep -oE '"sequence"[^,}0-9]*[0-9]+' | grep -oE '[0-9]+$') if [ -n "$CURR" ] && [ "$CURR" -ge "$EXPECTED" ]; then echo " done (seq=$CURR)" return 0 @@ -127,7 +127,7 @@ if [ -n "$CLA_HASH" ]; then echo "Signing CLA (hash: $CLA_HASH)..." SEQ_BEFORE=$(gnokey query "auth/accounts/$KEY_ADDR" \ -remote "$REMOTE" 2>/dev/null \ - | grep -oE '"sequence":"[0-9]+"' | grep -oE '[0-9]+$') + | grep -oE '"sequence"[^,}0-9]*[0-9]+' | grep -oE '[0-9]+$') SEQ_BEFORE="${SEQ_BEFORE:-0}" sign_cla "$KEY" diff --git a/tests/samourai-crew/stress/common.sh b/tests/samourai-crew/stress/common.sh index 0feec89..b77b882 100644 --- a/tests/samourai-crew/stress/common.sh +++ b/tests/samourai-crew/stress/common.sh @@ -22,11 +22,13 @@ wait_for_package() { } # Return the current committed sequence for ADDR (empty string on error). +# Handles both compact ("sequence":"5") and spaced ("sequence": "5") JSON, +# as well as integer values ("sequence": 5). get_sequence() { ADDR="$1" gnokey query "auth/accounts/$ADDR" \ -remote "$REMOTE" 2>/dev/null \ - | grep -oE '"sequence":"[0-9]+"' | grep -oE '[0-9]+$' + | grep -oE '"sequence"[^,}0-9]*[0-9]+' | grep -oE '[0-9]+$' } # Poll auth/accounts until the account sequence for ADDR is >= EXPECTED (max 30s). From 5461ff192523ce6123764781fb815ce8527ac14f Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 1 Jun 2026 16:49:35 -0400 Subject: [PATCH 13/13] =?UTF-8?q?fix(ci):=20address=20review=20=E2=80=94?= =?UTF-8?q?=20consistent=20wait=5Ffor=5Fsequence=5Fgte=20signature,=20CLA?= =?UTF-8?q?=5FSENT=20variable,=20narrow=20import=5Fkey=20error=20pattern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/samourai-crew/run_tests.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/samourai-crew/run_tests.sh b/tests/samourai-crew/run_tests.sh index c511551..ec9f596 100755 --- a/tests/samourai-crew/run_tests.sh +++ b/tests/samourai-crew/run_tests.sh @@ -19,14 +19,15 @@ export KEY="runner" export PASSWORD="runner1234" export KEY_ADDR="${RUNNER_ADDR}" -# Poll auth/accounts until the account sequence is >= EXPECTED. +# Poll auth/accounts until the account sequence for ADDR is >= EXPECTED. # Exits 0 (non-fatal) after 30s even if not reached — tests will surface the real error. wait_for_sequence_gte() { - EXPECTED="$1" + ADDR="$1" + EXPECTED="$2" RETRIES=30 printf " Waiting for account sequence >= %s ..." "$EXPECTED" while [ "$RETRIES" -gt 0 ]; do - CURR=$(gnokey query "auth/accounts/$KEY_ADDR" \ + CURR=$(gnokey query "auth/accounts/$ADDR" \ -remote "$REMOTE" 2>/dev/null \ | grep -oE '"sequence"[^,}0-9]*[0-9]+' | grep -oE '[0-9]+$') if [ -n "$CURR" ] && [ "$CURR" -ge "$EXPECTED" ]; then @@ -69,7 +70,7 @@ import_key() { -home "$GNOKEY_HOME" 2>&1) if echo "$OUT" | grep -qiE "already exists"; then echo "already exists, skipping" - elif echo "$OUT" | grep -qiE "error|failed|panic"; then + elif echo "$OUT" | grep -qiE "error:|failed to|panic"; then echo "FAILED" echo "$OUT" exit 1 @@ -112,10 +113,9 @@ sign_cla() { "$SIGNER_KEY" 2>&1) if echo "$OUT" | grep -q "OK!\|TX HASH"; then echo "signed" - return 1 # 1 = tx was sent, sequence incremented + CLA_SENT=1 elif echo "$OUT" | grep -qiE "already signed"; then echo "already signed" - return 0 # 0 = no tx sent, sequence unchanged else echo "ERROR" echo "$OUT" @@ -130,15 +130,15 @@ if [ -n "$CLA_HASH" ]; then | grep -oE '"sequence"[^,}0-9]*[0-9]+' | grep -oE '[0-9]+$') SEQ_BEFORE="${SEQ_BEFORE:-0}" + CLA_SENT=0 sign_cla "$KEY" - CLA_SENT=$? gnokey list -home "$GNOKEY_HOME" 2>/dev/null | grep -oE '^[0-9]+\. [^ ]+' | awk '{print $2}' | while read -r k; do [ "$k" != "$KEY" ] && sign_cla "$k" done if [ "$CLA_SENT" -eq 1 ]; then - wait_for_sequence_gte $((SEQ_BEFORE + 1)) + wait_for_sequence_gte "$KEY_ADDR" $((SEQ_BEFORE + 1)) fi fi echo ""