Skip to content

feat: v1→v2 config schema migration for seid v6.5 write mode rename#25

Merged
bdchatham merged 3 commits into
mainfrom
feat/v2-write-mode-migration
May 27, 2026
Merged

feat: v1→v2 config schema migration for seid v6.5 write mode rename#25
bdchatham merged 3 commits into
mainfrom
feat/v2-write-mode-migration

Conversation

@bdchatham

Copy link
Copy Markdown
Collaborator

Summary

Fixes #24. Unblocks all nightly chaos experiment validators currently crash-looping with invalid state-commit.sc-write-mode "cosmos_only".

What changed

types.go — v2 WriteMode constants matching sei-chain v6.5:

  • WriteModeMemiavlOnly = "memiavl_only" (new default)
  • Full FlatKV migration ladder: migrate_evm, evm_migrated, migrate_all_but_bank, all_migrated_but_bank, migrate_bank, flatkv_only, test_only_dual_write
  • Old constants kept as // Deprecated: for migration use; removed from IsValid()

defaults.goWriteMode: WriteModeCosmosOnly → WriteModeMemiavlOnly in both StateCommit and StateStore

config.goCurrentVersion: 1 → 2

migrate.go — v1→v2 migration: maps cosmos_only→memiavl_only, dual_write→migrate_evm, split_write→evm_migrated in both WriteMode fields. Adds SeidVersionForSchema map so each schema version is traceable to its seid version boundary:

v1seid < v6.5
v2seidv6.5

Note on ReadMode

ReadMode (sc-read-mode) was removed from sei-chain's StateCommitConfig in v6.5. The field is kept in sei-config for backward compat and will be silently ignored by seid. A follow-on migration can remove it when sei-config drops pre-v6.5 support.

🤖 Generated with Claude Code

seid v6.5 (sei-chain commit 0412e4e84) replaced the WriteMode enum to
model the FlatKV migration lifecycle. cosmos_only → memiavl_only is now
the breaking change that crashes any node provisioned with the old default.

Changes:
- types.go: add v2 WriteMode constants (memiavl_only, migrate_evm,
  evm_migrated, migrate_all_but_bank, all_migrated_but_bank,
  migrate_bank, flatkv_only, test_only_dual_write); update IsValid() to
  v2 values; keep v1 constants as Deprecated for migration reference
- defaults.go: change StateCommit and StateStore WriteMode defaults from
  WriteModeCosmosOnly → WriteModeMemiavlOnly
- config.go: bump CurrentVersion 1 → 2
- migrate.go: register v1→v2 migration (renames cosmos_only, dual_write,
  split_write in both StateCommit and StateStore WriteMode); add
  SeidVersionForSchema map so each schema version is traceable to its
  seid version boundary
- config_test.go: update TestWriteMode_Validity for v2 semantics

Fixes: #24

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@cursor

cursor Bot commented May 27, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes default and migrated storage write routing modes used at node startup; incorrect migration mapping could misconfigure SeiDB/FlatKV behavior across deploys.

Overview
Bumps the sei-config schema to v2 so configs align with seid ≥ v6.5 FlatKV write modes, fixing nodes that still emit or carry deprecated cosmos_only and fail validation at startup.

Write modes are redefined: new v2 constants (memiavl_only, full migration ladder through flatkv_only, test_only_dual_write) replace the old set in IsValid(); v1 names remain only as deprecated symbols for migration. Fresh defaults for state_commit and state_store write_mode switch from cosmos_only to memiavl_only.

A v1→v2 migration renames legacy values in both storage write fields (cosmos_onlymemiavl_only, dual_writemigrate_evm, split_writeevm_migrated), bumps version, and is covered by registry round-trip and rename tests. Validation now warns if test_only_dual_write is set on state commit.

Reviewed by Cursor Bugbot for commit 8dc28b5. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread migrate.go
bdchatham and others added 2 commits May 27, 2026 12:38
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- types.go: remove WriteModeEVMOnly — never a real deployed value, had
  no migration target (would fail IsValid() after migration)
- migrate.go: delete SeidVersionForSchema exported var (YAGNI — no
  programmatic consumer); fold version mapping into doc comment
- validate.go: add SeverityWarning for test_only_dual_write — valid per
  IsValid() to match seid's own parser, but explicitly flagged since
  sei-chain marks it "CRITICAL: never deploy to production"

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8dc28b5. Configure here.

Comment thread validate.go
@bdchatham bdchatham merged commit 705de11 into main May 27, 2026
3 checks passed
bdchatham added a commit to sei-protocol/seictl that referenced this pull request May 27, 2026
Picks up
[sei-config#25](sei-protocol/sei-config#25) —
v1→v2 write mode migration for seid v6.5.

**What changes:**
- Default `WriteMode` is now `memiavl_only` (was `cosmos_only`)
- Nodes with v1 configs (`cosmos_only`, `dual_write`, `split_write`) are
automatically migrated on startup via `DefaultMigrations()`

**Why:** The nightly seid image rejects `cosmos_only` with `invalid
state-commit.sc-write-mode "cosmos_only"`, crash-looping all 13 chaos
scenario validators. This fix makes the sidecar emit `memiavl_only` for
all new and migrated nodes.

All tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add v1→v2 config schema migration for sei-chain 6.5 write mode rename

1 participant