From 2550c828264bcf5b07e350a6e487c593da876622 Mon Sep 17 00:00:00 2001 From: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> Date: Mon, 24 Aug 2026 20:01:26 +0530 Subject: [PATCH] fix: fix(scripts): retry get_org after deploy_treasury in verify.sh - scripts/verify.sh: poll get_org up to 6 times with 2s backoff after deploy Fixes #5 Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> --- scripts/verify.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/verify.sh b/scripts/verify.sh index 25f60d9..45b0dc7 100644 --- a/scripts/verify.sh +++ b/scripts/verify.sh @@ -75,13 +75,27 @@ if [ "${1:-}" = "deploy-treasury" ]; then echo "Deployed org id: ${ORG_ID}" echo "=== Org record ===" - stellar contract invoke \ - --id "${FACTORY_ADDRESS}" \ - --source-account "${DEPLOYER}" \ - --network "${NETWORK}" \ - -- \ - get_org \ - --org_id "${ORG_ID}" + # deploy_treasury and get_org are separate RPC round-trips; on a slow testnet the + # read can race deploy propagation and return OrgNotFound. Poll briefly (#5). + ORG_READ_OK=0 + for attempt in 1 2 3 4 5 6; do + if stellar contract invoke \ + --id "${FACTORY_ADDRESS}" \ + --source-account "${DEPLOYER}" \ + --network "${NETWORK}" \ + -- \ + get_org \ + --org_id "${ORG_ID}"; then + ORG_READ_OK=1 + break + fi + echo "get_org attempt ${attempt} failed; retrying in 2s..." >&2 + sleep 2 + done + if [ "${ORG_READ_OK}" -ne 1 ]; then + echo "get_org failed after retries for org id ${ORG_ID}" >&2 + exit 1 + fi fi echo