Skip to content

Commit

Permalink
cmd/evm: reopen the statedb for dumping (ethereum#29437)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored Apr 2, 2024
1 parent 0bd03db commit fe0bf32
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/evm/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,17 @@ func runCmd(ctx *cli.Context) error {
output, leftOverGas, stats, err := timedExec(bench, execFunc)

if ctx.Bool(DumpFlag.Name) {
statedb.Commit(genesisConfig.Number, true)
fmt.Println(string(statedb.Dump(nil)))
root, err := statedb.Commit(genesisConfig.Number, true)
if err != nil {
fmt.Printf("Failed to commit changes %v\n", err)
return err
}
dumpdb, err := state.New(root, sdb, nil)
if err != nil {
fmt.Printf("Failed to open statedb %v\n", err)
return err
}
fmt.Println(string(dumpdb.Dump(nil)))
}

if ctx.Bool(DebugFlag.Name) {
Expand Down

0 comments on commit fe0bf32

Please sign in to comment.