-
Notifications
You must be signed in to change notification settings - Fork 861
Composite State Store part 3: Read path implementation #2756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/evm-ss-database
Are you sure you want to change the base?
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
b437822 to
f5ac4df
Compare
7271005 to
7ef1b00
Compare
7ef1b00 to
906d2ed
Compare
f5ac4df to
2905e61
Compare
906d2ed to
851b64c
Compare
2905e61 to
cbe891a
Compare
851b64c to
3801df9
Compare
8e74734 to
f391eac
Compare
84547fe to
795dce9
Compare
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)
40f2a73 to
7c8c4b4
Compare
795dce9 to
c095ad2
Compare
| 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
| go func() { | ||
| defer wg.Done() | ||
| cosmosErr = s.cosmosStore.ApplyChangesetSync(version, changesets) | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
| go func() { | ||
| defer wg.Done() | ||
| evmErr = s.evmStore.ApplyChangesetParallel(version, evmChanges) | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
| go func() { | ||
| defer wg.Done() | ||
| cosmosErr = s.cosmosStore.ApplyChangesetAsync(version, changesets) | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
| go func() { | ||
| defer wg.Done() | ||
| evmErr = s.evmStore.ApplyChangesetParallel(version, evmChanges) | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
| go func() { | ||
| defer wg.Done() | ||
| cosmosErr = s.cosmosStore.Import(version, cosmosCh) | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
| go func() { | ||
| defer wg.Done() | ||
| cosmosErr = s.cosmosStore.RawImport(cosmosCh) | ||
| }() |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
Describe your changes and provide context
Testing performed to validate your change