Skip to content

Composite State Store part 4: Dual-write path implementation#2757

Merged
Kbhat1 merged 0 commit intofeature/composite-ss-read-pathfrom
feature/composite-ss-write-path
Feb 3, 2026
Merged

Composite State Store part 4: Dual-write path implementation#2757
Kbhat1 merged 0 commit intofeature/composite-ss-read-pathfrom
feature/composite-ss-write-path

Conversation

@Kbhat1
Copy link
Contributor

@Kbhat1 Kbhat1 commented Jan 23, 2026

Describe your changes and provide context

  • ApplyChangesetSync / ApplyChangesetAsync: Parallel writes to both stores
  • EVM changes extracted via commonevm.ParseMemIAVLEVMKey
  • Import/RawImport: Fan out snapshot data to both stores
  • Idempotent writes: If either store fails, caller can safely retry

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

Comment on lines +392 to +396
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

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

Check notice

Code scanning / CodeQL

Spawning a Go routine

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

Check notice

Code scanning / CodeQL

Spawning a Go routine

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

Check notice

Code scanning / CodeQL

Spawning a Go routine

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

Check notice

Code scanning / CodeQL

Spawning a Go routine

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

Check notice

Code scanning / CodeQL

Spawning a Go routine

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

Check notice

Code scanning / CodeQL

Spawning a Go routine

Spawning a Go routine may be a possible source of non-determinism
@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/composite-ss-write-path branch from 90a80ae to 64dae4e Compare January 23, 2026 22:08
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.82%. Comparing base (e5ac7e8) to head (b3b7cd4).

Additional details and impacted files

Impacted file tree graph

@@                        Coverage Diff                         @@
##           feature/composite-ss-read-path    #2757      +/-   ##
==================================================================
+ Coverage                           47.80%   47.82%   +0.02%     
==================================================================
  Files                                 357      357              
  Lines                               34697    34697              
==================================================================
+ Hits                                16587    16594       +7     
+ Misses                              16533    16525       -8     
- Partials                             1577     1578       +1     
Flag Coverage Δ
sei-db 68.72% <ø> (ø)
sei-tendermint 47.54% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 14 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-write-path branch from 64dae4e to e732402 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/composite-ss-read-path branch from 2905e61 to cbe891a Compare January 28, 2026 02:36
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-write-path branch from e732402 to 42e19d3 Compare January 28, 2026 02:37
func (s *CompositeStateStore) ApplyChangesetSync(version int64, changesets []*proto.NamedChangeSet) error {
// TODO: Add dual-write to EVM_SS in next PR
return s.cosmosStore.ApplyChangesetSync(version, changesets)
// Fast path: if no EVM store, just apply to Cosmos
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't always wanna dual write, I feel it's better to have this controlled by a config or write mode in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually it might be fine to keep the current logic, ignore the previous comment, we can still have various configs for read and write strategy/mode, which would determine whether we set the store to nil or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed this, I can add this in after your PR with the writeMode goes in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was updated

@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from cbe891a to a05c51d Compare January 29, 2026 17:53
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-write-path branch from 42e19d3 to 4084fe1 Compare January 29, 2026 17:54
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from 9f95173 to c43d65d Compare January 29, 2026 20:56
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-write-path branch from 4055a6d to ae9502c Compare January 29, 2026 20:56
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from c43d65d to 1a93e59 Compare January 30, 2026 03:59
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-write-path branch 3 times, most recently from ca81638 to 8efe6df Compare January 30, 2026 05:21
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from 8e74734 to f391eac Compare January 30, 2026 05:30
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-write-path branch 4 times, most recently from bca19d0 to b3b7cd4 Compare February 2, 2026 15:58
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-write-path branch 2 times, most recently from ba26486 to d7bca53 Compare February 2, 2026 21:52
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from 84547fe to 795dce9 Compare February 2, 2026 21:53
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-write-path branch 2 times, most recently from eb51830 to 8e4dc3a Compare February 3, 2026 21:52
@Kbhat1 Kbhat1 merged commit 8e4dc3a into feature/composite-ss-read-path Feb 3, 2026
@Kbhat1 Kbhat1 force-pushed the feature/composite-ss-read-path branch from 795dce9 to c095ad2 Compare February 3, 2026 21:52
@Kbhat1 Kbhat1 deleted the feature/composite-ss-write-path branch February 3, 2026 21:52
@Kbhat1 Kbhat1 restored the feature/composite-ss-write-path branch February 4, 2026 20:34
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.

3 participants