From 87bdda3e831a126cbbb9640a83ca7b325d5cbc1b Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Wed, 18 May 2022 15:36:57 +0200 Subject: [PATCH 1/3] tests: update reference tests --- tests/state_test.go | 2 +- tests/testdata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/state_test.go b/tests/state_test.go index d2c92b211cd1..01d728a6da2c 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -88,7 +88,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 snaps != nil && statedb != nil { + if err == nil && snaps != nil && statedb != nil { if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil { return err } diff --git a/tests/testdata b/tests/testdata index 092a8834dc44..a380655e5ffa 160000 --- a/tests/testdata +++ b/tests/testdata @@ -1 +1 @@ -Subproject commit 092a8834dc445e683103689d6f0e75a5d380a190 +Subproject commit a380655e5ffab1a5ea0f4d860224bdb19013f06a From 34a2217d1ed1705ed2217ccd647646536a60fa85 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 19 May 2022 08:43:40 +0200 Subject: [PATCH 2/3] 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 From 680895852aa7a53ec87806fdd9da75b7b8f6e195 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 19 May 2022 09:08:00 +0200 Subject: [PATCH 3/3] f --- tests/state_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/state_test.go b/tests/state_test.go index 781842304e60..d2c92b211cd1 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -74,6 +74,7 @@ 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)