erigon-pulse/tests/difficulty_test.go
Andrew Ashikhmin d0dbf014f3
Update consensus tests to 10.2. EIP-2681 (#3103)
* ArrowGlacier fork config

* core/vm: implement EIP-2681: Limit account nonce to 2^64-1 (#23853)

This retroactively implements requirements or EIP-2681 for the account nonce upper limit.

* Update consesus tests to 10.2

* Handle TransactionWithHighNonce64Minus1

* Check intrinsic gas in transaction tests

* Refactor overflow protection in IntrinsicGas

* Remove remnants of vm tests

* Update difficulty tests to the new format

Co-authored-by: Andrei Maiboroda <andrei@ethereum.org>
2021-12-07 18:24:59 +01:00

58 lines
1.6 KiB
Go

// Copyright 2017 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package tests
import (
"encoding/json"
"fmt"
"testing"
)
func TestDifficulty(t *testing.T) {
t.Parallel()
dt := new(testMatcher)
dt.walk(t, difficultyTestDir, func(t *testing.T, name string, superTest map[string]json.RawMessage) {
for fork, rawTests := range superTest {
if fork == "_info" {
continue
}
var tests map[string]DifficultyTest
if err := json.Unmarshal(rawTests, &tests); err != nil {
t.Error(err)
continue
}
cfg, ok := Forks[fork]
if !ok {
t.Error(UnsupportedForkError{fork})
continue
}
for subname, subtest := range tests {
key := fmt.Sprintf("%s/%s", fork, subname)
t.Run(key, func(t *testing.T) {
if err := dt.checkFailure(t, subtest.Run(cfg)); err != nil {
t.Error(err)
}
})
}
}
})
}