From 2f4833b8282045da08b42e692439194a3f424095 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 10 Nov 2023 12:21:51 +0100 Subject: [PATCH] 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. --- cmd/evm/staterunner.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/evm/staterunner.go b/cmd/evm/staterunner.go index 8a07fccdf8..618ddf2ede 100644 --- a/cmd/evm/staterunner.go +++ b/cmd/evm/staterunner.go @@ -108,13 +108,14 @@ func runStateTest(fname string, cfg vm.Config, jsonOut, dump bool) error { 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 { - // Test failed, mark as so and dump any state to aid debugging + // Test failed, mark as so result.Pass, result.Error = false, err.Error() - if dump { - dump := state.RawDump(nil) - result.State = &dump - } } }) results = append(results, *result)