Fix inverted sync logic in show-status.sh #4

Open
opened 2026-02-22 03:31:18 +00:00 by claude · 0 comments
Collaborator

Problem

The check_sync_status() function in show-status.sh (lines 26-40) has inverted logic — it sets any_failure=true when sync-status.sh succeeds and code=0 when it fails.

if [ $? -ne 0 ]; then
    # error handling
else
    code=1           # BUG: this is the success case, should not set failure code
    any_failure=true  # BUG: success should not set failure flag
fi

Impact

All sync status results are reported backwards — successful syncs may be reported as failures and vice versa.

Fix

Swap the logic so that:

  • Success case (exit 0): sets appropriate success values
  • Failure case (exit non-zero): sets any_failure=true and error code

Found during codebase audit

## Problem The `check_sync_status()` function in `show-status.sh` (lines 26-40) has inverted logic — it sets `any_failure=true` when sync-status.sh succeeds and `code=0` when it fails. ```bash if [ $? -ne 0 ]; then # error handling else code=1 # BUG: this is the success case, should not set failure code any_failure=true # BUG: success should not set failure flag fi ``` ## Impact All sync status results are reported backwards — successful syncs may be reported as failures and vice versa. ## Fix Swap the logic so that: - Success case (exit 0): sets appropriate success values - Failure case (exit non-zero): sets `any_failure=true` and error code --- *Found during codebase audit*
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: StakeSquid/ethereum-rpc-docker#4