From 4e66528f5d2354a44d89872ffd1fc834a4f04094 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Sat, 16 May 2026 19:29:47 +0000 Subject: [PATCH 1/2] fix(docs/examples): propagate forge build failures in compile-solidity --- docs/examples/bootstrap.sh | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/examples/bootstrap.sh b/docs/examples/bootstrap.sh index c3d91f209838..d68454af8e65 100755 --- a/docs/examples/bootstrap.sh +++ b/docs/examples/bootstrap.sh @@ -96,20 +96,43 @@ function compile-solidity { mkdir -p "$OUTPUT_DIR" - # Compile using the local foundry.toml with proper remappings + # Compile using the local foundry.toml with proper remappings. + # forge fetches solc from binaries.soliditylang.org on first use; transient + # DNS/TLS failures there have caused silent partial builds (the loop kept going + # and compile-solidity returned success while an example's artifacts were never + # written). Track per-subdir failures and surface them so run_step retries. + local failed_subdirs=() ( cd "$SOLIDITY_DIR" for subdir in */; do if [ -d "$subdir" ] && ls "$subdir"/*.sol >/dev/null 2>&1; then local subdir_name=$(basename "$subdir") echo_stderr "Compiling $subdir_name..." - forge build \ - --contracts "$subdir" \ - --out "$OUTPUT_DIR/$subdir_name" \ - --no-cache + local attempt + for attempt in 1 2 3; do + if forge build \ + --contracts "$subdir" \ + --out "$OUTPUT_DIR/$subdir_name" \ + --no-cache; then + break + fi + if [ "$attempt" -lt 3 ]; then + echo_stderr "forge build for $subdir_name failed (attempt $attempt/3), retrying in $((attempt * 5))s..." + sleep $((attempt * 5)) + else + echo_stderr "ERROR: forge build for $subdir_name failed after 3 attempts" + echo "$subdir_name" >> "$OUTPUT_DIR/.failed" + fi + done fi done ) + if [ -f "$OUTPUT_DIR/.failed" ]; then + while IFS= read -r name; do failed_subdirs+=("$name"); done < "$OUTPUT_DIR/.failed" + rm -f "$OUTPUT_DIR/.failed" + echo_stderr "ERROR: Solidity compilation failed for: ${failed_subdirs[*]}" + return 1 + fi echo_stderr "Solidity artifacts written to $OUTPUT_DIR" } From ffb68c9a6f8b2ef113e5a269d56ebac18bf8fd59 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Sat, 16 May 2026 19:36:03 +0000 Subject: [PATCH 2/2] update PR #23346 --- docs/examples/bootstrap.sh | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/docs/examples/bootstrap.sh b/docs/examples/bootstrap.sh index d68454af8e65..c3ae9f6524b7 100755 --- a/docs/examples/bootstrap.sh +++ b/docs/examples/bootstrap.sh @@ -98,36 +98,24 @@ function compile-solidity { # Compile using the local foundry.toml with proper remappings. # forge fetches solc from binaries.soliditylang.org on first use; transient - # DNS/TLS failures there have caused silent partial builds (the loop kept going - # and compile-solidity returned success while an example's artifacts were never - # written). Track per-subdir failures and surface them so run_step retries. - local failed_subdirs=() + # DNS/TLS failures there have silently produced partial builds in CI (the loop + # kept going and compile-solidity returned success while an example's artifacts + # were never written). Wrap each forge build in ci3/retry and propagate any + # per-subdir failure so run_step retries the whole step. ( cd "$SOLIDITY_DIR" for subdir in */; do if [ -d "$subdir" ] && ls "$subdir"/*.sol >/dev/null 2>&1; then local subdir_name=$(basename "$subdir") echo_stderr "Compiling $subdir_name..." - local attempt - for attempt in 1 2 3; do - if forge build \ - --contracts "$subdir" \ - --out "$OUTPUT_DIR/$subdir_name" \ - --no-cache; then - break - fi - if [ "$attempt" -lt 3 ]; then - echo_stderr "forge build for $subdir_name failed (attempt $attempt/3), retrying in $((attempt * 5))s..." - sleep $((attempt * 5)) - else - echo_stderr "ERROR: forge build for $subdir_name failed after 3 attempts" - echo "$subdir_name" >> "$OUTPUT_DIR/.failed" - fi - done + if ! retry "forge build --contracts $subdir --out $OUTPUT_DIR/$subdir_name --no-cache"; then + echo "$subdir_name" >> "$OUTPUT_DIR/.failed" + fi fi done ) if [ -f "$OUTPUT_DIR/.failed" ]; then + local failed_subdirs=() while IFS= read -r name; do failed_subdirs+=("$name"); done < "$OUTPUT_DIR/.failed" rm -f "$OUTPUT_DIR/.failed" echo_stderr "ERROR: Solidity compilation failed for: ${failed_subdirs[*]}"