Skip to content

Commit bc516eb

Browse files
bdchathamclaude
andcommitted
refactor: consolidate SnapshotGenerationOverrides, add storage/chain key constants
Merge StateSyncerOverrides into SnapshotGenerationOverrides since P2P capacity, pruning tightening, and snapshot creation are all part of what a snapshot-generating node needs. Remove pruning=nothing (that's an archive mode default, not a snapshot generation concern). Add exported Key constants for storage and chain override paths so consumers don't use raw strings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8bedcac commit bc516eb

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

config.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ func NodePortsForMode(mode NodeMode) []NodePort {
7070
}
7171
}
7272

73-
// Override key constants for P2P configuration fields.
73+
// Override key constants for the unified config schema.
7474
const (
75+
KeyPruningKeepRecent = "storage.pruning_keep_recent"
76+
KeyPruningKeepEvery = "storage.pruning_keep_every"
77+
KeySnapshotInterval = "storage.snapshot_interval"
78+
KeySnapshotKeepRecent = "storage.snapshot_keep_recent"
79+
KeyMinRetainBlocks = "chain.min_retain_blocks"
80+
7581
KeyP2PExternalAddress = "network.p2p.external_address"
7682
KeyP2PMaxConnections = "network.p2p.max_connections"
7783
KeyP2PSendRate = "network.p2p.send_rate"

defaults.go

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -309,24 +309,20 @@ func applyArchiveOverrides(cfg *SeiConfig) {
309309
cfg.Storage.StateCommit.MemIAVL.SnapshotMinTimeInterval = 20000
310310
}
311311

312-
// SnapshotGenerationOverrides returns the config overrides needed when a node
313-
// is configured to produce Tendermint state-sync snapshots. The controller
314-
// applies these as ConfigIntent.Overrides alongside the mode defaults.
312+
// SnapshotGenerationOverrides returns overrides for full-mode nodes that
313+
// generate CometBFT state-sync snapshots. Includes snapshot creation,
314+
// tighter pruning than the full-node default, and elevated P2P capacity
315+
// for serving snapshot chunks to peers.
315316
func SnapshotGenerationOverrides(keepRecent int32) map[string]string {
316317
return map[string]string{
317-
"storage.pruning": PruningNothing,
318-
"storage.snapshot_interval": strconv.FormatInt(DefaultSnapshotInterval, 10),
319-
"storage.snapshot_keep_recent": strconv.FormatInt(int64(keepRecent), 10),
320-
}
321-
}
322-
323-
// StateSyncerOverrides returns the config overrides for nodes acting as
324-
// state-sync snapshot servers.
325-
func StateSyncerOverrides() map[string]string {
326-
return map[string]string{
327-
KeyP2PMaxConnections: "500",
328-
KeyP2PSendRate: "20971520",
329-
KeyP2PRecvRate: "20971520",
318+
KeySnapshotInterval: strconv.FormatInt(DefaultSnapshotInterval, 10),
319+
KeySnapshotKeepRecent: strconv.FormatInt(int64(keepRecent), 10),
320+
KeyPruningKeepRecent: "50000",
321+
KeyPruningKeepEvery: "0",
322+
KeyMinRetainBlocks: "50000",
323+
KeyP2PMaxConnections: "500",
324+
KeyP2PSendRate: "20971520",
325+
KeyP2PRecvRate: "20971520",
330326
}
331327
}
332328

0 commit comments

Comments
 (0)