#!/usr/bin/env bash # Validate config/allmainnet-non-dodo-protocol-surface.json shape and internal consistency. # Usage: from repo root: bash scripts/verify/check-allmainnet-protocol-surface.sh set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" F="$PROJECT_ROOT/config/allmainnet-non-dodo-protocol-surface.json" if [[ ! -f "$F" ]]; then echo "[ERROR] Missing $F" exit 1 fi if ! command -v jq &>/dev/null; then echo "[ERROR] jq is required for ALL Mainnet surface validation" exit 1 fi jq -e ' (.chainId == 651940) and (.status | type == "string") and (.summary | type == "object") and (.summary.bridgeOnlyLive | type == "boolean") and (.summary.sameChainSwapInventoryPublished | type == "boolean") ' "$F" >/dev/null || { echo "[ERROR] allmainnet-non-dodo-protocol-surface.json: expected chainId 651940, status string, summary.bridgeOnlyLive and summary.sameChainSwapInventoryPublished booleans" exit 1 } PUBLISHED="$(jq -r '.summary.sameChainSwapInventoryPublished' "$F")" STATUS="$(jq -r '.status' "$F")" if [[ "$PUBLISHED" == "true" ]] && [[ "$STATUS" == "bridge_live_swap_inventory_pending" ]]; then echo "[ERROR] Inconsistent: summary.sameChainSwapInventoryPublished is true but status is still bridge_live_swap_inventory_pending (update status when promoting inventory)" exit 1 fi echo "[OK] allmainnet-non-dodo-protocol-surface.json OK (chainId, summary flags, publication vs status)" exit 0