Skip to content
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

cmd: fix dump cli cannot work in path mode #2160

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

sysvm
Copy link
Contributor

@sysvm sysvm commented Jan 17, 2024

Description

This pr provides a fix for #2157. According to issue, users cannot dump state data in path mode. After debugging, there are some errors in state dump process.
BSC doesn't use preimages, so DumpToCollector uses getTrie cannot find trie in path mode. Hash mode only uses hash to retrieve node info. Therefore, use trie.NewStateTrie create a MPT trie in path mode.
In addtiton, add geth dump-roothash to help dump state in path mode.

Rationale

Users can dump state data in path mode which locates in diffLayer, diskLayer or diskLayer nodebuffer(128+1).
Add geth dump-roothash command to dump all available state root hash in path mode. Next, users can use geth dump to get what you like.

Example

./geth dump-roothash --datadir ./data/ --state.scheme path

image

./geth dump --datadir ./data --incompletes --db.engine=pebble --state.scheme path 481968

Changes

Notable changes:

  • N/A

@sysvm sysvm added the wip work in process label Jan 17, 2024
@sysvm sysvm linked an issue Jan 17, 2024 that may be closed by this pull request
@sysvm sysvm force-pushed the fix-dumppathdb branch 15 times, most recently from 52b7b42 to 268e195 Compare January 23, 2024 09:14
@sysvm sysvm changed the title [WIP]cmd: check parseDumpConfig for path mode cmd: check parseDumpConfig for path mode Jan 23, 2024
@sysvm sysvm added r4r ready for review and removed wip work in process labels Jan 23, 2024
@sysvm sysvm changed the title cmd: check parseDumpConfig for path mode cmd: parseDumpConfig handles path mode Jan 23, 2024
cmd/geth/chaincmd.go Show resolved Hide resolved
trie/triedb/pathdb/database.go Outdated Show resolved Hide resolved
trie/database.go Outdated Show resolved Hide resolved
core/state/dump.go Show resolved Hide resolved
joeylichang
joeylichang previously approved these changes Jan 24, 2024
cmd/geth/chaincmd.go Outdated Show resolved Hide resolved
@sysvm sysvm force-pushed the fix-dumppathdb branch 17 times, most recently from d5b8024 to c0a47cd Compare January 24, 2024 15:05
Copy link

@RenRick RenRick left a comment

Choose a reason for hiding this comment

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

LGTM

@fynnss
Copy link
Contributor

fynnss commented Jan 25, 2024

The title of the PR is misleading. Please check.

@sysvm sysvm changed the title cmd: parseDumpConfig handles path mode cmd: add dump-roothash command to help dump state in path mode Jan 25, 2024
@sysvm
Copy link
Contributor Author

sysvm commented Jan 25, 2024

The title of the PR is misleading. Please check.

fixed

@sysvm sysvm changed the title cmd: add dump-roothash command to help dump state in path mode cmd: fix dump cli cannot work in path mode Jan 25, 2024
Copy link
Contributor

@fynnss fynnss left a comment

Choose a reason for hiding this comment

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

LGTM

@zzzckck zzzckck merged commit fecd2bf into bnb-chain:develop Jan 25, 2024
6 checks passed
@sysvm sysvm deleted the fix-dumppathdb branch March 6, 2024 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r4r ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"geth dump" on fast node snapshot gives "missing trie node"
6 participants