Allow Parity as ingest node (#36)

* Upgrade go-ethereum to v1.8

* Add Node Info for parity nodes

* Upgrade start_private_blockchain to use v1.8
This commit is contained in:
Matt K
2018-03-07 15:29:21 -06:00
committed by GitHub
parent 203f9b47d3
commit 5a652190d9
624 changed files with 77003 additions and 14158 deletions
+12 -12
View File
@@ -77,8 +77,8 @@ type btHeader struct {
UncleHash common.Hash
ExtraData []byte
Difficulty *big.Int
GasLimit *big.Int
GasUsed *big.Int
GasLimit uint64
GasUsed uint64
Timestamp *big.Int
}
@@ -86,8 +86,8 @@ type btHeaderMarshaling struct {
ExtraData hexutil.Bytes
Number *math.HexOrDecimal256
Difficulty *math.HexOrDecimal256
GasLimit *math.HexOrDecimal256
GasUsed *math.HexOrDecimal256
GasLimit math.HexOrDecimal64
GasUsed math.HexOrDecimal64
Timestamp *math.HexOrDecimal256
}
@@ -110,7 +110,7 @@ func (t *BlockTest) Run() error {
return fmt.Errorf("genesis block state root does not match test: computed=%x, test=%x", gblock.Root().Bytes()[:6], t.json.Genesis.StateRoot[:6])
}
chain, err := core.NewBlockChain(db, config, ethash.NewShared(), vm.Config{})
chain, err := core.NewBlockChain(db, nil, config, ethash.NewShared(), vm.Config{})
if err != nil {
return err
}
@@ -120,7 +120,7 @@ func (t *BlockTest) Run() error {
if err != nil {
return err
}
cmlast := chain.LastBlockHash()
cmlast := chain.CurrentBlock().Hash()
if common.Hash(t.json.BestBlock) != cmlast {
return fmt.Errorf("last block hash validation mismatch: want: %x, have: %x", t.json.BestBlock, cmlast)
}
@@ -141,8 +141,8 @@ func (t *BlockTest) genesis(config *params.ChainConfig) *core.Genesis {
Timestamp: t.json.Genesis.Timestamp.Uint64(),
ParentHash: t.json.Genesis.ParentHash,
ExtraData: t.json.Genesis.ExtraData,
GasLimit: t.json.Genesis.GasLimit.Uint64(),
GasUsed: t.json.Genesis.GasUsed.Uint64(),
GasLimit: t.json.Genesis.GasLimit,
GasUsed: t.json.Genesis.GasUsed,
Difficulty: t.json.Genesis.Difficulty,
Mixhash: t.json.Genesis.MixHash,
Coinbase: t.json.Genesis.Coinbase,
@@ -234,11 +234,11 @@ func validateHeader(h *btHeader, h2 *types.Header) error {
if h.Difficulty.Cmp(h2.Difficulty) != 0 {
return fmt.Errorf("Difficulty: want: %v have: %v", h.Difficulty, h2.Difficulty)
}
if h.GasLimit.Cmp(h2.GasLimit) != 0 {
return fmt.Errorf("GasLimit: want: %v have: %v", h.GasLimit, h2.GasLimit)
if h.GasLimit != h2.GasLimit {
return fmt.Errorf("GasLimit: want: %d have: %d", h.GasLimit, h2.GasLimit)
}
if h.GasUsed.Cmp(h2.GasUsed) != 0 {
return fmt.Errorf("GasUsed: want: %v have: %v", h.GasUsed, h2.GasUsed)
if h.GasUsed != h2.GasUsed {
return fmt.Errorf("GasUsed: want: %d have: %d", h.GasUsed, h2.GasUsed)
}
if h.Timestamp.Cmp(h2.Time) != 0 {
return fmt.Errorf("Timestamp: want: %v have: %v", h.Timestamp, h2.Time)
-1
View File
@@ -13,7 +13,6 @@
//
// 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
-1
View File
@@ -13,7 +13,6 @@
//
// 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
+10 -10
View File
@@ -29,8 +29,8 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
UncleHash common.Hash
ExtraData hexutil.Bytes
Difficulty *math.HexOrDecimal256
GasLimit *math.HexOrDecimal256
GasUsed *math.HexOrDecimal256
GasLimit math.HexOrDecimal64
GasUsed math.HexOrDecimal64
Timestamp *math.HexOrDecimal256
}
var enc btHeader
@@ -47,8 +47,8 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
enc.UncleHash = b.UncleHash
enc.ExtraData = b.ExtraData
enc.Difficulty = (*math.HexOrDecimal256)(b.Difficulty)
enc.GasLimit = (*math.HexOrDecimal256)(b.GasLimit)
enc.GasUsed = (*math.HexOrDecimal256)(b.GasUsed)
enc.GasLimit = math.HexOrDecimal64(b.GasLimit)
enc.GasUsed = math.HexOrDecimal64(b.GasUsed)
enc.Timestamp = (*math.HexOrDecimal256)(b.Timestamp)
return json.Marshal(&enc)
}
@@ -66,10 +66,10 @@ func (b *btHeader) UnmarshalJSON(input []byte) error {
StateRoot *common.Hash
TransactionsTrie *common.Hash
UncleHash *common.Hash
ExtraData hexutil.Bytes
ExtraData *hexutil.Bytes
Difficulty *math.HexOrDecimal256
GasLimit *math.HexOrDecimal256
GasUsed *math.HexOrDecimal256
GasLimit *math.HexOrDecimal64
GasUsed *math.HexOrDecimal64
Timestamp *math.HexOrDecimal256
}
var dec btHeader
@@ -110,16 +110,16 @@ func (b *btHeader) UnmarshalJSON(input []byte) error {
b.UncleHash = *dec.UncleHash
}
if dec.ExtraData != nil {
b.ExtraData = dec.ExtraData
b.ExtraData = *dec.ExtraData
}
if dec.Difficulty != nil {
b.Difficulty = (*big.Int)(dec.Difficulty)
}
if dec.GasLimit != nil {
b.GasLimit = (*big.Int)(dec.GasLimit)
b.GasLimit = uint64(*dec.GasLimit)
}
if dec.GasUsed != nil {
b.GasUsed = (*big.Int)(dec.GasUsed)
b.GasUsed = uint64(*dec.GasUsed)
}
if dec.Timestamp != nil {
b.Timestamp = (*big.Int)(dec.Timestamp)
+4 -4
View File
@@ -17,14 +17,14 @@ func (s stEnv) MarshalJSON() ([]byte, error) {
type stEnv struct {
Coinbase common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
GasLimit *math.HexOrDecimal256 `json:"currentGasLimit" gencodec:"required"`
GasLimit math.HexOrDecimal64 `json:"currentGasLimit" gencodec:"required"`
Number math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
Timestamp math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"`
}
var enc stEnv
enc.Coinbase = common.UnprefixedAddress(s.Coinbase)
enc.Difficulty = (*math.HexOrDecimal256)(s.Difficulty)
enc.GasLimit = (*math.HexOrDecimal256)(s.GasLimit)
enc.GasLimit = math.HexOrDecimal64(s.GasLimit)
enc.Number = math.HexOrDecimal64(s.Number)
enc.Timestamp = math.HexOrDecimal64(s.Timestamp)
return json.Marshal(&enc)
@@ -34,7 +34,7 @@ func (s *stEnv) UnmarshalJSON(input []byte) error {
type stEnv struct {
Coinbase *common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
GasLimit *math.HexOrDecimal256 `json:"currentGasLimit" gencodec:"required"`
GasLimit *math.HexOrDecimal64 `json:"currentGasLimit" gencodec:"required"`
Number *math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
Timestamp *math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"`
}
@@ -53,7 +53,7 @@ func (s *stEnv) UnmarshalJSON(input []byte) error {
if dec.GasLimit == nil {
return errors.New("missing required field 'currentGasLimit' for stEnv")
}
s.GasLimit = (*big.Int)(dec.GasLimit)
s.GasLimit = uint64(*dec.GasLimit)
if dec.Number == nil {
return errors.New("missing required field 'currentNumber' for stEnv")
}
+2 -2
View File
@@ -46,7 +46,7 @@ func (s *stTransaction) UnmarshalJSON(input []byte) error {
Data []string `json:"data"`
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey hexutil.Bytes `json:"secretKey"`
PrivateKey *hexutil.Bytes `json:"secretKey"`
}
var dec stTransaction
if err := json.Unmarshal(input, &dec); err != nil {
@@ -74,7 +74,7 @@ func (s *stTransaction) UnmarshalJSON(input []byte) error {
s.Value = dec.Value
}
if dec.PrivateKey != nil {
s.PrivateKey = dec.PrivateKey
s.PrivateKey = *dec.PrivateKey
}
return nil
}
+6 -6
View File
@@ -17,7 +17,7 @@ var _ = (*ttTransactionMarshaling)(nil)
func (t ttTransaction) MarshalJSON() ([]byte, error) {
type ttTransaction struct {
Data hexutil.Bytes `gencodec:"required"`
GasLimit *math.HexOrDecimal256 `gencodec:"required"`
GasLimit math.HexOrDecimal64 `gencodec:"required"`
GasPrice *math.HexOrDecimal256 `gencodec:"required"`
Nonce math.HexOrDecimal64 `gencodec:"required"`
Value *math.HexOrDecimal256 `gencodec:"required"`
@@ -28,7 +28,7 @@ func (t ttTransaction) MarshalJSON() ([]byte, error) {
}
var enc ttTransaction
enc.Data = t.Data
enc.GasLimit = (*math.HexOrDecimal256)(t.GasLimit)
enc.GasLimit = math.HexOrDecimal64(t.GasLimit)
enc.GasPrice = (*math.HexOrDecimal256)(t.GasPrice)
enc.Nonce = math.HexOrDecimal64(t.Nonce)
enc.Value = (*math.HexOrDecimal256)(t.Value)
@@ -41,8 +41,8 @@ func (t ttTransaction) MarshalJSON() ([]byte, error) {
func (t *ttTransaction) UnmarshalJSON(input []byte) error {
type ttTransaction struct {
Data hexutil.Bytes `gencodec:"required"`
GasLimit *math.HexOrDecimal256 `gencodec:"required"`
Data *hexutil.Bytes `gencodec:"required"`
GasLimit *math.HexOrDecimal64 `gencodec:"required"`
GasPrice *math.HexOrDecimal256 `gencodec:"required"`
Nonce *math.HexOrDecimal64 `gencodec:"required"`
Value *math.HexOrDecimal256 `gencodec:"required"`
@@ -58,11 +58,11 @@ func (t *ttTransaction) UnmarshalJSON(input []byte) error {
if dec.Data == nil {
return errors.New("missing required field 'data' for ttTransaction")
}
t.Data = dec.Data
t.Data = *dec.Data
if dec.GasLimit == nil {
return errors.New("missing required field 'gasLimit' for ttTransaction")
}
t.GasLimit = (*big.Int)(dec.GasLimit)
t.GasLimit = uint64(*dec.GasLimit)
if dec.GasPrice == nil {
return errors.New("missing required field 'gasPrice' for ttTransaction")
}
+4 -4
View File
@@ -42,8 +42,8 @@ func (v *vmExec) UnmarshalJSON(input []byte) error {
Address *common.UnprefixedAddress `json:"address" gencodec:"required"`
Caller *common.UnprefixedAddress `json:"caller" gencodec:"required"`
Origin *common.UnprefixedAddress `json:"origin" gencodec:"required"`
Code hexutil.Bytes `json:"code" gencodec:"required"`
Data hexutil.Bytes `json:"data" gencodec:"required"`
Code *hexutil.Bytes `json:"code" gencodec:"required"`
Data *hexutil.Bytes `json:"data" gencodec:"required"`
Value *math.HexOrDecimal256 `json:"value" gencodec:"required"`
GasLimit *math.HexOrDecimal64 `json:"gas" gencodec:"required"`
GasPrice *math.HexOrDecimal256 `json:"gasPrice" gencodec:"required"`
@@ -67,11 +67,11 @@ func (v *vmExec) UnmarshalJSON(input []byte) error {
if dec.Code == nil {
return errors.New("missing required field 'code' for vmExec")
}
v.Code = dec.Code
v.Code = *dec.Code
if dec.Data == nil {
return errors.New("missing required field 'data' for vmExec")
}
v.Data = dec.Data
v.Data = *dec.Data
if dec.Value == nil {
return errors.New("missing required field 'value' for vmExec")
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017 The go-ethereum Authors
// Copyright 2015 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
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2015 The go-ethereum Authors
// 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
+6 -9
View File
@@ -1,4 +1,4 @@
// Copyright 2017 The go-ethereum Authors
// Copyright 2015 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
@@ -39,16 +39,12 @@ 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(`^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() {
subtest := subtest
@@ -68,8 +64,7 @@ func TestState(t *testing.T) {
}
// Transactions with gasLimit above this value will not get a VM trace on failure.
//const traceErrorLimit = 400000
const traceErrorLimit = 0
const traceErrorLimit = 400000
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
err := test(vm.Config{})
@@ -93,4 +88,6 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
} else {
t.Log("EVM operation log:\n" + buf.String())
}
t.Logf("EVM output: 0x%x", tracer.Output())
t.Logf("EVM error: %v", tracer.Error())
}
+10 -10
View File
@@ -1,4 +1,4 @@
// Copyright 2017 The go-ethereum Authors
// Copyright 2015 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
@@ -76,7 +76,7 @@ type stPostState struct {
type stEnv struct {
Coinbase common.Address `json:"currentCoinbase" gencodec:"required"`
Difficulty *big.Int `json:"currentDifficulty" gencodec:"required"`
GasLimit *big.Int `json:"currentGasLimit" gencodec:"required"`
GasLimit uint64 `json:"currentGasLimit" gencodec:"required"`
Number uint64 `json:"currentNumber" gencodec:"required"`
Timestamp uint64 `json:"currentTimestamp" gencodec:"required"`
}
@@ -84,7 +84,7 @@ type stEnv struct {
type stEnvMarshaling struct {
Coinbase common.UnprefixedAddress
Difficulty *math.HexOrDecimal256
GasLimit *math.HexOrDecimal256
GasLimit math.HexOrDecimal64
Number math.HexOrDecimal64
Timestamp math.HexOrDecimal64
}
@@ -125,9 +125,9 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateD
if !ok {
return nil, UnsupportedForkError{subtest.Fork}
}
block, _ := t.genesis(config).ToBlock()
block := t.genesis(config).ToBlock(nil)
db, _ := ethdb.NewMemDatabase()
statedb := makePreState(db, t.json.Pre)
statedb := MakePreState(db, t.json.Pre)
post := t.json.Post[subtest.Fork][subtest.Index]
msg, err := t.json.Tx.toMessage(post)
@@ -147,7 +147,7 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateD
if logs := rlpHash(statedb.Logs()); logs != common.Hash(post.Logs) {
return statedb, fmt.Errorf("post state logs hash mismatch: got %x, want %x", logs, post.Logs)
}
root, _ := statedb.CommitTo(db, config.IsEIP158(block.Number()))
root, _ := statedb.Commit(config.IsEIP158(block.Number()))
if root != common.Hash(post.Root) {
return statedb, fmt.Errorf("post state root mismatch: got %x, want %x", root, post.Root)
}
@@ -158,7 +158,7 @@ func (t *StateTest) gasLimit(subtest StateSubtest) uint64 {
return t.json.Tx.GasLimit[t.json.Post[subtest.Fork][subtest.Index].Indexes.Gas]
}
func makePreState(db ethdb.Database, accounts core.GenesisAlloc) *state.StateDB {
func MakePreState(db ethdb.Database, accounts core.GenesisAlloc) *state.StateDB {
sdb := state.NewDatabase(db)
statedb, _ := state.New(common.Hash{}, sdb)
for addr, a := range accounts {
@@ -170,7 +170,7 @@ func makePreState(db ethdb.Database, accounts core.GenesisAlloc) *state.StateDB
}
}
// Commit and re-open to start with a clean state.
root, _ := statedb.CommitTo(db, false)
root, _ := statedb.Commit(false)
statedb, _ = state.New(root, sdb)
return statedb
}
@@ -180,7 +180,7 @@ func (t *StateTest) genesis(config *params.ChainConfig) *core.Genesis {
Config: config,
Coinbase: t.json.Env.Coinbase,
Difficulty: t.json.Env.Difficulty,
GasLimit: t.json.Env.GasLimit.Uint64(),
GasLimit: t.json.Env.GasLimit,
Number: t.json.Env.Number,
Timestamp: t.json.Env.Timestamp,
Alloc: t.json.Pre,
@@ -233,7 +233,7 @@ func (tx *stTransaction) toMessage(ps stPostState) (core.Message, error) {
return nil, fmt.Errorf("invalid tx data %q", dataHex)
}
msg := types.NewMessage(from, to, tx.Nonce, value, new(big.Int).SetUint64(gasLimit), tx.GasPrice, data, true)
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, data, true)
return msg, nil
}
+4 -4
View File
@@ -46,7 +46,7 @@ type ttJSON struct {
type ttTransaction struct {
Data []byte `gencodec:"required"`
GasLimit *big.Int `gencodec:"required"`
GasLimit uint64 `gencodec:"required"`
GasPrice *big.Int `gencodec:"required"`
Nonce uint64 `gencodec:"required"`
Value *big.Int `gencodec:"required"`
@@ -58,7 +58,7 @@ type ttTransaction struct {
type ttTransactionMarshaling struct {
Data hexutil.Bytes
GasLimit *math.HexOrDecimal256
GasLimit math.HexOrDecimal64
GasPrice *math.HexOrDecimal256
Nonce math.HexOrDecimal64
Value *math.HexOrDecimal256
@@ -100,8 +100,8 @@ func (tt *ttTransaction) verify(signer types.Signer, tx *types.Transaction) erro
if !bytes.Equal(tx.Data(), tt.Data) {
return fmt.Errorf("Tx input data mismatch: got %x want %x", tx.Data(), tt.Data)
}
if tx.Gas().Cmp(tt.GasLimit) != 0 {
return fmt.Errorf("GasLimit mismatch: got %v, want %v", tx.Gas(), tt.GasLimit)
if tx.Gas() != tt.GasLimit {
return fmt.Errorf("GasLimit mismatch: got %d, want %d", tx.Gas(), tt.GasLimit)
}
if tx.GasPrice().Cmp(tt.GasPrice) != 0 {
return fmt.Errorf("GasPrice mismatch: got %v, want %v", tx.GasPrice(), tt.GasPrice)
+1 -1
View File
@@ -80,7 +80,7 @@ type vmExecMarshaling struct {
func (t *VMTest) Run(vmconfig vm.Config) error {
db, _ := ethdb.NewMemDatabase()
statedb := makePreState(db, t.json.Pre)
statedb := MakePreState(db, t.json.Pre)
ret, gasRemaining, err := t.exec(statedb, vmconfig)
if t.json.GasRemaining == nil {