Skip to content

Backport release/v6.7: Make the composite store router an atomic pointer - #4473

Merged
masih merged 2 commits into
release/v6.7from
backport-4470-to-release/v6.7
Oct 6, 2026
Merged

masih merged 2 commits into
release/v6.7from
backport-4470-to-release/v6.7

Conversation

@seidroid

@seidroid seidroid Bot commented Oct 6, 2026

Copy link
Copy Markdown

Backport of #4470 to release/v6.7.

`CompositeCommitStore` keeps its migration router in a plain field.
`SetWriteMode` replaces it when the write mode changes, while
child-store views handed out by `GetChildStoreByName` read it on every
call through a provider, and those accesses weren't synchronized.

The router now lives in an `atomic.Pointer` and every access goes
through `loadRouter` and `storeRouter`. A new test reads through a
cached child-store view across a `SetWriteMode` transition under
`-race`. Behaviour and the AppHash are unchanged.

(cherry picked from commit 77a50d6)
@cursor

cursor Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes concurrency around the migration router on the state-commit hot path during write-mode transitions; logic is mostly pointer swapping and atomic loads, but incorrect ordering could still affect reads mid-migration.

Overview
CompositeCommitStore now holds its migration router in an atomic.Pointer instead of a plain field, with loadRouter / storeRouter as the only way to read or install it. All read/write paths (Get, ApplyChangeSets, SetWriteMode, buildRouter, close/cleanup, etc.) go through those helpers so SetWriteMode can swap the router while cached GetChildStoreByName views still resolve the current router on each operation (via cs.loadRouter passed into NewRouterCommitKVStore).

Adds TestComposite_Auto_ChildStoreReadsDuringWriteModeSwitch (intended for -race) to assert a child-store Get keeps returning the right value while a concurrent SetWriteMode(MigrateEVM) runs. Existing tests are updated to assert router presence through loadRouter() instead of touching the field directly.

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

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedOct 6, 2026, 2:04 PM

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is a straight backport of #4470. It changes the composite store's router to an atomic.Pointer that is read and written only through loadRouter and storeRouter, so cached child-store views can read safely while SetWriteMode swaps the router. It adds a regression test that runs reads and a write-mode switch at the same time (meant for -race). Every former cs.router access is converted, sync/atomic is imported, the store is never copied by value, and the existing tests only change to call the new accessor.

Findings: 0 blocking | 0 non-blocking | 0 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • None at the file/PR level.

@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 60.72%. Comparing base (7de88f1) to head (67b7662).

Files with missing lines Patch % Lines
sei-db/state_db/sc/composite/store.go 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##           release/v6.7    #4473      +/-   ##
================================================
- Coverage         61.71%   60.72%   -0.99%     
================================================
  Files              2171     2075      -96     
  Lines            189923   178821   -11102     
================================================
- Hits             117206   108590    -8616     
+ Misses            61837    60243    -1594     
+ Partials          10880     9988     -892     
Flag Coverage Δ
sei-db 69.80% <ø> (ø)
sei-db-state-db ?
sei-db-state-db-pr 70.43% <95.00%> (?)

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

Files with missing lines Coverage Δ
sei-db/state_db/sc/composite/store.go 71.12% <95.00%> (+0.49%) ⬆️

... and 96 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.

@masih
masih merged commit cd793ec into release/v6.7 Oct 6, 2026
72 checks passed
@masih
masih deleted the backport-4470-to-release/v6.7 branch October 6, 2026 15:01
masih pushed a commit that referenced this pull request Oct 8, 2026
Systematic changelog re-generation for the v6.7.1 patch release.

Adds the PRs merged to `release/v6.7` since the v6.7.0 changelog
(#4443), as reported by `scripts/generate-changelog.sh release/v6.6
release/v6.7`:
- #4473 Backport `release/v6.7`: Make the composite store router an
atomic pointer
- #4465 Backport `release/v6.7`: fix(seidb): keep the memIAVL nonce when
state sync restores a mid-mig…
- #4445 Backport `release/v6.7`: Update v6.7 changelog in prep to cut
v6.7.0
- #4444 Bump version to v6.7.0 in prep for release

Only the `## v6.7` PR list changes, so the `backport release/v6.7`
cherry-pick applies cleanly (simulated with `git merge-tree` against
`origin/release/v6.7`).

Not included: #4474 (the `release/v6.7` backport of #4469), which is
still open. If it lands before the cut, this list needs regenerating.

Co-authored-by: Cursor <cursoragent@cursor.com>
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