Repository navigation
Conversation
…ans up (#17180) A 200 is not evidence of a node: when an attestation node's IP was repurposed for an SPA, every monitor kept reporting the host healthy forever. Add monitoring/node_probe.py, the single place that decides what 'up' means (up|degraded|impostor|down|unreachable), and wire all five monitors through it: - status/status_server.py state+error per node, impostor incident - health-dashboard/server.py NodeStatus.status carries the probe state - monitoring/rustchain-exporter.py node_health=0 on any failed scrape, new rustchain_last_successful_scrape_timestamp gauge - tools/node_health_monitor.py IMPOSTOR alert + table marker + state - tools/node-health-cli HealthStatus.state via shared probe Status page/dashboard render impostor distinctly from up. Tests: tests/test_node_liveness_body_validation.py covers genuine body, HTML-200 SPA, keyless JSON, ok:false, HTTP 500 and timeout per monitor.
Contributor
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
Contributor
|
This PR is quite large (XL). Consider splitting into smaller, focused PRs for faster review. Large PRs take longer to review and have higher risk of issues. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (Scottcjn/rustchain-bounties#17180)
An attestation node's IP was repurposed for an unrelated single-page app. The SPA answers HTTP 200 with HTML on every path, and all five monitors decided health from the status code alone — so a host that is not a RustChain node anymore kept reporting
upforever (fleet believed at 4 nodes when it was 2).Fix
One shared body validator,
monitoring/node_probe.py(stdlib-only, py3.9+), becomes the only place a monitor decides what "up" means:upok/version/uptime_s, or epoch keys on/epoch)degradedok:false,db_rw:false, or stale tipimpostordownunreachableAll five monitors now route through it (single shared copy, imported via a small
sys.pathbootstrap — no vendored drift):status/status_server.py— per-nodestate+error, impostor incident typehealth-dashboard/server.py—NodeStatus.statuscarries the probe state incl.impostormonitoring/rustchain-exporter.py—rustchain_node_health=0on any failed scrape (incl. crashed cycles), newrustchain_last_successful_scrape_timestampgaugetools/node_health_monitor.py— loudIMPOSTORalert,⚑ impostortable marker,statefield in JSON outputtools/node-health-cli/node_health.py—HealthStatus.statefrom the shared probeStatus page and dashboard visibly distinguish impostor from up (badge override + CSS + summary card; the existing asserted template line is preserved verbatim).
Tests
New
tests/test_node_liveness_body_validation.py(31 tests, runs in CI via existingpytest tests/job — no workflow changes) with recorded fixtures: genuine node body, HTML-200 SPA, keyless JSON,ok:false, HTTP 500, socket timeout. HTML-200 → impostor is asserted per monitor.Existing suites re-verified green:
tests/full run 1314 passed (only pre-existing missing-dependency failures locally), plushealth-dashboard/,monitoring/alerts/tests/,status/,tools/node-health-cli/, exporter tests.ruff checkclean on all touched files.Bonus: dashboard response-time measurement switched to
time.perf_counter()—test_check_node_health_measures_response_timewas flaky-failing on Windows clock granularity even before this PR.No production config changes, no new node endpoints.
Closes #17180 (bounty: 25 RTC)