fix(noter): use the public endpoints and fail loudly when scans stop (#1)

The bot pointed at the block-producing nodes' RPC ports. Those bind to
localhost, so once they stopped being exposed to the internet the bot lost
every chain at once and has submitted nothing since. `staking_score` gates
the entire trust score, so a noter that cannot reach the chains does not
degrade the score — it zeroes it for every tracked account.

Point it at the public endpoints instead, which is what an external client
should use and what the code already defaulted to. They are TLS-terminated
rather than plaintext ws:// across the internet, and this drops a hardcoded
node address from the repository.

Reaching the chains again is not enough on its own: the outage lasted three
weeks because reconnecting forever looks identical to working. The bot now
writes a heartbeat when a scan *completes*, a container healthcheck reads it,
and a watchdog exits once it goes stale so the restart policy turns a silent
stall into a visibly crash-looping container.
This commit is contained in:
SatoshiQaziMuhammed authored and GitHub committed 2026-08-05 12:45:25 -07:00
1 parent 24fe8b6b6f
commit 676f2f7474
2 files changed
+66 -3

No files matched your search

+18 -3
View File
@@ -154,10 +154,25 @@ services:
- noter_mnemonic
environment:
TZ: UTC
RELAY_RPC: ws://217.77.6.126:9944
ASSET_HUB_RPC: ws://217.77.6.126:40944
PEOPLE_RPC: ws://217.77.6.126:41944
# The block-producing nodes bind their RPC to localhost by design — reaching
# them from here needed the ports open to the internet, and closing them (as
# they should be) silently cut this bot off from every chain. These are the
# public endpoints, which is what an external client is supposed to use, and
# they are TLS-terminated rather than plaintext ws:// across the internet.
RELAY_RPC: wss://rpc.pezkuwichain.io
ASSET_HUB_RPC: wss://asset-hub-rpc.pezkuwichain.io
PEOPLE_RPC: wss://people-rpc.pezkuwichain.io
SCAN_INTERVAL_MS: "300000"
# The bot writes a heartbeat when a scan completes, not when it merely stays
# up: an endless reconnect loop kept the container "Up" for three weeks while
# no staking data reached the People chain.
healthcheck:
test: ["CMD", "node", "-e", "const fs=require('fs');const i=parseInt(process.env.SCAN_INTERVAL_MS||'300000',10);let t=0;try{t=Number(fs.readFileSync(process.env.HEARTBEAT_FILE||'/tmp/noter-heartbeat','utf8'))}catch{};process.exit(Number.isFinite(t)&&Date.now()-t<i*3?0:1)"]
interval: 60s
timeout: 10s
retries: 3
# The first scan has to walk every tracked account before it can report.
start_period: 10m
payout-bot:
container_name: payout-pezkuwi