ops: harden v20r1 monitor (correct hyperliquid-testnet.xyz host, DNS-aware venue-truth probe, heartbeat-tail dedup)
This commit is contained in:
@@ -1,19 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# v20r1 monitor — sandbox ops helper (now repo-tracked: prod/ops/).
|
# v20r1 monitor — sandbox ops helper (repo-tracked: prod/ops/).
|
||||||
# Run anytime to snapshot: process, lease, heartbeat, FORCE_ENGAGE cadence,
|
# Run anytime to snapshot: process, lease, heartbeat, FORCE_ENGAGE cadence,
|
||||||
# and independent HL testnet truth (unsigned /info — same source of truth the
|
# and independent HL testnet truth (unsigned /info — the same host the kernel's
|
||||||
# kernel's HlVenueTruthSupplier uses). Testnet-only; reads only.
|
# HlVenueTruthSupplier reads: hl/venue_truth.py + hl/instrument_provider.py).
|
||||||
|
# Testnet-only; reads only. No system code/data is touched by this helper.
|
||||||
#
|
#
|
||||||
# Usage: /mnt/dolphinng5_predict/prod/ops/v20r1_monitor.sh (or from anywhere)
|
# Usage: /mnt/dolphinng5_predict/prod/ops/v20r1_monitor.sh (or from anywhere)
|
||||||
#
|
#
|
||||||
# NOTE: v20r1-specific constants (signer, spool, PIDs) are hardcoded; when a new
|
# NOTE: v20r1-specific constants (signer, spool, PIDs, HL host) are hardcoded;
|
||||||
# campaign boots, bump ADDR/SPOOL and the PID pair in section [1].
|
# when a new campaign boots, bump ADDR/LOG/PID_*. The HL host is the canonical
|
||||||
|
# testnet hostname from prod/hl/config.py resolve_urls() => 'api.hyperliquid-testnet.xyz'
|
||||||
|
# (liquid, NOT 'hyperlight'). A typo'd host resolves as NXDOMAIN and would
|
||||||
|
# silently block venue truth — see section [5] error handling below.
|
||||||
set -u
|
set -u
|
||||||
ADDR="0x6af790574E5E9EA067FB4Ce7458B429039cE3f96"
|
ADDR="0x6af790574E5E9EA067FB4Ce7458B429039cE3f96"
|
||||||
LOG="/root/dolphin_logs/uv_journal_runs/f13_terminal_slot_release_v20r1_20260826/runner.log"
|
LOG="/root/dolphin_logs/uv_journal_runs/f13_terminal_slot_release_v20r1_20260826/runner.log"
|
||||||
LEASE="/tmp/flight13_hl_testnet_single_writer.lock"
|
LEASE="/tmp/flight13_hl_testnet_single_writer.lock"
|
||||||
PID_WRAPPER=790059 # `timeout --signal=TERM 8h launch_flight13_testnet.sh`
|
PID_WRAPPER=790059 # `timeout --signal=TERM 8h launch_flight13_testnet.sh`
|
||||||
PID_KERNEL=790060 # `/root/uv-wt/f13-hl/.f13_boot.py`
|
PID_KERNEL=790060 # `/root/uv-wt/f13-hl/.f13_boot.py`
|
||||||
|
HL_API="https://api.hyperliquid-testnet.xyz/info" # canonical testnet host (liquid, not hyperlight)
|
||||||
|
|
||||||
echo "=== v20r1 @ $(date -u +%FT%TZ) ==="
|
echo "=== v20r1 @ $(date -u +%FT%TZ) ==="
|
||||||
|
|
||||||
@@ -23,22 +28,22 @@ ps -p "$PID_WRAPPER","$PID_KERNEL" -o pid,ppid,stat,etime,args 2>/dev/null || ec
|
|||||||
echo "[2] EXCLUSIVE-WRITER LEASE (${LEASE})"
|
echo "[2] EXCLUSIVE-WRITER LEASE (${LEASE})"
|
||||||
ls -la "$LEASE" 2>/dev/null && cat "$LEASE" 2>/dev/null || echo " !! lease file absent"
|
ls -la "$LEASE" 2>/dev/null && cat "$LEASE" 2>/dev/null || echo " !! lease file absent"
|
||||||
|
|
||||||
echo "[3] HEARTBEAT (runner.log tail — TPSL ticker + latest BAR)"
|
echo "[3] HEARTBEAT (runner.log tail — TPSL ticker + latest BAR; stale-metadata noise excluded here, surfaced in [6])"
|
||||||
tail -n 12 "$LOG" 2>/dev/null | grep -vE "RuntimeWarning|stddev|warnings.warn|c /= stddev|numpy" || echo " (log unreadable)"
|
tail -n 12 "$LOG" 2>/dev/null | grep -vE "RuntimeWarning|stddev|warnings.warn|c /= stddev|numpy|stale.*metadata" || echo " (log unreadable)"
|
||||||
|
|
||||||
echo "[4] FORCE_ENGAGE cadence (synthetic SHORT firehose)"
|
echo "[4] FORCE_ENGAGE cadence (synthetic SHORT firehose)"
|
||||||
printf ' synthetic-enter log lines: '; grep -c "FORCE_ENGAGE: SYNTHETIC ENTER" "$LOG" 2>/dev/null || echo 0
|
printf ' synthetic-enter log lines: '; grep -c "FORCE_ENGAGE: SYNTHETIC ENTER" "$LOG" 2>/dev/null || echo 0
|
||||||
grep "in_flight=" "$LOG" 2>/dev/null | tail -n 1 | sed 's/^/ last in_flight: /'
|
grep "in_flight=" "$LOG" 2>/dev/null | tail -n 1 | sed 's/^/ last in_flight: /'
|
||||||
|
|
||||||
echo "[5] INDEPENDENT HL TESTNET TRUTH (unsigned /info) — signer ${ADDR}"
|
echo "[5] INDEPENDENT HL TESTNET TRUTH (unsigned /info) — signer ${ADDR} @ ${HL_API}"
|
||||||
# Probe captures curl exit+http code separately from the body so a DNS/TLS
|
# Capture curl exit + HTTP code SEPARATELY from the body so a DNS/TLS failure
|
||||||
# outage (the current failure mode: api.hyperlight-testnet.xyz NXDOMAIN across
|
# prints UNREACHABLE — not a misleading JSON "Expecting value" parse error
|
||||||
# resolvers) is reported as UNREACHABLE — not a misleading JSON parse error.
|
# (which previously masked a bad hostname as a parse quirk).
|
||||||
_hl_info() { # $1 = HL /info type (openOrders | clearinghouseState | userFills | allMids)
|
_hl_info() { # $1 = HL /info type (openOrders | clearinghouseState | userFills | allMids)
|
||||||
local ef bf code rc
|
local ef bf code rc
|
||||||
ef=$(mktemp); bf=$(mktemp)
|
ef=$(mktemp); bf=$(mktemp)
|
||||||
code=$(curl -sS --max-time 12 -o "$bf" -w "%{http_code}" \
|
code=$(curl -sS --max-time 12 -o "$bf" -w "%{http_code}" \
|
||||||
-X POST https://api.hyperlight-testnet.xyz/info \
|
-X POST "$HL_API" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d "{\"type\":\"$1\",\"user\":\"$ADDR\"}" 2>"$ef"); rc=$?
|
-d "{\"type\":\"$1\",\"user\":\"$ADDR\"}" 2>"$ef"); rc=$?
|
||||||
if [ "$rc" -ne 0 ] || [ "${code:-000}" = "000" ]; then
|
if [ "$rc" -ne 0 ] || [ "${code:-000}" = "000" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user