diff options
author | Martin Holst Swende <martin@swende.se> | 2017-10-20 18:22:06 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-10-20 18:22:06 +0800 |
commit | 0900aae412ed11914fc698dd6ca5646ac4085d25 (patch) | |
tree | f3e472e6a4370c360ae6e15658c69bb9a3646c4b /cmd | |
parent | eea996e4e1820d32a8ec82b03ff6bd17574770e7 (diff) | |
download | dexon-0900aae412ed11914fc698dd6ca5646ac4085d25.tar dexon-0900aae412ed11914fc698dd6ca5646ac4085d25.tar.gz dexon-0900aae412ed11914fc698dd6ca5646ac4085d25.tar.bz2 dexon-0900aae412ed11914fc698dd6ca5646ac4085d25.tar.lz dexon-0900aae412ed11914fc698dd6ca5646ac4085d25.tar.xz dexon-0900aae412ed11914fc698dd6ca5646ac4085d25.tar.zst dexon-0900aae412ed11914fc698dd6ca5646ac4085d25.zip |
cmd/evm: print stateroot in evm utility (#15341)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/evm/staterunner.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/evm/staterunner.go b/cmd/evm/staterunner.go index 3a4cc51c0..071ea94ad 100644 --- a/cmd/evm/staterunner.go +++ b/cmd/evm/staterunner.go @@ -94,7 +94,8 @@ 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 { @@ -102,6 +103,11 @@ func stateTestCmd(ctx *cli.Context) error { 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 |