Skip to content

feat: add node status helpers for package healthchecks - #12

Merged
3alpha merged 2 commits into
mainfrom
feat/node-status-report
Nov 30, 2026
Merged

3alpha merged 2 commits into
mainfrom
feat/node-status-report

Conversation

@3alpha

@3alpha 3alpha commented Nov 30, 2026

Copy link
Copy Markdown
Member

Context

Node packages will report what their client is doing through their Docker healthcheck, as one small JSON line (a "status report"). The dappmanager reads it from Docker's health log and uses it for the phase and percentage on the dashboard, while deciding by itself whether the node is synced. The dappmanager side is in dappnode/DNP_DAPPMANAGER#2520.

Each execution client package holds its own client-specific script. This PR adds the shared helpers those scripts use, so five packages don't each re-implement JSON-RPC calls, Prometheus parsing and report printing.

Approach

  • scripts/node_status_tools.sh: a POSIX sh library that only defines functions and needs only curl and jq (1.6 or later).
    • ns_rpc <method> [params]: JSON-RPC call to 127.0.0.1:${NS_RPC_PORT:-8545} with a short timeout; prints the result.
    • ns_http_get <url>: GET for local URLs only.
    • ns_metric <name> [label=value ...]: value of a Prometheus sample read from stdin.
    • ns_hex_to_dec, ns_json_get, ns_block_head: small conversions and the latest block.
    • ns_emit <state> [key=value ...]: prints the report as one JSON line, drops empty or invalid values, enforces the length limits and the 2,048 byte cap, and returns 0 for starting, syncing and synced.
  • test/node_status_tools_test.sh: plain sh tests with a stubbed curl.
  • .github/workflows/test.yml: runs the tests on pull requests under dash and in Alpine (busybox ash).
  • README: a section with the function reference and a worked healthcheck example.

The release workflow needs no change: it already publishes every file in scripts/ and appends common_tools.sh to each. A test sources the combined file to confirm there are no name clashes.

Release

The five execution client packages pin STAKER_SCRIPTS_VERSION: v0.1.3 in their PRs, so this needs to be released as v0.1.3 before their images can build.

Test instructions

  • sh test/node_status_tools_test.sh (130 checks). Passes under dash, busybox ash (Alpine, jq 1.8) and Debian bookworm with jq 1.6.
  • shellcheck (-s sh) is clean.

Not tested against a live client here; the package PRs do that.

Shared shell helpers for the healthcheck scripts that print a node's
status report: JSON-RPC calls, Prometheus metric lookup and report
printing with the contract's limits.
Comment thread .github/workflows/test.yml Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants