cometbft: WS Upgrade matcher case-insensitive + ct_ensure_wasm + statesync-skip-if-data

Per cursor cosmos handoff. (1) Traefik WS router rule Headers(Upgrade,websocket) is
case-SENSITIVE -> clients sending 'Upgrade: WebSocket' (python websocket-client) fall
through to the RPC router (200/400 not 101). rpc-client.yml now emits
HeadersRegexp(Upgrade,(?i)websocket) for all split-WS chains; regenerated cosmos+avalanche.
(2) Refactor into cometbft-common.sh: ct_configure_statesync skips if data/application.db
exists; new ct_ensure_wasm seeds CosmWasm/IBC-08 wasm (statesync omits them). init.sh calls
both. README documents wasm/version/WS gotchas. 45 other split-WS composes get HeadersRegexp
on their next regen.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-16 03:27:19 +00:00
parent c07fb81a56
commit ad56365253
15 changed files with 107 additions and 45 deletions

View File

@@ -37,29 +37,8 @@ ct_patch_p2p "$CONFIG_DIR/config.toml" "$IP" "${P2P_PORT:-26656}"
ct_merge_seeds "$CONFIG_DIR/config.toml" "$SEEDS"
ct_set_persistent_peers "$CONFIG_DIR/config.toml" "$PERSISTENT_PEERS"
ct_set_moniker "$CONFIG_DIR/config.toml" "$MONIKER"
# Statesync ONLY on a fresh node. If application state already exists (a restored snapshot
# or prior sync), do NOT re-arm statesync — it would try to re-restore and, because statesync
# omits the CosmWasm + IBC 08-wasm blobs, the node panics at startup
# ("wasmlckeeper failed initialize pinned codes / Error opening Wasm file").
if [ -e "$HOME_DIR/data/application.db" ]; then
ct_log "statesync: existing data dir, skipping"
else
ct_configure_statesync "$CONFIG_DIR/config.toml" "$STATESYNC_RPC"
# statesync restores IAVL state but NOT the wasm files gaia needs at startup. Seed them
# from the wasm-only snapshot (best-effort; the fully robust alternative for wasm chains is
# a full snapshot restore). Extracts wasm/ (CosmWasm) + the IBC 08-light-client wasm.
if [ -n "$WASM_SNAPSHOT_URL" ] && { [ ! -d "$HOME_DIR/wasm" ] || [ -z "$(ls -A "$HOME_DIR/wasm" 2>/dev/null)" ]; }; then
ct_log "fetching wasm snapshot $WASM_SNAPSHOT_URL"
ct_apk lz4 tar
if curl -sL "$WASM_SNAPSHOT_URL" | lz4 -dc | tar -xf - -C "$HOME_DIR"; then
ct_log "wasm snapshot extracted into $HOME_DIR"
else
ct_log "WARN wasm snapshot fetch/extract failed"
fi
fi
fi
ct_configure_statesync "$CONFIG_DIR/config.toml" "$STATESYNC_RPC" # internally skips if data/application.db exists
ct_ensure_wasm "$HOME_DIR" "$WASM_SNAPSHOT_URL" # seeds CosmWasm/IBC-08 wasm if missing (statesync omits them)
ct_seed_priv_validator_state "$HOME_DIR"
exec gaiad start --home "$HOME_DIR" --minimum-gas-prices "$MIN_GAS" "$@"