From 0df57827f216e53e81683687b83e510e3c34369d Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Mon, 15 Jun 2026 12:45:42 +0000 Subject: [PATCH] cometbft statesync: fix rpc_servers/trust_height/trust_hash (underscore, not hyphen) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CometBFT config.toml uses underscore keys; the sed targeted hyphens (rpc-servers etc.) so they never matched -> rpc_servers stayed empty -> 'at least 2 RPC servers required, got 0'. Now section-anchored to [statesync] + [_-] tolerant. (This is also why sei never held chainhead — same hyphen bug in its bespoke init.) Co-Authored-By: Claude Opus 4.8 (1M context) --- cosmos/scripts/cometbft-common.sh | 12 ++++++++---- scripts/cometbft-common.sh | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cosmos/scripts/cometbft-common.sh b/cosmos/scripts/cometbft-common.sh index 52f6c5a9..ceb8ae45 100644 --- a/cosmos/scripts/cometbft-common.sh +++ b/cosmos/scripts/cometbft-common.sh @@ -179,9 +179,13 @@ ct_configure_statesync() { # second server defaults to the first (cometbft wants >=2 for light-client cross-check) echo "$_rpc" | grep -q ',' || _rpc="$_rpc,$_rpc" ct_log "statesync: enable trust_height=$_trust_h trust_hash=$_trust_hash" - sed -i.bak -E "s|^(enable[[:space:]]*=[[:space:]]*).*$|\1true| ; \ - s|^(rpc-servers[[:space:]]*=[[:space:]]*).*$|\1\"$_rpc\"| ; \ - s|^(trust-height[[:space:]]*=[[:space:]]*).*$|\1$_trust_h| ; \ - s|^(trust-hash[[:space:]]*=[[:space:]]*).*$|\1\"$_trust_hash\"|" "$_cfg" + # Patch ONLY the [statesync] section. CometBFT config.toml uses underscore keys + # (rpc_servers/trust_height/trust_hash); tolerate hyphen variants with [_-]. + sed -i.bak -E "/^\[statesync\]/,/^\[/{ + s|^([[:space:]]*enable[[:space:]]*=[[:space:]]*).*|\1true| + s|^([[:space:]]*rpc[_-]servers[[:space:]]*=[[:space:]]*).*|\1\"$_rpc\"| + s|^([[:space:]]*trust[_-]height[[:space:]]*=[[:space:]]*).*|\1$_trust_h| + s|^([[:space:]]*trust[_-]hash[[:space:]]*=[[:space:]]*).*|\1\"$_trust_hash\"| + }" "$_cfg" return 0 } diff --git a/scripts/cometbft-common.sh b/scripts/cometbft-common.sh index 52f6c5a9..ceb8ae45 100644 --- a/scripts/cometbft-common.sh +++ b/scripts/cometbft-common.sh @@ -179,9 +179,13 @@ ct_configure_statesync() { # second server defaults to the first (cometbft wants >=2 for light-client cross-check) echo "$_rpc" | grep -q ',' || _rpc="$_rpc,$_rpc" ct_log "statesync: enable trust_height=$_trust_h trust_hash=$_trust_hash" - sed -i.bak -E "s|^(enable[[:space:]]*=[[:space:]]*).*$|\1true| ; \ - s|^(rpc-servers[[:space:]]*=[[:space:]]*).*$|\1\"$_rpc\"| ; \ - s|^(trust-height[[:space:]]*=[[:space:]]*).*$|\1$_trust_h| ; \ - s|^(trust-hash[[:space:]]*=[[:space:]]*).*$|\1\"$_trust_hash\"|" "$_cfg" + # Patch ONLY the [statesync] section. CometBFT config.toml uses underscore keys + # (rpc_servers/trust_height/trust_hash); tolerate hyphen variants with [_-]. + sed -i.bak -E "/^\[statesync\]/,/^\[/{ + s|^([[:space:]]*enable[[:space:]]*=[[:space:]]*).*|\1true| + s|^([[:space:]]*rpc[_-]servers[[:space:]]*=[[:space:]]*).*|\1\"$_rpc\"| + s|^([[:space:]]*trust[_-]height[[:space:]]*=[[:space:]]*).*|\1$_trust_h| + s|^([[:space:]]*trust[_-]hash[[:space:]]*=[[:space:]]*).*|\1\"$_trust_hash\"| + }" "$_cfg" return 0 }