Skip to content

Commit cd316d7

Browse files
tests: update to latest tests (#22290)
This updates the consensus tests to commit 31d6630 and adds support for access list transactions in the test runner. Co-authored-by: Martin Holst Swende <[email protected]>
1 parent 5a81dd9 commit cd316d7

File tree

7 files changed

+46
-41
lines changed

7 files changed

+46
-41
lines changed

tests/block_test.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ func TestBlockchain(t *testing.T) {
2525

2626
bt := new(testMatcher)
2727
// General state tests are 'exported' as blockchain tests, but we can run them natively.
28-
bt.skipLoad(`^GeneralStateTests/`)
28+
// For speedier CI-runs, the line below can be uncommented, so those are skipped.
29+
// For now, in hardfork-times (Berlin), we run the tests both as StateTests and
30+
// as blockchain tests, since the latter also covers things like receipt root
31+
//bt.skipLoad(`^GeneralStateTests/`)
32+
2933
// Skip random failures due to selfish mining test
3034
bt.skipLoad(`.*bcForgedTest/bcForkUncle\.json`)
3135

@@ -43,15 +47,7 @@ func TestBlockchain(t *testing.T) {
4347
// test takes a lot for time and goes easily OOM because of sha3 calculation on a huge range,
4448
// using 4.6 TGas
4549
bt.skipLoad(`.*randomStatetest94.json.*`)
46-
4750
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
48-
if test.json.Network == "Berlin" {
49-
// Our current berlin-tests were generated using YOLOv2 rules, hence a lot of them
50-
// fail when berlin is defined as YOLOv3. We skip those, until they've been
51-
// regenerated and re-imported
52-
// TODO (@holiman)
53-
return
54-
}
5551
if err := bt.checkFailure(t, name+"/trie", test.Run(false)); err != nil {
5652
t.Errorf("test without snapshotter failed: %v", err)
5753
}

tests/gen_stenv.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/gen_sttransaction.go

Lines changed: 23 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/gen_vmexec.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/state_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ func TestState(t *testing.T) {
6262
} {
6363
st.walk(t, dir, func(t *testing.T, name string, test *StateTest) {
6464
for _, subtest := range test.Subtests() {
65-
if subtest.Fork == "Berlin" {
66-
// Our current berlin-tests were generated using YOLOv2 rules, hence a lot of them
67-
// fail when berlin is defined as YOLOv3. We skip those, until they've been
68-
// regenerated and re-imported
69-
// TODO (@holiman)
70-
continue
71-
}
72-
7365
subtest := subtest
7466
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
7567
name := name + "/" + key

tests/state_test_util.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,14 @@ type stEnvMarshaling struct {
9595
//go:generate gencodec -type stTransaction -field-override stTransactionMarshaling -out gen_sttransaction.go
9696

9797
type stTransaction struct {
98-
GasPrice *big.Int `json:"gasPrice"`
99-
Nonce uint64 `json:"nonce"`
100-
To string `json:"to"`
101-
Data []string `json:"data"`
102-
GasLimit []uint64 `json:"gasLimit"`
103-
Value []string `json:"value"`
104-
PrivateKey []byte `json:"secretKey"`
98+
GasPrice *big.Int `json:"gasPrice"`
99+
Nonce uint64 `json:"nonce"`
100+
To string `json:"to"`
101+
Data []string `json:"data"`
102+
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
103+
GasLimit []uint64 `json:"gasLimit"`
104+
Value []string `json:"value"`
105+
PrivateKey []byte `json:"secretKey"`
105106
}
106107

107108
type stTransactionMarshaling struct {
@@ -292,8 +293,11 @@ func (tx *stTransaction) toMessage(ps stPostState) (core.Message, error) {
292293
if err != nil {
293294
return nil, fmt.Errorf("invalid tx data %q", dataHex)
294295
}
295-
296-
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, data, nil, true)
296+
var accessList types.AccessList
297+
if tx.AccessLists != nil && tx.AccessLists[ps.Indexes.Data] != nil {
298+
accessList = *tx.AccessLists[ps.Indexes.Data]
299+
}
300+
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, data, accessList, true)
297301
return msg, nil
298302
}
299303

tests/testdata

Submodule testdata updated 4583 files

0 commit comments

Comments
 (0)