aboutsummaryrefslogtreecommitdiff
path: root/internal/ethapi
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ethapi')
-rw-r--r--internal/ethapi/api.go58
-rw-r--r--internal/ethapi/backend.go22
2 files changed, 19 insertions, 61 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index f44b430..8bc2f94 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -25,23 +25,22 @@ import (
"strings"
"time"
+ "github.com/ava-labs/coreth/accounts"
+ "github.com/ava-labs/coreth/accounts/keystore"
+ "github.com/ava-labs/coreth/accounts/scwallet"
+ "github.com/ava-labs/coreth/consensus/ethash"
+ "github.com/ava-labs/coreth/core"
+ "github.com/ava-labs/coreth/core/rawdb"
+ "github.com/ava-labs/coreth/core/types"
+ "github.com/ava-labs/coreth/core/vm"
+ "github.com/ava-labs/coreth/params"
"github.com/ava-labs/coreth/rpc"
- "github.com/ava-labs/go-ethereum/accounts"
- "github.com/ava-labs/go-ethereum/accounts/keystore"
- "github.com/ava-labs/go-ethereum/accounts/scwallet"
"github.com/ava-labs/go-ethereum/common"
"github.com/ava-labs/go-ethereum/common/hexutil"
"github.com/ava-labs/go-ethereum/common/math"
- "github.com/ava-labs/go-ethereum/consensus/clique"
- "github.com/ava-labs/go-ethereum/consensus/ethash"
- "github.com/ava-labs/go-ethereum/core"
- "github.com/ava-labs/go-ethereum/core/rawdb"
- "github.com/ava-labs/go-ethereum/core/types"
- "github.com/ava-labs/go-ethereum/core/vm"
"github.com/ava-labs/go-ethereum/crypto"
"github.com/ava-labs/go-ethereum/log"
"github.com/ava-labs/go-ethereum/p2p"
- "github.com/ava-labs/go-ethereum/params"
"github.com/ava-labs/go-ethereum/rlp"
"github.com/davecgh/go-spew/spew"
"github.com/tyler-smith/go-bip39"
@@ -1643,45 +1642,6 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (stri
return fmt.Sprintf("%x", encoded), nil
}
-// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the
-// given address, returning the address of the recovered signature
-//
-// This is a temporary method to debug the externalsigner integration,
-// TODO: Remove this method when the integration is mature
-func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error) {
- block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
- if block == nil {
- return common.Address{}, fmt.Errorf("block #%d not found", number)
- }
- header := block.Header()
- header.Extra = make([]byte, 32+65)
- encoded := clique.CliqueRLP(header)
-
- // Look up the wallet containing the requested signer
- account := accounts.Account{Address: address}
- wallet, err := api.b.AccountManager().Find(account)
- if err != nil {
- return common.Address{}, err
- }
-
- signature, err := wallet.SignData(account, accounts.MimetypeClique, encoded)
- if err != nil {
- return common.Address{}, err
- }
- sealHash := clique.SealHash(header).Bytes()
- log.Info("test signing of clique block",
- "Sealhash", fmt.Sprintf("%x", sealHash),
- "signature", fmt.Sprintf("%x", signature))
- pubkey, err := crypto.Ecrecover(sealHash, signature)
- if err != nil {
- return common.Address{}, err
- }
- var signer common.Address
- copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
-
- return signer, nil
-}
-
// PrintBlock retrieves a block and returns its pretty printed form.
func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) {
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go
index c96484e..fb38034 100644
--- a/internal/ethapi/backend.go
+++ b/internal/ethapi/backend.go
@@ -21,20 +21,18 @@ import (
"context"
"math/big"
+ "github.com/ava-labs/coreth/accounts"
"github.com/ava-labs/coreth/core"
- myrpc "github.com/ava-labs/coreth/rpc"
- "github.com/ava-labs/go-ethereum/accounts"
+ "github.com/ava-labs/coreth/core/state"
+ "github.com/ava-labs/coreth/core/types"
+ "github.com/ava-labs/coreth/core/vm"
+ "github.com/ava-labs/coreth/params"
+ "github.com/ava-labs/coreth/rpc"
"github.com/ava-labs/go-ethereum/common"
- ethcore "github.com/ava-labs/go-ethereum/core"
"github.com/ava-labs/go-ethereum/core/bloombits"
- "github.com/ava-labs/go-ethereum/core/state"
- "github.com/ava-labs/go-ethereum/core/types"
- "github.com/ava-labs/go-ethereum/core/vm"
"github.com/ava-labs/go-ethereum/eth/downloader"
"github.com/ava-labs/go-ethereum/ethdb"
"github.com/ava-labs/go-ethereum/event"
- "github.com/ava-labs/go-ethereum/params"
- "github.com/ava-labs/go-ethereum/rpc"
)
// Backend interface provides the common API services (that are provided by
@@ -52,14 +50,14 @@ type Backend interface {
// Blockchain API
SetHead(number uint64)
- HeaderByNumber(ctx context.Context, number myrpc.BlockNumber) (*types.Header, error)
+ HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- BlockByNumber(ctx context.Context, number myrpc.BlockNumber) (*types.Block, error)
+ BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- StateAndHeaderByNumber(ctx context.Context, number myrpc.BlockNumber) (*state.StateDB, *types.Header, error)
+ StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error)
GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)
GetTd(hash common.Hash) *big.Int
- GetEVM(ctx context.Context, msg ethcore.Message, state *state.StateDB, header *types.Header) (*vm.EVM, func() error, error)
+ GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header) (*vm.EVM, func() error, error)
SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription
SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription