-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(migration): Migrate contract store (contract's slots) from mono-…
…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>
- Loading branch information
1 parent
fb16d51
commit b557afc
Showing
8 changed files
with
727 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.