Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ type MemIAVLConfig struct {

type StateStoreConfig struct {
Enable bool `toml:"enable"`
EVMSSSplit bool `toml:"evm_ss_split"`
DBDirectory string `toml:"db_directory"`
Backend string `toml:"backend"`
AsyncWriteBuffer int `toml:"async_write_buffer"`
Expand Down
10 changes: 10 additions & 0 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ func applyFullOverrides(cfg *SeiConfig) {
cfg.API.GRPC.Enable = true
cfg.API.GRPCWeb.Enable = true
cfg.Storage.StateStore.Enable = true
// RPC/full nodes default to the split SS layout (EVM state in its own SS DB).
// Scoped here, not baseDefaults: only modes that run the SS store may set it,
// and per giga_store_migration.md the split is supported for RPC nodes only
// (validator/seed run no SS store; archive resets it below). A fresh node
// builds the split on bootstrap; an existing unsplit node adopts it only via a
// state-sync, so this default touches new nodes, not a migration path.
cfg.Storage.StateStore.EVMSSSplit = true
cfg.Storage.StateStore.KeepRecent = 100_000
cfg.Storage.StateCommit.AsyncCommitBuffer = 100
cfg.Chain.MinRetainBlocks = 100_000
Expand All @@ -309,6 +316,9 @@ func applyArchiveOverrides(cfg *SeiConfig) {

cfg.Storage.PruningStrategy = PruningNothing
cfg.Storage.StateStore.KeepRecent = 0
// Archive inherits full's overrides but the giga SS split is not supported for
// archive nodes yet (giga_store_migration.md: RPC nodes only), so reset it.
cfg.Storage.StateStore.EVMSSSplit = false
// Only MinRetainBlocks disables receipt pruning at runtime; the next two
// are emitted to document intent (see ReceiptStoreConfig).
cfg.Chain.MinRetainBlocks = 0
Expand Down
3 changes: 3 additions & 0 deletions enrichments.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ func DefaultEnrichments() map[string][]FieldOption {
"storage.state_store.enable": {
WithDescription("Enable SeiDB state-store for historical queries."),
},
"storage.state_store.evm_ss_split": {
WithDescription("Store EVM state in the SeiDB state-store (app.toml [state-store] evm-ss-split)."),
},
"storage.state_store.backend": {
WithDescription("State store backend: pebbledb, rocksdb."),
},
Expand Down
46 changes: 46 additions & 0 deletions io_write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,49 @@ func TestWriteConfigToDir_ReceiptStoreUsesRSBackend(t *testing.T) {
}
}
}

// TestWriteConfigToDir_EVMSSSplit guards the giga state-store default per mode: only
// the full/RPC mode renders app.toml [state-store] evm-ss-split=true (the one flag
// distinguishing a giga SS node from a plain one). validator/seed run no SS store and
// archive is unsupported, so all three omit the key entirely (omitempty) — leaving
// their rendered app.toml unchanged. The key is bare evm-ss-split, not ss-prefixed
// like its siblings, because the binary reads it unprefixed.
func TestWriteConfigToDir_EVMSSSplit(t *testing.T) {
readApp := func(home string) string {
b, err := os.ReadFile(filepath.Join(home, configDir, appTomlFile))
if err != nil {
t.Fatalf("ReadFile app.toml: %v", err)
}
return string(b)
}

// Mode matrix: full renders the split on; every other mode omits the key.
splitModes := map[NodeMode]bool{ModeFull: true}
for _, mode := range []NodeMode{ModeValidator, ModeSeed, ModeFull, ModeArchive} {
home := t.TempDir()
if err := WriteConfigToDir(DefaultForMode(mode), home); err != nil {
t.Fatalf("WriteConfigToDir(%s): %v", mode, err)
}
app := readApp(home)
switch {
case splitModes[mode]:
if !strings.Contains(app, "evm-ss-split = true") {
t.Errorf("%s: app.toml must render evm-ss-split = true", mode)
}
got, err := ReadConfigFromDir(home)
if err != nil {
t.Fatalf("ReadConfigFromDir(%s): %v", mode, err)
}
if !got.Storage.StateStore.EVMSSSplit {
t.Errorf("%s round-trip: state_store.evm_ss_split got false, want true", mode)
}
default:
if strings.Contains(app, "evm-ss-split") {
t.Errorf("%s: must omit evm-ss-split (mode runs no split SS store), but the key is present", mode)
}
}
if strings.Contains(app, "ss-evm-ss-split") {
t.Errorf("%s: evm-ss-split must be the bare key, not ss-evm-ss-split — the binary reads it unprefixed", mode)
}
}
}
9 changes: 8 additions & 1 deletion legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,12 @@ type legacyStateCommit struct {
}

type legacyStateStore struct {
Enable bool `toml:"ss-enable"`
Enable bool `toml:"ss-enable"`
// evm-ss-split is bare, NOT ss-prefixed — the binary reads it unprefixed
// under [state-store]. Do not add the ss- prefix (cf. rs-backend below).
// omitempty so a false value omits the key: an existing (v2) node's app.toml
// stays unchanged; only a node with the split on emits evm-ss-split = true.
EVMSSSplit bool `toml:"evm-ss-split,omitempty"`
DBDirectory string `toml:"ss-db-directory"`
Backend string `toml:"ss-backend"`
AsyncWriteBuffer int `toml:"ss-async-write-buffer"`
Expand Down Expand Up @@ -589,6 +594,7 @@ func (cfg *SeiConfig) toLegacyApp() legacyAppConfig {

StateStore: legacyStateStore{
Enable: cfg.Storage.StateStore.Enable,
EVMSSSplit: cfg.Storage.StateStore.EVMSSSplit,
DBDirectory: cfg.Storage.StateStore.DBDirectory,
Backend: cfg.Storage.StateStore.Backend,
AsyncWriteBuffer: cfg.Storage.StateStore.AsyncWriteBuffer,
Expand Down Expand Up @@ -852,6 +858,7 @@ func fromLegacy(tm legacyTendermintConfig, app legacyAppConfig) *SeiConfig {
},
StateStore: StateStoreConfig{
Enable: app.StateStore.Enable,
EVMSSSplit: app.StateStore.EVMSSSplit,
DBDirectory: app.StateStore.DBDirectory,
Backend: app.StateStore.Backend,
AsyncWriteBuffer: app.StateStore.AsyncWriteBuffer,
Expand Down
4 changes: 4 additions & 0 deletions validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ func validateStorage(r *ValidationResult, cfg *SeiConfig) {
r.addWarning("storage.state_store.backend", fmt.Sprintf(
"unusual backend %q; expected pebbledb or rocksdb", ss.Backend))
}
if ss.EVMSSSplit && !ss.Enable {
r.addError("storage.state_store.evm_ss_split",
"evm_ss_split requires state_store.enable=true (the split routes EVM state into the state store)")
}
}

func validateEVM(r *ValidationResult, cfg *SeiConfig) {
Expand Down
Loading