cmd/evm: allow state dump regardless if test passes in statetest (#28484)

This change makes it so that when executing state tess, state is always dumped out if the corresponding flag is set.
This commit is contained in:
Wei Tang 2023-11-10 12:21:51 +01:00 committed by devopsbo3
parent aee1721189
commit d362d8e34e

View file

@ -108,13 +108,14 @@ func runStateTest(fname string, cfg vm.Config, jsonOut, dump bool) error {
fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%#x\"}\n", root) fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%#x\"}\n", root)
} }
} }
// Dump any state to aid debugging
if dump {
dump := state.RawDump(nil)
result.State = &dump
}
if err != nil { if err != nil {
// Test failed, mark as so and dump any state to aid debugging // Test failed, mark as so
result.Pass, result.Error = false, err.Error() result.Pass, result.Error = false, err.Error()
if dump {
dump := state.RawDump(nil)
result.State = &dump
}
} }
}) })
results = append(results, *result) results = append(results, *result)