Skip to content

Add the dump-state and the import-state command#3688

Merged
jolestar merged 3 commits into
mainfrom
dump_import_state
Sep 5, 2025
Merged

Add the dump-state and the import-state command#3688
jolestar merged 3 commits into
mainfrom
dump_import_state

Conversation

@steelgeek091

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Sep 4, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rooch-portal-v2.1 Ready Ready Preview Comment Sep 4, 2025 1:36pm
test-portal Ready Ready Preview Comment Sep 4, 2025 1:36pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rooch Ignored Ignored Preview Sep 4, 2025 1:36pm

@github-actions

github-actions Bot commented Sep 4, 2025

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

github-actions Bot commented Sep 4, 2025

Copy link
Copy Markdown

Docker images for this PR are available:

  • ghcr.io/rooch-network/rooch:pr-3688
  • ghcr.io/rooch-network/rooch:pr-3688-0c2c14f
  • ghcr.io/rooch-network/rooch:pr-3688_debug
  • ghcr.io/rooch-network/rooch:pr-3688-0c2c14f_debug

Pull commands:

  • docker pull ghcr.io/rooch-network/rooch:pr-3688
  • docker pull ghcr.io/rooch-network/rooch:pr-3688-0c2c14f
  • docker pull ghcr.io/rooch-network/rooch:pr-3688_debug
  • docker pull ghcr.io/rooch-network/rooch:pr-3688-0c2c14f_debug

Export state data recursively

Recursively export the entire state tree

cargo fmt

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread crates/rooch/src/commands/db/commands/import_state.rs Outdated
Comment thread crates/rooch/src/commands/db/commands/import_state.rs Outdated
Comment thread crates/rooch/src/commands/db/commands/import_state.rs Outdated
@jolestar jolestar merged commit 5f0a498 into main Sep 5, 2025
20 of 22 checks passed
@jolestar jolestar deleted the dump_import_state branch September 5, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants