Skip to content

Commit

Permalink
cmd/evm: print stateroot in evm utility (ethereum#15341)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored and karalabe committed Oct 20, 2017
1 parent eea996e commit 0900aae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/evm/staterunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,20 @@ func stateTestCmd(ctx *cli.Context) error {
for _, st := range test.Subtests() {
// Run the test and aggregate the result
result := &StatetestResult{Name: key, Fork: st.Fork, Pass: true}
if state, err := test.Run(st, cfg); err != nil {
state, err := test.Run(st, cfg)
if err != nil {
// Test failed, mark as so and dump any state to aid debugging
result.Pass, result.Error = false, err.Error()
if ctx.GlobalBool(DumpFlag.Name) && state != nil {
dump := state.RawDump()
result.State = &dump
}
}
// print state root for evmlab tracing (already committed above, so no need to delete objects again
if ctx.GlobalBool(MachineFlag.Name) && state != nil {
fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%x\"}\n", state.IntermediateRoot(false))
}

results = append(results, *result)

// Print any structured logs collected
Expand Down

0 comments on commit 0900aae

Please sign in to comment.