ripple: deployable mainnet + testnet rippled with health checks
Fix mainnet rippled.cfg (ws,http RPC, port_peer 13331), strip eth-isms from x-upstreams, add testnet chain assets/compose, and wire --ripple sync-status via check-health.sh server_info probe. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,10 +10,11 @@ fi
|
||||
RPC_URL=$1
|
||||
shift
|
||||
|
||||
# Check for --starknet / --aztec / --cosmos flag
|
||||
# Check for --starknet / --aztec / --cosmos / --ripple flag
|
||||
is_starknet=false
|
||||
is_aztec=false
|
||||
is_cosmos=false
|
||||
is_ripple=false
|
||||
if [ "$1" == "--starknet" ]; then
|
||||
is_starknet=true
|
||||
shift
|
||||
@@ -23,6 +24,9 @@ elif [ "$1" == "--aztec" ]; then
|
||||
elif [ "$1" == "--cosmos" ]; then
|
||||
is_cosmos=true
|
||||
shift
|
||||
elif [ "$1" == "--ripple" ]; then
|
||||
is_ripple=true
|
||||
shift
|
||||
fi
|
||||
|
||||
REF=""
|
||||
@@ -59,6 +63,45 @@ if $is_cosmos; then
|
||||
echo "online"; exit 0
|
||||
fi
|
||||
|
||||
# XRPL rippled: server_info — server_state full/proposing + fresh validated ledger = online.
|
||||
# Short-circuits here; the EVM/starknet/aztec block-comparison path below is not used.
|
||||
if $is_ripple; then
|
||||
status=$(curl -L --ipv4 -m $timeout -s -X POST -H "Content-Type: application/json" --data '{"method":"server_info"}' "$RPC_URL")
|
||||
if [ $? -ne 0 ] || [ -z "$status" ]; then echo "error"; exit 1; fi
|
||||
server_state=$(echo "$status" | jq -r '.result.info.server_state // .info.server_state' 2>/dev/null)
|
||||
ledger_age=$(echo "$status" | jq -r '.result.info.validated_ledger.age // .info.validated_ledger.age' 2>/dev/null)
|
||||
node_seq=$(echo "$status" | jq -r '.result.info.validated_ledger.seq // .info.validated_ledger.seq' 2>/dev/null)
|
||||
if [ -z "$server_state" ] || [ "$server_state" = "null" ]; then echo "error"; exit 1; fi
|
||||
case "$server_state" in
|
||||
connected|syncing|tracking)
|
||||
echo "syncing"; exit 1 ;;
|
||||
full|proposing)
|
||||
;;
|
||||
*)
|
||||
echo "error"; exit 1 ;;
|
||||
esac
|
||||
if [ -z "$ledger_age" ] || [ "$ledger_age" = "null" ] || [ "$ledger_age" -gt 20 ] 2>/dev/null; then
|
||||
echo "behind"; exit 1
|
||||
fi
|
||||
if [ -n "$ref" ]; then
|
||||
ref_status=$($BASEPATH/multicurl.sh -L --ipv4 -m $timeout -s -X POST -H "Content-Type: application/json" --data '{"method":"server_info"}' $ref)
|
||||
ref_seq=$(echo "$ref_status" | jq -r '.result.info.validated_ledger.seq // .info.validated_ledger.seq' 2>/dev/null)
|
||||
if [ -n "$ref_seq" ] && [ "$ref_seq" != "null" ] && [ "$ref_seq" -gt 0 ] 2>/dev/null && [ -n "$node_seq" ] && [ "$node_seq" != "null" ]; then
|
||||
lag=$(( ref_seq - node_seq ))
|
||||
lo=${LAGGING_LAG:-5}; hi=${SYNCING_LAG:-10}
|
||||
if [ "$lo" -gt "$hi" ]; then tmp=$lo; lo=$hi; hi=$tmp; fi
|
||||
if [ "$lag" -le "$lo" ]; then
|
||||
echo "online"; exit 0
|
||||
elif [ "$lag" -le "$hi" ]; then
|
||||
echo "lagging"; exit 0
|
||||
else
|
||||
echo "syncing"; exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "online"; exit 0
|
||||
fi
|
||||
|
||||
response_file=$(mktemp)
|
||||
|
||||
# Use appropriate RPC method based on chain type
|
||||
|
||||
Reference in New Issue
Block a user