migration routers#3336
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 @@
## main #3336 +/- ##
==========================================
- Coverage 59.25% 59.07% -0.18%
==========================================
Files 2110 2106 -4
Lines 174181 173350 -831
==========================================
- Hits 103210 102409 -801
+ Misses 62044 61990 -54
- Partials 8927 8951 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 009bf03. Configure here.
| // Module names must be unique; NewRoute's validation rules apply. The | ||
| // returned Route may be passed to NewModuleRouter alongside other | ||
| // Routes to compose multi-database setups. | ||
| func (t *TestOnlyDualWriteRouter) BuildRoute(moduleNames ...string) (*Route, error) { // TODO LLM you need to write a unit test for this |
| } | ||
|
|
||
| // Sends evm/ traffic to both memIAVL and flatKV. | ||
| memiavlEvmRoute, err := routeToMemIAVL(memIAVL) |
There was a problem hiding this comment.
routeToMemIAVL(memIAVL) with no module args does not send evm traffic anywhere
There was a problem hiding this comment.
Klunky API, but functionally correct. I added the following comment:
// Note that a TestOnlyDualWriteRouter ignores module names; it's only job is to duplicate traffic.
// The routes given to the dual write router do not specifiy modules for this reason.
memiavlEvmRoute, err := routeToMemIAVL(memIAVL)
I did not want to modify the route API for this case, since this is a test-only workflow.
| @@ -0,0 +1,1059 @@ | |||
| package migration | |||
There was a problem hiding this comment.
not blocking: 1000+ lines testing file is a little to big. consider splitting by mode (memiavl_only_test.go, migrate_evm_test.go, evm_migrated_test.go, ...).
There was a problem hiding this comment.
Splitting by mode will result in a very large number of test files. I instead split into two test files: one for testing static routes, and another for testing non-static migration. This cuts the size of the file roughly in half.
Is this satisfactory from your perspective, or would you like additional splitting?

Describe your changes and provide context
Use the migration router primitives to construct the migration workflows we will need.
Use the following link to view the README in rendered form. Suggested read prior to reviewing code. https://github.com/sei-protocol/sei-chain/blob/cjl/migration-integration/sei-db/state_db/sc/migration/README.md
Testing performed to validate your change
unit tests
Note
High Risk
Adds and wires new state routing/migration modes (including migration-manager integration) that determine where reads/writes land across
memiavlandflatkv, so misrouting could corrupt state during migrations. Large new test coverage reduces risk but the changes touch core storage/migration paths.Overview
Introduces a centralized
BuildRouterinrouter_builder.gothat constructs per-WriteModeModuleRouterlayouts for all migration phases and steady states (V0MemiavlOnly, V1EVMMigrated, V2AllMigratedButBank, V3FlatKVOnly) and for in-flight migrations (MigrateEVM,MigrateAllButBank,MigrateBank) by wiringMigrationManagerroutes alongside direct backend routes.Adds a test-only
TestOnlyDualWriteRouterandTestOnlyDualWritemode to mirror EVM writes to both backends while serving reads from the primary, and updates docs to clarify which routers are wrapped withNewThreadSafeRouter.Adds extensive new unit/integration tests that simulate block workloads, verify key placement/counts, and exercise restart/resume behavior across each migration transition and steady-state router configuration.
Reviewed by Cursor Bugbot for commit 893eb75. Bugbot is set up for automated code reviews on this repo. Configure here.