-
Notifications
You must be signed in to change notification settings - Fork 143
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
feat(migration): Migrate contract store (contract's slots) from monservice to modular-service representation #10252
Conversation
b557afc
to
d38705a
Compare
d38705a
to
4044026
Compare
…service to modular-service representation New class `ContractStateMigrator` will migrate from a mono service's contract store representation to a modular service's contract store (given by a `WritableKVStore`). Can optionally perform a validation on the resulting migrated state, ensuring that it is consistent in some ways * has same number of entries as original state * all linked lists of slots are still linked Shown correct by enhancing the contract store dumper to (optionally) migrate the contract store before dumping it. Diff on the two dumps (without migration and with migration) shows only the summary line changes: and that only to include a migration flag (to distinguish them). Has code that commits the migration-in-progress modular store every 10000 items added (to force flush-to-disk). Tricky thing there is there doesn't appear currently to be any access path from a `WritableKVState` to get to the point where you can `copy()` the underlying `VirtualMap`/`MerkleMap`. But the _caller_ must have access to the underlying structure. And so the caller passes in an operator that does the commit + copy and returns the new store to work with. An example command line for the dumper: ``` ./services-cli.sh signed-state -f states/2023-10-29T03:18:19Z/151988064/SignedState.swh dump contract-stores -k -s \ --migration --validate-migration \ -o 2023-10-29T03:18:19Z-151988064.contract-stores.new.txt ``` Fixes #10210 Signed-off-by: David S Bakin <117694041+david-bakin-sl@users.noreply.github.com>
4044026
to
b2cb512
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #10252 +/- ##
==========================================
Coverage ? 63.53%
Complexity ? 30933
==========================================
Files ? 3331
Lines ? 134235
Branches ? 13951
==========================================
Hits ? 85286
Misses ? 45592
Partials ? 3357 ☔ View full report in Codecov by Sentry. |
... mainly to kick the Github DCO service to get its act together Signed-off-by: David S Bakin <117694041+david-bakin-sl@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks a bunch @david-bakin-sl!
Description:
New class
ContractStateMigrator
will migrate from a mono service's contract store representation to a modular service's contract store (given by aWritableKVStore
).Can optionally perform a validation on the resulting migrated state, ensuring that it is consistent in some ways
Shown correct by enhancing the contract store dumper to (optionally) migrate the contract store before dumping it. Diff on the two dumps (without migration and with migration) shows only the summary line changes: and that only to include a migration flag (to distinguish them).
Has code that commits the migration-in-progress modular store every 10000 items added (to force flush-to-disk). Tricky thing there is there doesn't appear currently to be any access path from a
WritableKVState
to get to the point where you cancopy()
the underlyingVirtualMap
/MerkleMap
. But the caller must have access to the underlying structure. And so the caller passes in an operator that does the commit + copy and returns the new store to work with.An example command line for the dumper:
Related issue(s):
Fixes #10210
Checklist