From 34a2217d1ed1705ed2217ccd647646536a60fa85 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 19 May 2022 08:43:40 +0200 Subject: [PATCH] tests: fix flaw in state test execution --- tests/state_test.go | 3 +-- tests/state_test_util.go | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/state_test.go b/tests/state_test.go index 01d728a6da2c..781842304e60 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -74,7 +74,6 @@ func TestState(t *testing.T) { for _, subtest := range test.Subtests() { subtest := subtest key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index) - t.Run(key+"/trie", func(t *testing.T) { withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { _, _, err := test.Run(subtest, vmconfig, false) @@ -88,7 +87,7 @@ func TestState(t *testing.T) { t.Run(key+"/snap", func(t *testing.T) { withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { snaps, statedb, err := test.Run(subtest, vmconfig, true) - if err == nil && snaps != nil && statedb != nil { + if snaps != nil && statedb != nil { if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil { return err } diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 6a173e040015..f6d8e15001d8 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -233,15 +233,14 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh if _, err := core.ApplyMessage(evm, msg, gaspool); err != nil { statedb.RevertToSnapshot(snapshot) } - - // Commit block - statedb.Commit(config.IsEIP158(block.Number())) // Add 0-value mining reward. This only makes a difference in the cases // where // - the coinbase suicided, or // - there are only 'bad' transactions, which aren't executed. In those cases, // the coinbase gets no txfee, so isn't created, and thus needs to be touched statedb.AddBalance(block.Coinbase(), new(big.Int)) + // Commit block + statedb.Commit(config.IsEIP158(block.Number())) // And _now_ get the state root root := statedb.IntermediateRoot(config.IsEIP158(block.Number())) return snaps, statedb, root, nil