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/evm: commit statedb if dump is requested #18208

Merged
merged 1 commit into from
Nov 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/evm/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func runCmd(ctx *cli.Context) error {
execTime := time.Since(tstart)

if ctx.GlobalBool(DumpFlag.Name) {
statedb.Commit(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you quite certain that the order here is correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think the ordering matters, it seems like the root hash result is the same either way.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I don't think there will be any difference unless there are either suicides or empty touch-deletes involved. In those cases, true signals to use state-clearing rules, meaning that this will be incorrect for e..g frontier rules. So if you provide a genesis where frontier is disabled, this will not be correct. A more correct approach would be to use

  statedb.Commit(chainConfig.IsEIP158(block.Number())

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it's already hardcoded to true as is, so I'm fine with this

statedb.IntermediateRoot(true)
fmt.Println(string(statedb.Dump()))
}
Expand Down