Add the dump-state and the import-state command#3688
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Docker images for this PR are available:
Pull commands:
|
Export state data recursively Recursively export the entire state tree cargo fmt
f66e204 to
4a26cb7
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds two new database commands for state management: dump-state and import-state. These commands enable exporting state tree data to a file and importing it back into the database, which is useful for state migration, backup, and debugging purposes.
Key changes:
- Exposes the internal SMT (Sparse Merkle Tree) field in StateDBStore for external access
- Adds DumpStateCommand to recursively export state tree nodes to a formatted file
- Adds ImportStateCommand to parse and import state tree data from files with validation
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| moveos/moveos-store/src/state_store/statedb.rs | Makes the smt field public to enable external access to the Sparse Merkle Tree |
| crates/rooch/src/commands/db/mod.rs | Registers the new dump-state and import-state commands in the DB command enum and execution logic |
| crates/rooch/src/commands/db/commands/mod.rs | Adds module declarations for the new dump_state and import_state command modules |
| crates/rooch/src/commands/db/commands/import_state.rs | Implements the import-state command with file parsing, validation, and state restoration |
| crates/rooch/src/commands/db/commands/dump_state.rs | Implements the dump-state command with recursive state tree traversal and file output |
jolestar
approved these changes
Sep 5, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.