Skip to content

Commit

Permalink
cmd/evm: add back stateroot to jsonl-output (#27968)
Browse files Browse the repository at this point in the history
The PR #26274 broke the evm statetest command a bit, in that it stopped spitting out the stateroot following a non-successful statetest-execution. 

This PR changes it back, so the stateroot is unconditionally output on stderr, and makes it so fuzzing works again.
  • Loading branch information
holiman committed Aug 22, 2023
1 parent b8d38e7 commit 8d24929
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/evm/staterunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,20 @@ func runStateTest(fname string, cfg vm.Config, jsonOut, dump bool) error {
// Run the test and aggregate the result
result := &StatetestResult{Name: key, Fork: st.Fork, Pass: true}
test.Run(st, cfg, false, rawdb.HashScheme, func(err error, snaps *snapshot.Tree, state *state.StateDB) {
if state != nil {
root := state.IntermediateRoot(false)
result.Root = &root
if jsonOut {
fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%#x\"}\n", root)
}
}
if err != nil {
// Test failed, mark as so and dump any state to aid debugging
result.Pass, result.Error = false, err.Error()
if dump {
dump := state.RawDump(nil)
result.State = &dump
}
} else {
root := state.IntermediateRoot(false)
result.Root = &root
if jsonOut {
fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%#x\"}\n", root)
}
}
})
results = append(results, *result)
Expand Down

0 comments on commit 8d24929

Please sign in to comment.