diff --git a/.changeset/wise-grapes-try.md b/.changeset/wise-grapes-try.md new file mode 100644 index 00000000..9dc65fcd --- /dev/null +++ b/.changeset/wise-grapes-try.md @@ -0,0 +1,5 @@ +--- +"@cartesi/sdk": patch +--- + +eth_isready won't fail without a block number diff --git a/packages/sdk/eth_isready b/packages/sdk/eth_isready index f0c38958..8ab9ea23 100755 --- a/packages/sdk/eth_isready +++ b/packages/sdk/eth_isready @@ -1,10 +1,11 @@ #!/usr/bin/env sh -set -eu +set -euo pipefail RPC_URL="${RPC_URL:-http://127.0.0.1:8545}" +BLOCK_NUMBER=${1:-} # If a block number argument is provided, check that the chain has reached it -if [ -n "$1" ]; then +if [ -n "$BLOCK_NUMBER" ]; then current=$(cast block-number --rpc-url "$RPC_URL" 2>/dev/null) || exit 1 target=$(($1)) [ "$current" -ge "$target" ] && exit 0 || exit 1