Skip to content

Conversation

@Kbhat1
Copy link
Contributor

@Kbhat1 Kbhat1 commented Jan 23, 2026

Describe your changes and provide context

  • Adds CompositeStateStore with read path routing between Cosmos_SS and EVM_SS:
  • Get/Has: Check EVM_SS first for EVM keys, fallback to Cosmos_SS
  • Iterator/ReverseIterator: Use Cosmos_SS (source of truth)
  • Version methods delegate to Cosmos_SS

Testing performed to validate your change

  • Unit tests

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 3, 2026, 9:53 PM

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 34.84848% with 172 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.61%. Comparing base (7c8c4b4) to head (c095ad2).

Files with missing lines Patch % Lines
sei-db/state_db/ss/composite/store.go 32.36% 151 Missing and 12 partials ⚠️
app/seidb.go 58.33% 4 Missing and 1 partial ⚠️
sei-db/state_db/ss/store.go 66.66% 1 Missing and 1 partial ⚠️
sei-cosmos/storev2/rootmulti/store.go 0.00% 1 Missing ⚠️
tools/migration/sc/migrator.go 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (7c8c4b4) and HEAD (c095ad2). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (7c8c4b4) HEAD (c095ad2)
sei-tendermint 1 0
sei-cosmos 1 0
Additional details and impacted files

Impacted file tree graph

@@                     Coverage Diff                      @@
##           feature/evm-ss-database    #2756       +/-   ##
============================================================
- Coverage                    56.66%   41.61%   -15.05%     
============================================================
  Files                         2033     1925      -108     
  Lines                       166177   153234    -12943     
============================================================
- Hits                         94156    63762    -30394     
- Misses                       63762    83467    +19705     
+ Partials                      8259     6005     -2254     
Flag Coverage Δ
sei-chain 41.53% <34.84%> (-0.02%) ⬇️
sei-cosmos ?
sei-db 68.72% <ø> (ø)
sei-tendermint ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/config/ss_config.go 100.00% <100.00%> (ø)
sei-cosmos/storev2/rootmulti/store.go 26.96% <0.00%> (-14.89%) ⬇️
tools/migration/sc/migrator.go 0.00% <0.00%> (ø)
sei-db/state_db/ss/store.go 47.45% <66.66%> (+2.17%) ⬆️
app/seidb.go 76.11% <58.33%> (-4.24%) ⬇️
sei-db/state_db/ss/composite/store.go 32.36% <32.36%> (ø)

... and 724 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from b437822 to f5ac4df Compare January 23, 2026 22:08
@Kbhat1 Kbhat1 force-pushed the feature/evm-ss-database branch from 7271005 to 7ef1b00 Compare January 23, 2026 22:08
@Kbhat1 Kbhat1 force-pushed the feature/evm-ss-database branch from 7ef1b00 to 906d2ed Compare January 27, 2026 19:34
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from f5ac4df to 2905e61 Compare January 27, 2026 19:34
@Kbhat1 Kbhat1 force-pushed the feature/evm-ss-database branch from 906d2ed to 851b64c Compare January 28, 2026 02:35
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from 2905e61 to cbe891a Compare January 28, 2026 02:36
@Kbhat1 Kbhat1 force-pushed the feature/evm-ss-database branch from 851b64c to 3801df9 Compare January 29, 2026 17:53
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch 4 times, most recently from 8e74734 to f391eac Compare January 30, 2026 05:30
@Kbhat1 Kbhat1 requested a review from yzang2019 February 2, 2026 20:37
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from 84547fe to 795dce9 Compare February 2, 2026 21:53
Adds CompositeStateStore that routes reads between Cosmos_SS and EVM_SS:
- Get/Has: Check EVM_SS first for EVM keys, fallback to Cosmos_SS
- Iterator/ReverseIterator: Use Cosmos_SS (source of truth)
- Uses commonevm.ParseEVMKey directly for key parsing

Write methods delegate to Cosmos_SS only in this PR.
Full dual-write implementation in next PR.
…e directly

Use EVMStore.Get and EVMStore.Has instead of manually getting DB instances.
- Add EnableRead and EnableWrite flags to EVMStateStoreConfig
- Store config reference in CompositeStateStore
- Check EnableRead before reading from EVM store in Get/Has
Address review feedback: instead of passing a pre-created cosmosStore,
NewCompositeStateStore now takes both configs and initializes stores internally.

Changes:
- NewCompositeStateStore(ssConfig, evmConfig, homeDir, logger) signature
- Creates Cosmos store via mvcc.OpenDB() without separate pruning
- Creates EVM store if enabled
- Recovers from WAL on startup
- Starts pruning on composite store (prunes both Cosmos_SS and EVM_SS)
- Add StartPruning() and recoverFromWAL() helpers
Make NewStateStore transparently return CompositeStateStore when EVM is enabled.
This ensures all upstream callers (rootmulti, state sync, etc.) automatically
get the optimized EVM storage layer without code changes.

Changes:
- Add NewStateStoreWithEVM that routes through CompositeStateStore when EVM enabled
- Update rootmulti.NewStore to accept EVMStateStoreConfig parameter
- Add EVM SS config flags and parsing in app/seidb.go
- NewStateStore calls NewStateStoreWithEVM(nil) for backward compatibility
…teStore

Make ssConfig and evmConfig consistent - both are now value types
matching the convention used elsewhere in the repo.
The NewStore signature was updated to include EVMStateStoreConfig,
but the migration tool call site was not updated. Pass nil since
migrations don't need EVM optimization.
Implements full dual-write to both Cosmos_SS and EVM_SS:
- ApplyChangesetSync/Async: Write to both stores in parallel
- EVM changes extracted via commonevm.ParseEVMKey directly
- Import/RawImport: Fan out to both stores
- Idempotent writes: If either fails, caller can safely retry

No separate router abstraction - uses common utility directly.
Replace hardcoded 5 with evm.NumEVMStoreTypes for clarity and maintainability.
- Use WriteMode enum from config (cosmos_only, dual_write, split_write)
- Remove EnableRead/EnableWrite boolean fields
- Update ApplyChangeset to check WriteMode == CosmosOnlyWrite
- Update app/seidb.go flag parsing
- Add ReadMode field to control read routing (cosmos_only, evm_first, split_read)
- Check ReadMode in Get/Has before reading from EVM_SS
- Reuses ReadMode enum from config/read_mode.go (from PR 2786)
@Kbhat1 Kbhat1 force-pushed the feature/evm-ss-database branch from 40f2a73 to 7c8c4b4 Compare February 3, 2026 21:52
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from 795dce9 to c095ad2 Compare February 3, 2026 21:52
Comment on lines +474 to +478
for version, evmChanges := range evmChangesByVersion {
if err := s.evmStore.ApplyChangesetParallel(version, evmChanges); err != nil {
s.logger.Error("failed to raw import EVM data", "version", version, "error", err)
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +295 to +298
go func() {
defer wg.Done()
cosmosErr = s.cosmosStore.ApplyChangesetSync(version, changesets)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Comment on lines +302 to +305
go func() {
defer wg.Done()
evmErr = s.evmStore.ApplyChangesetParallel(version, evmChanges)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Comment on lines +336 to +339
go func() {
defer wg.Done()
cosmosErr = s.cosmosStore.ApplyChangesetAsync(version, changesets)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Comment on lines +343 to +346
go func() {
defer wg.Done()
evmErr = s.evmStore.ApplyChangesetParallel(version, evmChanges)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Comment on lines +398 to +401
go func() {
defer wg.Done()
cosmosErr = s.cosmosStore.Import(version, cosmosCh)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Comment on lines +447 to +450
go func() {
defer wg.Done()
cosmosErr = s.cosmosStore.RawImport(cosmosCh)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants