mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
tests: fix statetests
This commit is contained in:
parent
acbb531492
commit
7fd83d01f2
1 changed files with 11 additions and 10 deletions
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -116,21 +117,20 @@ type stTransactionMarshaling struct {
|
||||||
func getVMConfig(forkString string) (baseConfig *params.ChainConfig, eips []int, err error) {
|
func getVMConfig(forkString string) (baseConfig *params.ChainConfig, eips []int, err error) {
|
||||||
var (
|
var (
|
||||||
splitForks = strings.Split(forkString, "+")
|
splitForks = strings.Split(forkString, "+")
|
||||||
eipStrings []string
|
|
||||||
ok bool
|
ok bool
|
||||||
)
|
|
||||||
baseName, eipsStrings = splitForks[0], splitForks[1:]
|
baseName, eipsStrings = splitForks[0], splitForks[1:]
|
||||||
|
)
|
||||||
if baseConfig, ok = Forks[baseName]; !ok {
|
if baseConfig, ok = Forks[baseName]; !ok {
|
||||||
return nil, UnsupportedForkError{subtest.Fork}
|
return nil, nil, UnsupportedForkError{baseName}
|
||||||
}
|
}
|
||||||
for _, eip := range eips {
|
for _, eip := range eipsStrings {
|
||||||
if eipNum, err := strconv.Atoi(eip); err != nil {
|
if eipNum, err := strconv.Atoi(eip); err != nil {
|
||||||
return nil, fmt.Errorf("syntax error, invalid eip number %v", eipNum)
|
return nil, nil, fmt.Errorf("syntax error, invalid eip number %v", eipNum)
|
||||||
} else {
|
} else {
|
||||||
eips = append(eips, eipNum)
|
eips = append(eips, eipNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return baseConfig, eips
|
return baseConfig, eips, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subtests returns all valid subtests of the test.
|
// Subtests returns all valid subtests of the test.
|
||||||
|
|
@ -146,10 +146,11 @@ func (t *StateTest) Subtests() []StateSubtest {
|
||||||
|
|
||||||
// Run executes a specific subtest.
|
// Run executes a specific subtest.
|
||||||
func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateDB, error) {
|
func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateDB, error) {
|
||||||
config, eips, ok := getVMConfig(subtest.Fork)
|
config, eips, err := getVMConfig(subtest.Fork)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, UnsupportedForkError{subtest.Fork}
|
return nil, UnsupportedForkError{subtest.Fork}
|
||||||
}
|
}
|
||||||
|
vmconfig.ExtraEips = eips
|
||||||
block := t.genesis(config).ToBlock(nil)
|
block := t.genesis(config).ToBlock(nil)
|
||||||
statedb := MakePreState(rawdb.NewMemoryDatabase(), t.json.Pre)
|
statedb := MakePreState(rawdb.NewMemoryDatabase(), t.json.Pre)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue