Bump up daptools image tag and geth version.
This commit is contained in:
+3
-3
@@ -123,7 +123,7 @@ func (pea *PublicEthAPI) GetHeaderByHash(ctx context.Context, hash common.Hash)
|
||||
|
||||
// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field
|
||||
func (pea *PublicEthAPI) rpcMarshalHeader(header *types.Header) (map[string]interface{}, error) {
|
||||
fields := RPCMarshalHeader(header, pea.B.Config.ChainConfig.Clique != nil)
|
||||
fields := RPCMarshalHeader(header)
|
||||
td, err := pea.B.GetTd(header.Hash())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1077,7 +1077,7 @@ func (pea *PublicEthAPI) writeStateDiffFor(blockHash common.Hash) {
|
||||
|
||||
// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field
|
||||
func (pea *PublicEthAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
|
||||
fields, err := RPCMarshalBlock(b, inclTx, fullTx, pea.B.Config.ChainConfig.Clique != nil)
|
||||
fields, err := RPCMarshalBlock(b, inclTx, fullTx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1093,7 +1093,7 @@ func (pea *PublicEthAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx boo
|
||||
|
||||
// rpcMarshalBlockWithUncleHashes uses the generalized output filler, then adds the total difficulty field
|
||||
func (pea *PublicEthAPI) rpcMarshalBlockWithUncleHashes(b *types.Block, uncleHashes []common.Hash, inclTx bool, fullTx bool) (map[string]interface{}, error) {
|
||||
fields, err := RPCMarshalBlockWithUncleHashes(b, uncleHashes, inclTx, fullTx, pea.B.Config.ChainConfig.Clique != nil)
|
||||
fields, err := RPCMarshalBlockWithUncleHashes(b, uncleHashes, inclTx, fullTx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+6
-2
@@ -210,7 +210,9 @@ var _ = Describe("API", func() {
|
||||
|
||||
db, err = SetupDB()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
indexAndPublisher := indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
|
||||
indexAndPublisher, err := indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
backend, err := eth.NewEthBackend(db, ð.Config{
|
||||
ChainConfig: chainConfig,
|
||||
VMConfig: vm.Config{},
|
||||
@@ -254,7 +256,9 @@ var _ = Describe("API", func() {
|
||||
|
||||
// setting chain config to for london block
|
||||
chainConfig.LondonBlock = big.NewInt(2)
|
||||
indexAndPublisher = indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
indexAndPublisher, err = indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
tx, err = indexAndPublisher.PushBlock(test_helpers.MockLondonBlock, test_helpers.MockLondonReceipts, test_helpers.MockLondonBlock.Difficulty())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
|
||||
+4
-4
@@ -627,7 +627,7 @@ func (b *Backend) GetEVM(ctx context.Context, msg core.Message, state *state.Sta
|
||||
}
|
||||
|
||||
// GetAccountByNumberOrHash returns the account object for the provided address at the block corresponding to the provided number or hash
|
||||
func (b *Backend) GetAccountByNumberOrHash(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*state.Account, error) {
|
||||
func (b *Backend) GetAccountByNumberOrHash(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*types.StateAccount, error) {
|
||||
if blockNr, ok := blockNrOrHash.Number(); ok {
|
||||
return b.GetAccountByNumber(ctx, address, blockNr)
|
||||
}
|
||||
@@ -638,7 +638,7 @@ func (b *Backend) GetAccountByNumberOrHash(ctx context.Context, address common.A
|
||||
}
|
||||
|
||||
// GetAccountByNumber returns the account object for the provided address at the canonical block at the provided height
|
||||
func (b *Backend) GetAccountByNumber(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) (*state.Account, error) {
|
||||
func (b *Backend) GetAccountByNumber(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) (*types.StateAccount, error) {
|
||||
var err error
|
||||
number := blockNumber.Int64()
|
||||
if blockNumber == rpc.LatestBlockNumber {
|
||||
@@ -667,7 +667,7 @@ func (b *Backend) GetAccountByNumber(ctx context.Context, address common.Address
|
||||
}
|
||||
|
||||
// GetAccountByHash returns the account object for the provided address at the block with the provided hash
|
||||
func (b *Backend) GetAccountByHash(ctx context.Context, address common.Address, hash common.Hash) (*state.Account, error) {
|
||||
func (b *Backend) GetAccountByHash(ctx context.Context, address common.Address, hash common.Hash) (*types.StateAccount, error) {
|
||||
_, err := b.HeaderByHash(context.Background(), hash)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, errHeaderHashNotFound
|
||||
@@ -680,7 +680,7 @@ func (b *Backend) GetAccountByHash(ctx context.Context, address common.Address,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
acct := new(state.Account)
|
||||
acct := new(types.StateAccount)
|
||||
return acct, rlp.DecodeBytes(accountRlp, acct)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,22 +26,14 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
||||
// RPCMarshalHeader converts the given header to the RPC output.
|
||||
// This function is eth/internal so we have to make our own version here...
|
||||
func RPCMarshalHeader(head *types.Header, extractMiner bool) map[string]interface{} {
|
||||
if extractMiner {
|
||||
if err := recoverMiner(head); err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func RPCMarshalHeader(head *types.Header) map[string]interface{} {
|
||||
headerMap := map[string]interface{}{
|
||||
"number": (*hexutil.Big)(head.Number),
|
||||
"hash": head.Hash(),
|
||||
@@ -71,8 +63,8 @@ func RPCMarshalHeader(head *types.Header, extractMiner bool) map[string]interfac
|
||||
// RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are
|
||||
// returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain
|
||||
// transaction hashes.
|
||||
func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, extractMiner bool) (map[string]interface{}, error) {
|
||||
fields := RPCMarshalHeader(block.Header(), extractMiner)
|
||||
func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
|
||||
fields := RPCMarshalHeader(block.Header())
|
||||
fields["size"] = hexutil.Uint64(block.Size())
|
||||
|
||||
if inclTx {
|
||||
@@ -105,8 +97,8 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, extractMiner
|
||||
}
|
||||
|
||||
// RPCMarshalBlockWithUncleHashes marshals the block with the provided uncle hashes
|
||||
func RPCMarshalBlockWithUncleHashes(block *types.Block, uncleHashes []common.Hash, inclTx bool, fullTx bool, extractMiner bool) (map[string]interface{}, error) {
|
||||
fields := RPCMarshalHeader(block.Header(), extractMiner)
|
||||
func RPCMarshalBlockWithUncleHashes(block *types.Block, uncleHashes []common.Hash, inclTx bool, fullTx bool) (map[string]interface{}, error) {
|
||||
fields := RPCMarshalHeader(block.Header())
|
||||
fields["size"] = hexutil.Uint64(block.Size())
|
||||
|
||||
if inclTx {
|
||||
@@ -303,24 +295,3 @@ func toBlockNumArg(number *big.Int) string {
|
||||
}
|
||||
return hexutil.EncodeBig(number)
|
||||
}
|
||||
|
||||
func recoverMiner(header *types.Header) error {
|
||||
// Retrieve the signature from the header extra-data
|
||||
if len(header.Extra) < crypto.SignatureLength {
|
||||
return errMissingSignature
|
||||
}
|
||||
|
||||
signature := header.Extra[len(header.Extra)-crypto.SignatureLength:]
|
||||
|
||||
// Recover the public key and the Ethereum address
|
||||
pubkey, err := crypto.Ecrecover(clique.SealHash(header).Bytes(), signature)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var signer common.Address
|
||||
copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
|
||||
header.Coinbase = signer
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -219,7 +219,9 @@ var _ = Describe("Retriever", func() {
|
||||
var err error
|
||||
db, err = SetupDB()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
diffIndexer = indexer.NewStateDiffIndexer(params.TestChainConfig, db)
|
||||
diffIndexer, err = indexer.NewStateDiffIndexer(params.TestChainConfig, db)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
retriever = eth.NewCIDRetriever(db)
|
||||
})
|
||||
AfterEach(func() {
|
||||
|
||||
@@ -76,7 +76,10 @@ var _ = Describe("eth state reading tests", func() {
|
||||
var err error
|
||||
db, err = SetupDB()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
transformer := indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
|
||||
transformer, err := indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
backend, err = eth.NewEthBackend(db, ð.Config{
|
||||
ChainConfig: chainConfig,
|
||||
VMConfig: vm.Config{},
|
||||
@@ -155,7 +158,8 @@ var _ = Describe("eth state reading tests", func() {
|
||||
}
|
||||
|
||||
// Insert some non-canonical data into the database so that we test our ability to discern canonicity
|
||||
indexAndPublisher := indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
indexAndPublisher, err := indexer.NewStateDiffIndexer(chainConfig, db)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
tx, err := indexAndPublisher.PushBlock(test_helpers.MockBlock, test_helpers.MockReceipts, test_helpers.MockBlock.Difficulty())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
@@ -41,7 +41,9 @@ var _ = Describe("IPLDFetcher", func() {
|
||||
)
|
||||
db, err = SetupDB()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
pubAndIndexer = indexer.NewStateDiffIndexer(params.TestChainConfig, db)
|
||||
pubAndIndexer, err = indexer.NewStateDiffIndexer(params.TestChainConfig, db)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
tx, err = pubAndIndexer.PushBlock(test_helpers.MockBlock, test_helpers.MockReceipts, test_helpers.MockBlock.Difficulty())
|
||||
for _, node := range test_helpers.MockStateNodes {
|
||||
err = pubAndIndexer.PushStateNode(tx, node)
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
@@ -341,7 +340,7 @@ var (
|
||||
ContractCodeHash = crypto.Keccak256Hash(MockContractByteCode)
|
||||
contractPath = common.Bytes2Hex([]byte{'\x06'})
|
||||
ContractLeafKey = testhelpers.AddressToLeafKey(ContractAddress)
|
||||
ContractAccount, _ = rlp.EncodeToBytes(state.Account{
|
||||
ContractAccount, _ = rlp.EncodeToBytes(types.StateAccount{
|
||||
Nonce: nonce1,
|
||||
Balance: big.NewInt(0),
|
||||
CodeHash: ContractCodeHash.Bytes(),
|
||||
@@ -359,7 +358,7 @@ var (
|
||||
AccountCodeHash = common.HexToHash("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
|
||||
AccountAddresss = common.HexToAddress("0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e")
|
||||
AccountLeafKey = testhelpers.Account2LeafKey
|
||||
Account, _ = rlp.EncodeToBytes(state.Account{
|
||||
Account, _ = rlp.EncodeToBytes(types.StateAccount{
|
||||
Nonce: nonce0,
|
||||
Balance: AccountBalance,
|
||||
CodeHash: AccountCodeHash.Bytes(),
|
||||
|
||||
Reference in New Issue
Block a user