forked from cerc-io/ipld-eth-server
Update dependencies
- uses newer version of go-ethereum required for go1.11
This commit is contained in:
+3
-2
@@ -42,6 +42,7 @@ type BlockTest struct {
|
||||
json btJSON
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements json.Unmarshaler interface.
|
||||
func (t *BlockTest) UnmarshalJSON(in []byte) error {
|
||||
return json.Unmarshal(in, &t.json)
|
||||
}
|
||||
@@ -98,13 +99,13 @@ func (t *BlockTest) Run() error {
|
||||
}
|
||||
|
||||
// import pre accounts & construct test genesis block & state root
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
db := ethdb.NewMemDatabase()
|
||||
gblock, err := t.genesis(config).Commit(db)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if gblock.Hash() != t.json.Genesis.Hash {
|
||||
return fmt.Errorf("genesis block hash doesn't match test: computed=%x, test=%x\n", gblock.Hash().Bytes()[:6], t.json.Genesis.Hash[:6])
|
||||
return fmt.Errorf("genesis block hash doesn't match test: computed=%x, test=%x", gblock.Hash().Bytes()[:6], t.json.Genesis.Hash[:6])
|
||||
}
|
||||
if gblock.Root() != t.json.Genesis.StateRoot {
|
||||
return fmt.Errorf("genesis block state root does not match test: computed=%x, test=%x", gblock.Root().Bytes()[:6], t.json.Genesis.StateRoot[:6])
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
var (
|
||||
mainnetChainConfig = params.ChainConfig{
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(1150000),
|
||||
DAOForkBlock: big.NewInt(1920000),
|
||||
DAOForkSupport: true,
|
||||
|
||||
+20
-10
@@ -23,29 +23,29 @@ import (
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
)
|
||||
|
||||
// This table defines supported forks and their chain config.
|
||||
// Forks table defines supported forks and their chain config.
|
||||
var Forks = map[string]*params.ChainConfig{
|
||||
"Frontier": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
},
|
||||
"Homestead": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
},
|
||||
"EIP150": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
},
|
||||
"EIP158": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
EIP158Block: big.NewInt(0),
|
||||
},
|
||||
"Byzantium": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
@@ -53,23 +53,33 @@ var Forks = map[string]*params.ChainConfig{
|
||||
DAOForkBlock: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(0),
|
||||
},
|
||||
"Constantinople": {
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
EIP158Block: big.NewInt(0),
|
||||
DAOForkBlock: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(0),
|
||||
ConstantinopleBlock: big.NewInt(0),
|
||||
},
|
||||
"FrontierToHomesteadAt5": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(5),
|
||||
},
|
||||
"HomesteadToEIP150At5": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(5),
|
||||
},
|
||||
"HomesteadToDaoAt5": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
DAOForkBlock: big.NewInt(5),
|
||||
DAOForkSupport: true,
|
||||
},
|
||||
"EIP158ToByzantiumAt5": {
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
|
||||
+5
-6
@@ -42,7 +42,7 @@ var (
|
||||
difficultyTestDir = filepath.Join(baseDir, "BasicTests")
|
||||
)
|
||||
|
||||
func readJson(reader io.Reader, value interface{}) error {
|
||||
func readJSON(reader io.Reader, value interface{}) error {
|
||||
data, err := ioutil.ReadAll(reader)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading JSON file: %v", err)
|
||||
@@ -57,14 +57,14 @@ func readJson(reader io.Reader, value interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func readJsonFile(fn string, value interface{}) error {
|
||||
func readJSONFile(fn string, value interface{}) error {
|
||||
file, err := os.Open(fn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
err = readJson(file, value)
|
||||
err = readJSON(file, value)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s in file %s", err.Error(), fn)
|
||||
}
|
||||
@@ -169,9 +169,8 @@ func (tm *testMatcher) checkFailure(t *testing.T, name string, err error) error
|
||||
if err != nil {
|
||||
t.Logf("error: %v", err)
|
||||
return nil
|
||||
} else {
|
||||
return fmt.Errorf("test succeeded unexpectedly")
|
||||
}
|
||||
return fmt.Errorf("test succeeded unexpectedly")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -213,7 +212,7 @@ func (tm *testMatcher) runTestFile(t *testing.T, path, name string, runTest inte
|
||||
|
||||
// Load the file as map[string]<testType>.
|
||||
m := makeMapFromTestFunc(runTest)
|
||||
if err := readJsonFile(path, m.Addr().Interface()); err != nil {
|
||||
if err := readJSONFile(path, m.Addr().Interface()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
||||
-7
@@ -36,14 +36,7 @@ func TestState(t *testing.T) {
|
||||
st.skipLoad(`^stTransactionTest/zeroSigTransa[^/]*\.json`) // EIP-86 is not supported yet
|
||||
// Expected failures:
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/EIP158`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/EIP158`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/Byzantium`, "bug in test")
|
||||
st.fails(`^stRandom2/randomStatetest64[45]\.json/(EIP150|Frontier|Homestead)/.*`, "known bug #15119")
|
||||
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/EIP158/2`, "known bug ")
|
||||
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/EIP158/3`, "known bug ")
|
||||
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/Byzantium/2`, "known bug ")
|
||||
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/Byzantium/3`, "known bug ")
|
||||
|
||||
st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
|
||||
for _, subtest := range test.Subtests() {
|
||||
|
||||
+1
-2
@@ -126,8 +126,7 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateD
|
||||
return nil, UnsupportedForkError{subtest.Fork}
|
||||
}
|
||||
block := t.genesis(config).ToBlock(nil)
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
statedb := MakePreState(db, t.json.Pre)
|
||||
statedb := MakePreState(ethdb.NewMemDatabase(), t.json.Pre)
|
||||
|
||||
post := t.json.Post[subtest.Fork][subtest.Index]
|
||||
msg, err := t.json.Tx.toMessage(post)
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ func TestTransaction(t *testing.T) {
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
EIP158Block: big.NewInt(0),
|
||||
ChainId: big.NewInt(1),
|
||||
ChainID: big.NewInt(1),
|
||||
})
|
||||
txt.config(`^Byzantium/`, params.ChainConfig{
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
|
||||
+1
-2
@@ -72,9 +72,8 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error {
|
||||
if err := rlp.DecodeBytes(tt.json.RLP, tx); err != nil {
|
||||
if tt.json.Transaction == nil {
|
||||
return nil
|
||||
} else {
|
||||
return fmt.Errorf("RLP decoding failed: %v", err)
|
||||
}
|
||||
return fmt.Errorf("RLP decoding failed: %v", err)
|
||||
}
|
||||
// Check sender derivation.
|
||||
signer := types.MakeSigner(config, new(big.Int).SetUint64(uint64(tt.json.BlockNumber)))
|
||||
|
||||
+1
-2
@@ -79,8 +79,7 @@ type vmExecMarshaling struct {
|
||||
}
|
||||
|
||||
func (t *VMTest) Run(vmconfig vm.Config) error {
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
statedb := MakePreState(db, t.json.Pre)
|
||||
statedb := MakePreState(ethdb.NewMemDatabase(), t.json.Pre)
|
||||
ret, gasRemaining, err := t.exec(statedb, vmconfig)
|
||||
|
||||
if t.json.GasRemaining == nil {
|
||||
|
||||
Reference in New Issue
Block a user