EVM test deadlock (#2136)

* fix EVM test deadlock

* set stateRoot even in case of an error
This commit is contained in:
Evgeny Danilenko 2021-06-10 18:45:45 +03:00 committed by GitHub
parent b2e798e948
commit 20ff2c5d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,6 @@ import (
"github.com/ledgerwatch/erigon/log"
"github.com/ledgerwatch/erigon/tests"
"github.com/ledgerwatch/erigon/turbo/trie"
"github.com/urfave/cli"
)
@ -105,6 +104,7 @@ func stateTestCmd(ctx *cli.Context) error {
if txErr != nil {
return txErr
}
defer tx.Rollback()
for key, test := range tests {
for _, st := range test.Subtests() {
@ -112,17 +112,17 @@ func stateTestCmd(ctx *cli.Context) error {
result := &StatetestResult{Name: key, Fork: st.Fork, Pass: true}
var root common.Hash
var calcRootErr error
statedb, err := test.Run(context.Background(), tx, st, cfg)
// print state root for evmlab tracing
root, calcRootErr = trie.CalcRoot("", tx)
if err == nil && calcRootErr != nil {
err = calcRootErr
}
if err != nil {
// Test failed, mark as so and dump any state to aid debugging
result.Pass, result.Error = false, err.Error()
} else {
root, err = trie.CalcRoot("", tx)
if err != nil {
result.Pass, result.Error = false, err.Error()
}
}
/*