Skip to content

bug(scripts): arc-check.sh reports unreachable data as healthy and aborts on nodes without the admin namespace #363

Description

@yzwooyi

scripts/arc-check.sh is the operator-facing diagnostic for a consensus node. Four cases make it report a problem as "ok", or abort the report before the useful sections run. All reproduced against a mock of the CL/EL RPC shapes in crates/malachite-app/src/rpc/{types,handlers}.rs.

1. --el node without the admin namespace: prints Connected: 0 peers, then the whole report aborts

admin_peers on an EL node with the admin namespace disabled returns HTTP 200 with a JSON-RPC error body. The script does .result | length (jq gives 0 for null), prints Connected: 0 peers, then .result[] fails with jq: error: Cannot iterate over null and, under set -euo pipefail, the script exits 5 before the Proposal History section. A transport failure to the optional --el endpoint likewise calls die, killing the mandatory sections after it.

2. Heights whose /proposal-monitor lookup fails are silently counted as successful

Line 218 || continue skips 404/400/timeouts, but total_checked still includes them, so with 49 of 50 heights unavailable the script still prints All 50 proposals decided successfully: yes.

3. Non-validator nodes get a red fault

A node that is not in the validator set (a follower / full node — the normal mainnet operator case) is told Proposed 0/50 blocks — never selected as proposer in red. That is expected behaviour, not a fault; the Identity section already says In Validator Set: no.

4. Progress bar off-by-one at 0 % / 100 %

$(printf '#%.0s' $(seq 1 "$filled")) with filled=0: GNU seq 1 0 prints nothing so printf still emits one #; BSD/macOS seq 1 0 prints 1 0 so it emits two. Symmetric for empty at 100 %. Verified on macOS: printf '[%s]' "$(printf '#%.0s' $(seq 1 0))"[##].

Proposed fix

  • --el section warns and continues (WARN: admin_peers unavailable: <message> (is the admin namespace enabled?)) instead of dying; only iterates .result when it is an array.
  • Track unavailable_count; verdicts only count heights actually fetched and say so (Proposal data unavailable for N/M heights (not counted)).
  • Nodes not in the validator set get not in validator set (expected for non-validator nodes) instead of the red verdict; the red verdict stays for in-set validators with 0 proposals.
  • Pad the bar with printf '%*s' N '' | tr ' ' '#' (no seq), guard total == 0.
  • Add scripts/test_arc_check.sh: self-contained bash test with an inline python mock of both RPCs; 8 of its 13 checks fail on the current script and all pass with the fix.

I have the fix ready and can open a PR referencing this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions