diff --git a/tests/gen_difficultytest.go b/tests/gen_difficultytest.go new file mode 100644 index 0000000000..0ed061083c --- /dev/null +++ b/tests/gen_difficultytest.go @@ -0,0 +1,66 @@ +// Code generated by github.com/fjl/gencodec. DO NOT EDIT. + +package tests + +import ( + "encoding/json" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/math" +) + +var _ = (*difficultyTestMarshaling)(nil) + +func (d difficultyTest) MarshalJSON() ([]byte, error) { + type difficultyTest struct { + ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"` + ParentDifficulty *math.HexOrDecimal256 `json:"parentDifficulty"` + UncleHash common.Hash `json:"parentUncles"` + CurrentTimestamp *math.HexOrDecimal256 `json:"currentTimestamp"` + CurrentBlockNumber math.HexOrDecimal64 `json:"currentBlockNumber"` + CurrentDifficulty *math.HexOrDecimal256 `json:"currentDifficulty"` + } + var enc difficultyTest + enc.ParentTimestamp = (*math.HexOrDecimal256)(d.ParentTimestamp) + enc.ParentDifficulty = (*math.HexOrDecimal256)(d.ParentDifficulty) + enc.UncleHash = d.UncleHash + enc.CurrentTimestamp = (*math.HexOrDecimal256)(d.CurrentTimestamp) + enc.CurrentBlockNumber = math.HexOrDecimal64(d.CurrentBlockNumber) + enc.CurrentDifficulty = (*math.HexOrDecimal256)(d.CurrentDifficulty) + return json.Marshal(&enc) +} + +func (d *difficultyTest) UnmarshalJSON(input []byte) error { + type difficultyTest struct { + ParentTimestamp *math.HexOrDecimal256 `json:"parentTimestamp"` + ParentDifficulty *math.HexOrDecimal256 `json:"parentDifficulty"` + UncleHash *common.Hash `json:"parentUncles"` + CurrentTimestamp *math.HexOrDecimal256 `json:"currentTimestamp"` + CurrentBlockNumber *math.HexOrDecimal64 `json:"currentBlockNumber"` + CurrentDifficulty *math.HexOrDecimal256 `json:"currentDifficulty"` + } + var dec difficultyTest + if err := json.Unmarshal(input, &dec); err != nil { + return err + } + if dec.ParentTimestamp != nil { + d.ParentTimestamp = (*big.Int)(dec.ParentTimestamp) + } + if dec.ParentDifficulty != nil { + d.ParentDifficulty = (*big.Int)(dec.ParentDifficulty) + } + if dec.UncleHash != nil { + d.UncleHash = *dec.UncleHash + } + if dec.CurrentTimestamp != nil { + d.CurrentTimestamp = (*big.Int)(dec.CurrentTimestamp) + } + if dec.CurrentBlockNumber != nil { + d.CurrentBlockNumber = uint64(*dec.CurrentBlockNumber) + } + if dec.CurrentDifficulty != nil { + d.CurrentDifficulty = (*big.Int)(dec.CurrentDifficulty) + } + return nil +} diff --git a/tests/init_test.go b/tests/init_test.go index 0adbb533dd..ebb0d32c34 100644 --- a/tests/init_test.go +++ b/tests/init_test.go @@ -39,6 +39,7 @@ var ( transactionTestDir = filepath.Join(baseDir, "TransactionTests") vmTestDir = filepath.Join(baseDir, "VMTests") rlpTestDir = filepath.Join(baseDir, "RLPTests") + difficultyTestDir = filepath.Join(baseDir, "BasicTests") ) func readJson(reader io.Reader, value interface{}) error { diff --git a/tests/state_test.go b/tests/state_test.go index 9a7430fbeb..5a67b290db 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -39,14 +39,16 @@ func TestState(t *testing.T) { 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( `^stRandom/randomStatetest645\.json/EIP150/.*`, "known bug #15119") - st.fails( `^stRandom/randomStatetest645\.json/Frontier/.*`, "known bug #15119") - st.fails( `^stRandom/randomStatetest645\.json/Homestead/.*`, "known bug #15119") - st.fails( `^stRandom/randomStatetest644\.json/EIP150/.*`, "known bug #15119") - st.fails( `^stRandom/randomStatetest644\.json/Frontier/.*`, "known bug #15119") - st.fails( `^stRandom/randomStatetest644\.json/Homestead/.*`, "known bug #15119") - - + st.fails(`^stRandom/randomStatetest645\.json/EIP150/.*`, "known bug #15119") + st.fails(`^stRandom/randomStatetest645\.json/Frontier/.*`, "known bug #15119") + st.fails(`^stRandom/randomStatetest645\.json/Homestead/.*`, "known bug #15119") + st.fails(`^stRandom/randomStatetest644\.json/EIP150/.*`, "known bug #15119") + st.fails(`^stRandom/randomStatetest644\.json/Frontier/.*`, "known bug #15119") + st.fails(`^stRandom/randomStatetest644\.json/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() { subtest := subtest diff --git a/tests/testdata b/tests/testdata index ca41e90635..da12f07176 160000 --- a/tests/testdata +++ b/tests/testdata @@ -1 +1 @@ -Subproject commit ca41e906351209481bce3a1b35501f25a79023c5 +Subproject commit da12f07176a1657e75fc251c8fb865e817b0d4a6