- Institutional / JVMTM / reserve-provenance / GRU transport + standards JSON - Validation and verify scripts (Blockscout labels, x402, GRU preflight, P1 local path) - Wormhole wiring in AGENTS, MCP_SETUP, MASTER_INDEX, 04-configuration README - Meta docs, integration gaps, live verification log, architecture updates - CI validate-config workflow updates Operator/LAN items, submodule working trees, and public token-aggregation edge routes remain follow-up (see TODOS_CONSOLIDATED P1). Made-with: Cursor
104 lines
3.3 KiB
Bash
Executable File
104 lines
3.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Verify GRU Monetary Transport Layer runtime readiness via /api/v1/bridge/preflight.
|
|
# Usage: bash scripts/verify/check-gru-transport-preflight.sh [base_url]
|
|
# base_url: Optional API base, defaults to https://explorer.d-bis.org
|
|
#
|
|
# Exit codes:
|
|
# 0 = endpoint healthy and, unless ALLOW_BLOCKED=1, no blocked pairs remain
|
|
# 1 = endpoint unreachable, wrong payload, or blocked pairs remain
|
|
#
|
|
# Env:
|
|
# SKIP_EXIT=1 Print diagnostics but always exit 0
|
|
# ALLOW_BLOCKED=1 Treat blocked pairs as warnings instead of failures
|
|
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${1:-${BASE_URL:-https://explorer.d-bis.org}}"
|
|
BASE_URL="${BASE_URL%/}"
|
|
SKIP_EXIT="${SKIP_EXIT:-0}"
|
|
ALLOW_BLOCKED="${ALLOW_BLOCKED:-0}"
|
|
HAD_FAILURE=0
|
|
|
|
log() { printf '%s\n' "$*"; }
|
|
ok() { printf '[OK] %s\n' "$*"; }
|
|
warn() { printf '[WARN] %s\n' "$*"; }
|
|
fail() {
|
|
printf '[FAIL] %s\n' "$*"
|
|
HAD_FAILURE=1
|
|
if [[ "$SKIP_EXIT" != "1" ]]; then
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
tmp_body="$(mktemp)"
|
|
trap 'rm -f "$tmp_body"' EXIT
|
|
|
|
fetch_preflight() {
|
|
local prefix
|
|
for prefix in "" "/token-aggregation"; do
|
|
local url="${BASE_URL}${prefix}/api/v1/bridge/preflight"
|
|
local code
|
|
code="$(curl -sS -o "$tmp_body" -w "%{http_code}" -m 25 "$url" 2>/dev/null || echo "000")"
|
|
if [[ "$code" == "200" ]]; then
|
|
printf '%s\n' "$prefix"
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
log "=== GRU Transport preflight ==="
|
|
log "Base URL: $BASE_URL"
|
|
log ""
|
|
|
|
if ! prefix="$(fetch_preflight)"; then
|
|
fail "Could not fetch /api/v1/bridge/preflight on either /api/v1 or /token-aggregation/api/v1."
|
|
fi
|
|
|
|
if ! jq -e '
|
|
type == "object" and
|
|
(.gruTransport | type == "object") and
|
|
(.gruTransport.summary.transportPairs | type == "number") and
|
|
(.gruTransport.blockedPairs | type == "array") and
|
|
(.gruTransport.readyPairs | type == "array")
|
|
' "$tmp_body" >/dev/null 2>&1; then
|
|
summary="$(head -c 300 "$tmp_body" | tr '\n' ' ')"
|
|
fail "Unexpected /api/v1/bridge/preflight payload shape. Sample: $summary"
|
|
fi
|
|
|
|
transport_pairs="$(jq -r '.gruTransport.summary.transportPairs // 0' "$tmp_body")"
|
|
runtime_ready_pairs="$(jq -r '.gruTransport.summary.runtimeReadyTransportPairs // 0' "$tmp_body")"
|
|
blocked_pairs="$(jq -r '.gruTransport.blockedPairs | length' "$tmp_body")"
|
|
ready_pairs="$(jq -r '.gruTransport.readyPairs | length' "$tmp_body")"
|
|
|
|
display_path="${prefix}/api/v1/bridge/preflight"
|
|
if [[ -z "$prefix" ]]; then
|
|
display_path="/api/v1/bridge/preflight"
|
|
fi
|
|
ok "Preflight endpoint reachable at ${display_path}"
|
|
log "Transport pairs: $transport_pairs"
|
|
log "Runtime-ready pairs: $runtime_ready_pairs"
|
|
log "Ready pairs returned: $ready_pairs"
|
|
log "Blocked pairs returned: $blocked_pairs"
|
|
|
|
if (( blocked_pairs > 0 )); then
|
|
log ""
|
|
warn "Blocked GRU transport pairs:"
|
|
jq -r '
|
|
.gruTransport.blockedPairs[]
|
|
| "- \(.key): eligibilityBlockers=\(((.eligibilityBlockers // []) | join(",")) // "") runtimeMissingRequirements=\(((.runtimeMissingRequirements // []) | join(",")) // "")"
|
|
' "$tmp_body"
|
|
|
|
if [[ "$ALLOW_BLOCKED" != "1" ]]; then
|
|
fail "GRU transport preflight has blocked pairs. Set ALLOW_BLOCKED=1 for diagnostic-only mode."
|
|
else
|
|
warn "ALLOW_BLOCKED=1 set: blocked pairs reported without failing."
|
|
fi
|
|
else
|
|
ok "All active GRU transport pairs are runtime-ready."
|
|
fi
|
|
|
|
if [[ "$SKIP_EXIT" == "1" ]]; then
|
|
warn "SKIP_EXIT=1 set: diagnostic mode."
|
|
fi
|