sync-status: dRPC-homogeneous block-lag status + fix never-used reference fallbacks
Match the dRPC gateway's per-chain "how many blocks behind is ok" model instead of a
fixed 2s/5s timestamp tolerance:
- check-health.sh: compare the reference head vs local head by BLOCK NUMBER and classify
with the chain's dRPC lag thresholds (LAGGING_LAG/SYNCING_LAG, in blocks, from
chains.yaml). dRPC uses the two thresholds inconsistently across chains (sometimes
lagging<syncing, sometimes the reverse) so the smaller is the online boundary and the
larger the syncing/drop boundary. Defaults 2/6 when a chain has no thresholds.
- multicurl.sh: also skip responses with result:null (a lagging endpoint lacking the
requested block) so the fallback reference URLs are actually tried. Previously the first
endpoint's {"result":null} was accepted as success -> fallbacks never ran, and the null
reference hash made check-health report false "forked" (the online/forked flapping).
- sync-status.sh: resolve the lag thresholds (by drpc slug or chain id) and export
LAGGING_LAG/SYNCING_LAG.
- reference-rpc-endpoint.sh: add --lags and --block-time-ms lookups.
- reference-rpc-endpoint.json: regenerated with per-chain block_time_ms + lagging_lag +
syncing_lag (additive).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -158,6 +158,24 @@ for path in $pathlist; do
|
||||
fi
|
||||
fi
|
||||
|
||||
# Per-chain dRPC lag thresholds (in blocks) so check-health.sh reports
|
||||
# online/lagging/syncing the same way the dRPC gateway does (homogeneous status).
|
||||
# Resolve by drpc slug first, then by chain id; empty => check-health uses its
|
||||
# built-in defaults.
|
||||
lags=""
|
||||
if [ -n "$chain_slug" ]; then
|
||||
lags=$($BASEPATH/reference-rpc-endpoint.sh --lags "$chain_slug" 2>/dev/null) || lags=""
|
||||
fi
|
||||
if [ -z "$lags" ] && [ -n "$chain_id_decimal" ]; then
|
||||
lags=$($BASEPATH/reference-rpc-endpoint.sh --lags "$chain_id_decimal" 2>/dev/null) || lags=""
|
||||
fi
|
||||
if [ -n "$lags" ]; then
|
||||
export LAGGING_LAG="${lags%% *}"
|
||||
export SYNCING_LAG="${lags##* }"
|
||||
else
|
||||
unset LAGGING_LAG SYNCING_LAG
|
||||
fi
|
||||
|
||||
# Call the health check script with RPC_URL, ref, and chain-type flag
|
||||
if $is_aztec; then
|
||||
$BASEPATH/check-health.sh "$RPC_URL" --aztec $ref
|
||||
|
||||
Reference in New Issue
Block a user