Skip to content

cmd/geth: fix parse state scheme#2107

Merged
sysvm merged 4 commits intobnb-chain:developfrom
sysvm:fix-pathconfig
Jan 3, 2024
Merged

cmd/geth: fix parse state scheme#2107
sysvm merged 4 commits intobnb-chain:developfrom
sysvm:fix-pathconfig

Conversation

@sysvm
Copy link
Copy Markdown
Contributor

@sysvm sysvm commented Dec 25, 2023

Description

Provide explicit for which state scheme geth can use to start or init. And add check function to validate provided state scheme.

Rationale

Users can use CLI or config.toml to specify using which mode to start. And if you use snapshot(PBSS or HBSS) to start, there is meta info in db. Therefore, there are three items containing state scheme: diskdb, config.toml, CLI. Now valid state schemes are hash and path. Here are the rules:

  1. There are no default value in config.toml and CLI, so if you don't set, it's empty string.
  2. If users provide any two config items, they should be equal.
  3. If all of three are not provided, geth use hash to run. If all of three are provided, they all should be equal.

Example

N/A

Changes

Notable changes:

  • N/A

@sysvm sysvm added the r4r ready for review label Dec 25, 2023
@joey0612 joey0612 added wip work in process and removed r4r ready for review labels Dec 26, 2023
@joey0612 joey0612 changed the title cmd/geth: fix parse state scheme [WIP] cmd/geth: fix parse state scheme Dec 26, 2023

// MakeTrieDatabase constructs a trie database based on the configured scheme.
func MakeTrieDatabase(ctx *cli.Context, disk ethdb.Database, preimage bool, readOnly bool) *trie.Database {
log.Info("enter MakeTrieDatabase")
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.

remove the log

Copy link
Copy Markdown
Contributor Author

@sysvm sysvm Dec 26, 2023

Choose a reason for hiding this comment

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

deleted

@sysvm sysvm force-pushed the fix-pathconfig branch 2 times, most recently from db19960 to 8f9d15a Compare December 26, 2023 09:41
@sysvm sysvm force-pushed the fix-pathconfig branch 2 times, most recently from 962684c to 3f00ce4 Compare December 27, 2023 06:12
@sysvm sysvm changed the title [WIP] cmd/geth: fix parse state scheme cmd/geth: fix parse state scheme Dec 27, 2023
@sysvm sysvm added r4r ready for review and removed wip work in process labels Dec 27, 2023
Copy link
Copy Markdown

@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

Copy link
Copy Markdown
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

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.

v1.3.7 Fatal: incompatible state scheme, stored: path, config: hash, CLI: path

5 participants