cometbft statesync: fix rpc_servers/trust_height/trust_hash (underscore, not hyphen)

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) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 12:45:42 +00:00
parent e8dafa1383
commit 0df57827f2
2 changed files with 16 additions and 8 deletions

View File

@@ -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
}

View File

@@ -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
}