Skip to content

Commit dfe3ce7

Browse files
fix(ci): retry L1 archive RPC call in print-pinned-block-number (ethereum-optimism#19421)
* fix(ci): retry L1 archive RPC call in print-pinned-block-number The L1 archive RPC endpoint (ci-mainnet-l1-archive.optimism.io) returns transient 5xx errors occasionally, killing all contracts-bedrock-coverage and contracts-bedrock-tests-upgrade CI jobs simultaneously (5+ jobs fail from a single 30-second outage). Adding 3 retries with a 5s delay makes the step resilient to brief outages with minimal wall-clock cost. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ci): use exponential backoff in print-pinned-block-number retry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: smartcontracts <smartcontracts@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ee28d5a commit dfe3ce7

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

packages/contracts-bedrock/justfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ test-dev *ARGS: build-go-ffi
9494

9595
# Calculates and prints the pinned block number for the current ETH_RPC_URL.
9696
# Uses the most recent Sunday at 00:00 UTC as the target timestamp.
97+
# Retries up to 3 times with a 5-second delay to handle transient RPC failures.
9798
print-pinned-block-number:
9899
#!/usr/bin/env bash
99100
set -euo pipefail
@@ -103,7 +104,19 @@ print-pinned-block-number:
103104
h=$(date -u +%H); m=$(date -u +%M); s=$(date -u +%S)
104105
secs_since_midnight=$(( 10#$h * 3600 + 10#$m * 60 + 10#$s ))
105106
sunday_midnight=$(( now - secs_since_midnight - dow * 86400 ))
106-
cast find-block "$sunday_midnight" --rpc-url $ETH_RPC_URL
107+
delay=5
108+
for attempt in 1 2 3; do
109+
if cast find-block "$sunday_midnight" --rpc-url $ETH_RPC_URL; then
110+
exit 0
111+
fi
112+
if [ "$attempt" -lt 3 ]; then
113+
echo "Attempt $attempt failed, retrying in ${delay}s..." >&2
114+
sleep "$delay"
115+
delay=$(( delay * 2 ))
116+
fi
117+
done
118+
echo "All attempts to fetch pinned block number failed" >&2
119+
exit 1
107120
108121
# Prepares the environment for upgrade path variant of contract tests and coverage.
109122
# Env Vars:

0 commit comments

Comments
 (0)