mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
upstream: fixed accounts/*
This commit is contained in:
parent
ff63c6e679
commit
16b28d2f8e
7 changed files with 46 additions and 218 deletions
|
|
@ -1,191 +0,0 @@
|
||||||
// Copyright 2016 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
|
|
||||||
// it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// 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 bind
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"crypto/ecdsa"
|
|
||||||
"errors"
|
|
||||||
"io"
|
|
||||||
"math/big"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/accounts"
|
|
||||||
"github.com/ethereum/go-ethereum/accounts/external"
|
|
||||||
"github.com/ethereum/go-ethereum/accounts/keystore"
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ErrNoChainID is returned whenever the user failed to specify a chain id.
|
|
||||||
var ErrNoChainID = errors.New("no chain id specified")
|
|
||||||
|
|
||||||
// ErrNotAuthorized is returned when an account is not properly unlocked.
|
|
||||||
var ErrNotAuthorized = errors.New("not authorized to sign this account")
|
|
||||||
|
|
||||||
// NewTransactor is a utility method to easily create a transaction signer from
|
|
||||||
// an encrypted json key stream and the associated passphrase.
|
|
||||||
//
|
|
||||||
// Deprecated: Use NewTransactorWithChainID instead.
|
|
||||||
func NewTransactor(keyin io.Reader, passphrase string) (*TransactOpts, error) {
|
|
||||||
log.Warn("WARNING: NewTransactor has been deprecated in favour of NewTransactorWithChainID")
|
|
||||||
|
|
||||||
json, err := io.ReadAll(keyin)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
key, err := keystore.DecryptKey(json, passphrase)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewKeyedTransactor(key.PrivateKey), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewKeyStoreTransactor is a utility method to easily create a transaction signer from
|
|
||||||
// a decrypted key from a keystore.
|
|
||||||
//
|
|
||||||
// Deprecated: Use NewKeyStoreTransactorWithChainID instead.
|
|
||||||
func NewKeyStoreTransactor(keystore *keystore.KeyStore, account accounts.Account) (*TransactOpts, error) {
|
|
||||||
log.Warn("WARNING: NewKeyStoreTransactor has been deprecated in favour of NewTransactorWithChainID")
|
|
||||||
|
|
||||||
signer := types.HomesteadSigner{}
|
|
||||||
|
|
||||||
return &TransactOpts{
|
|
||||||
From: account.Address,
|
|
||||||
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
|
|
||||||
if address != account.Address {
|
|
||||||
return nil, ErrNotAuthorized
|
|
||||||
}
|
|
||||||
signature, err := keystore.SignHash(account, signer.Hash(tx).Bytes())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return tx.WithSignature(signer, signature)
|
|
||||||
},
|
|
||||||
Context: context.Background(),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewKeyedTransactor is a utility method to easily create a transaction signer
|
|
||||||
// from a single private key.
|
|
||||||
//
|
|
||||||
// Deprecated: Use NewKeyedTransactorWithChainID instead.
|
|
||||||
func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts {
|
|
||||||
log.Warn("WARNING: NewKeyedTransactor has been deprecated in favour of NewKeyedTransactorWithChainID")
|
|
||||||
|
|
||||||
keyAddr := crypto.PubkeyToAddress(key.PublicKey)
|
|
||||||
signer := types.HomesteadSigner{}
|
|
||||||
|
|
||||||
return &TransactOpts{
|
|
||||||
From: keyAddr,
|
|
||||||
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
|
|
||||||
if address != keyAddr {
|
|
||||||
return nil, ErrNotAuthorized
|
|
||||||
}
|
|
||||||
signature, err := crypto.Sign(signer.Hash(tx).Bytes(), key)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return tx.WithSignature(signer, signature)
|
|
||||||
},
|
|
||||||
Context: context.Background(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewTransactorWithChainID is a utility method to easily create a transaction signer from
|
|
||||||
// an encrypted json key stream and the associated passphrase.
|
|
||||||
func NewTransactorWithChainID(keyin io.Reader, passphrase string, chainID *big.Int) (*TransactOpts, error) {
|
|
||||||
json, err := io.ReadAll(keyin)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
key, err := keystore.DecryptKey(json, passphrase)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewKeyedTransactorWithChainID(key.PrivateKey, chainID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewKeyStoreTransactorWithChainID is a utility method to easily create a transaction signer from
|
|
||||||
// a decrypted key from a keystore.
|
|
||||||
func NewKeyStoreTransactorWithChainID(keystore *keystore.KeyStore, account accounts.Account, chainID *big.Int) (*TransactOpts, error) {
|
|
||||||
if chainID == nil {
|
|
||||||
return nil, ErrNoChainID
|
|
||||||
}
|
|
||||||
|
|
||||||
signer := types.LatestSignerForChainID(chainID)
|
|
||||||
|
|
||||||
return &TransactOpts{
|
|
||||||
From: account.Address,
|
|
||||||
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
|
|
||||||
if address != account.Address {
|
|
||||||
return nil, ErrNotAuthorized
|
|
||||||
}
|
|
||||||
signature, err := keystore.SignHash(account, signer.Hash(tx).Bytes())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return tx.WithSignature(signer, signature)
|
|
||||||
},
|
|
||||||
Context: context.Background(),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewKeyedTransactorWithChainID is a utility method to easily create a transaction signer
|
|
||||||
// from a single private key.
|
|
||||||
func NewKeyedTransactorWithChainID(key *ecdsa.PrivateKey, chainID *big.Int) (*TransactOpts, error) {
|
|
||||||
if chainID == nil {
|
|
||||||
return nil, ErrNoChainID
|
|
||||||
}
|
|
||||||
keyAddr := crypto.PubkeyToAddress(key.PublicKey)
|
|
||||||
signer := types.LatestSignerForChainID(chainID)
|
|
||||||
|
|
||||||
return &TransactOpts{
|
|
||||||
From: keyAddr,
|
|
||||||
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
|
|
||||||
if address != keyAddr {
|
|
||||||
return nil, ErrNotAuthorized
|
|
||||||
}
|
|
||||||
signature, err := crypto.Sign(signer.Hash(tx).Bytes(), key)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return tx.WithSignature(signer, signature)
|
|
||||||
},
|
|
||||||
Context: context.Background(),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewClefTransactor is a utility method to easily create a transaction signer
|
|
||||||
// with a clef backend.
|
|
||||||
func NewClefTransactor(clef *external.ExternalSigner, account accounts.Account) *TransactOpts {
|
|
||||||
return &TransactOpts{
|
|
||||||
From: account.Address,
|
|
||||||
Signer: func(address common.Address, transaction *types.Transaction) (*types.Transaction, error) {
|
|
||||||
if address != account.Address {
|
|
||||||
return nil, ErrNotAuthorized
|
|
||||||
}
|
|
||||||
return clef.SignTx(account, transaction, nil) // Clef enforces its own chain id
|
|
||||||
},
|
|
||||||
Context: context.Background(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -33,18 +33,17 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common/math"
|
"github.com/ethereum/go-ethereum/common/math"
|
||||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/bloombits"
|
|
||||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/ethereum/go-ethereum/eth/filters"
|
"github.com/ethereum/go-ethereum/eth/filters"
|
||||||
|
"github.com/ethereum/go-ethereum/ethclient/simulated"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/holiman/uint256"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BOR
|
// BOR
|
||||||
|
|
@ -66,6 +65,9 @@ var (
|
||||||
// ChainReader, ChainStateReader, ContractBackend, ContractCaller, ContractFilterer, ContractTransactor,
|
// ChainReader, ChainStateReader, ContractBackend, ContractCaller, ContractFilterer, ContractTransactor,
|
||||||
// DeployBackend, GasEstimator, GasPricer, LogFilterer, PendingContractCaller, TransactionReader, and TransactionSender
|
// DeployBackend, GasEstimator, GasPricer, LogFilterer, PendingContractCaller, TransactionReader, and TransactionSender
|
||||||
type SimulatedBackend struct {
|
type SimulatedBackend struct {
|
||||||
|
*simulated.Backend
|
||||||
|
simulated.Client
|
||||||
|
|
||||||
database ethdb.Database // In memory database to store our testing data
|
database ethdb.Database // In memory database to store our testing data
|
||||||
blockchain *core.BlockChain // Ethereum blockchain to handle the consensus
|
blockchain *core.BlockChain // Ethereum blockchain to handle the consensus
|
||||||
|
|
||||||
|
|
@ -97,8 +99,6 @@ func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc types.Genesi
|
||||||
config: genesis.Config,
|
config: genesis.Config,
|
||||||
}
|
}
|
||||||
|
|
||||||
filterBackend := &filterBackend{database, blockchain, backend}
|
|
||||||
backend.filterSystem = filters.NewFilterSystem(filterBackend, filters.Config{})
|
|
||||||
backend.events = filters.NewEventSystem(backend.filterSystem)
|
backend.events = filters.NewEventSystem(backend.filterSystem)
|
||||||
|
|
||||||
header := backend.blockchain.CurrentBlock()
|
header := backend.blockchain.CurrentBlock()
|
||||||
|
|
@ -227,7 +227,7 @@ func (b *SimulatedBackend) CodeAtHash(ctx context.Context, contract common.Addre
|
||||||
}
|
}
|
||||||
|
|
||||||
// BalanceAt returns the wei balance of a certain account in the blockchain.
|
// BalanceAt returns the wei balance of a certain account in the blockchain.
|
||||||
func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (*uint256.Int, error) {
|
func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (*big.Int, error) {
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
defer b.mu.Unlock()
|
defer b.mu.Unlock()
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract common.Addres
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return stateDB.GetBalance(contract), nil
|
return stateDB.GetBalance(contract).ToBig(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NonceAt returns the nonce of a certain account in the blockchain.
|
// NonceAt returns the nonce of a certain account in the blockchain.
|
||||||
|
|
@ -962,10 +962,6 @@ func (fb *filterBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event
|
||||||
|
|
||||||
func (fb *filterBackend) BloomStatus() (uint64, uint64) { return 4096, 0 }
|
func (fb *filterBackend) BloomStatus() (uint64, uint64) { return 4096, 0 }
|
||||||
|
|
||||||
func (fb *filterBackend) ServiceFilter(ctx context.Context, ms *bloombits.MatcherSession) {
|
|
||||||
panic("not supported")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fb *filterBackend) ChainConfig() *params.ChainConfig {
|
func (fb *filterBackend) ChainConfig() *params.ChainConfig {
|
||||||
panic("not supported")
|
panic("not supported")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ func TestNewAdjustTimeFail(t *testing.T) {
|
||||||
func TestBalanceAt(t *testing.T) {
|
func TestBalanceAt(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
|
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
|
||||||
expectedBal := uint256.NewInt(10000000000000000)
|
expectedBal := uint256.NewInt(10000000000000000).ToBig()
|
||||||
|
|
||||||
sim := simTestBackend(testAddr)
|
sim := simTestBackend(testAddr)
|
||||||
defer sim.Close()
|
defer sim.Close()
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
|
"github.com/ethereum/go-ethereum/internal/ethapi/override"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
@ -97,7 +98,7 @@ func (mc *mockCaller) CallContract(ctx context.Context, call ethereum.CallMsg, b
|
||||||
return mc.callContractBytes, mc.callContractErr
|
return mc.callContractBytes, mc.callContractErr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mc *mockCaller) CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error) {
|
func (mc *mockCaller) CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *override.StateOverride, blockOverrides *override.BlockOverrides) (hexutil.Bytes, error) {
|
||||||
return mc.CallContract(ctx, ethereum.CallMsg{}, nil)
|
return mc.CallContract(ctx, ethereum.CallMsg{}, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ func TestWaitDeployed(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
address, err = bind.WaitDeployed(ctx, backend.Client(), tx.Hash())
|
address, err = bind.WaitDeployed(ctx, backend.Client, tx.Hash())
|
||||||
close(mined)
|
close(mined)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ func TestWaitDeployedCornerCases(t *testing.T) {
|
||||||
t.Errorf("failed to send transaction: %q", err)
|
t.Errorf("failed to send transaction: %q", err)
|
||||||
}
|
}
|
||||||
backend.Commit()
|
backend.Commit()
|
||||||
if _, err := bind.WaitDeployed(ctx, backend.Client(), tx.Hash()); err != bind.ErrNoAddressInReceipt {
|
if _, err := bind.WaitDeployed(ctx, backend.Client, tx.Hash()); err != bind.ErrNoAddressInReceipt {
|
||||||
t.Errorf("error mismatch: want %q, got %q, ", bind.ErrNoAddressInReceipt, err)
|
t.Errorf("error mismatch: want %q, got %q, ", bind.ErrNoAddressInReceipt, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ func TestWaitDeployedCornerCases(t *testing.T) {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
contextCanceled := errors.New("context canceled")
|
contextCanceled := errors.New("context canceled")
|
||||||
if _, err := bind.WaitDeployed(ctx, backend.Client(), tx.Hash()); err.Error() != contextCanceled.Error() {
|
if _, err := bind.WaitDeployed(ctx, backend.Client, tx.Hash()); err.Error() != contextCanceled.Error() {
|
||||||
t.Errorf("error mismatch: want %q, got %q, ", contextCanceled, err)
|
t.Errorf("error mismatch: want %q, got %q, ", contextCanceled, err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,19 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"math/big"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
ethapi "github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
|
"github.com/ethereum/go-ethereum/internal/ethapi/override"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate mockgen -destination=./caller_mock.go -package=api . Caller
|
//go:generate mockgen -destination=./caller_mock.go -package=api . Caller
|
||||||
type Caller interface {
|
type Caller interface {
|
||||||
Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error)
|
Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *override.StateOverride, blockOverrides *override.BlockOverrides) (hexutil.Bytes, error)
|
||||||
CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error)
|
CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *override.StateOverride, blockOverrides *override.BlockOverrides) (hexutil.Bytes, error)
|
||||||
|
GetBalance(ctx context.Context, address common.Address, blockNrOrHash *rpc.BlockNumberOrHash) (*big.Int, error)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/ethereum/go-ethereum/consensus/bor/api (interfaces: Caller)
|
// Source: consensus/bor/api/caller.go
|
||||||
|
|
||||||
// Package api is a generated GoMock package.
|
// Package api is a generated GoMock package.
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
"math/big"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
|
common "github.com/ethereum/go-ethereum/common"
|
||||||
hexutil "github.com/ethereum/go-ethereum/common/hexutil"
|
hexutil "github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
state "github.com/ethereum/go-ethereum/core/state"
|
state "github.com/ethereum/go-ethereum/core/state"
|
||||||
ethapi "github.com/ethereum/go-ethereum/internal/ethapi"
|
ethapi "github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
|
override "github.com/ethereum/go-ethereum/internal/ethapi/override"
|
||||||
rpc "github.com/ethereum/go-ethereum/rpc"
|
rpc "github.com/ethereum/go-ethereum/rpc"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
@ -39,31 +42,46 @@ func (m *MockCaller) EXPECT() *MockCallerMockRecorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call mocks base method.
|
// Call mocks base method.
|
||||||
func (m *MockCaller) Call(arg0 context.Context, arg1 ethapi.TransactionArgs, arg2 *rpc.BlockNumberOrHash, arg3 *ethapi.StateOverride, arg4 *ethapi.BlockOverrides) (hexutil.Bytes, error) {
|
func (m *MockCaller) Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *override.StateOverride, blockOverrides *override.BlockOverrides) (hexutil.Bytes, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "Call", arg0, arg1, arg2, arg3, arg4)
|
ret := m.ctrl.Call(m, "Call", ctx, args, blockNrOrHash, overrides, blockOverrides)
|
||||||
ret0, _ := ret[0].(hexutil.Bytes)
|
ret0, _ := ret[0].(hexutil.Bytes)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call indicates an expected call of Call.
|
// Call indicates an expected call of Call.
|
||||||
func (mr *MockCallerMockRecorder) Call(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
func (mr *MockCallerMockRecorder) Call(ctx, args, blockNrOrHash, overrides, blockOverrides interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Call", reflect.TypeOf((*MockCaller)(nil).Call), arg0, arg1, arg2, arg3, arg4)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Call", reflect.TypeOf((*MockCaller)(nil).Call), ctx, args, blockNrOrHash, overrides, blockOverrides)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CallWithState mocks base method.
|
// CallWithState mocks base method.
|
||||||
func (m *MockCaller) CallWithState(arg0 context.Context, arg1 ethapi.TransactionArgs, arg2 *rpc.BlockNumberOrHash, arg3 *state.StateDB, arg4 *ethapi.StateOverride, arg5 *ethapi.BlockOverrides) (hexutil.Bytes, error) {
|
func (m *MockCaller) CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *override.StateOverride, blockOverrides *override.BlockOverrides) (hexutil.Bytes, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "CallWithState", arg0, arg1, arg2, arg3, arg4, arg5)
|
ret := m.ctrl.Call(m, "CallWithState", ctx, args, blockNrOrHash, state, overrides, blockOverrides)
|
||||||
ret0, _ := ret[0].(hexutil.Bytes)
|
ret0, _ := ret[0].(hexutil.Bytes)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// CallWithState indicates an expected call of CallWithState.
|
// CallWithState indicates an expected call of CallWithState.
|
||||||
func (mr *MockCallerMockRecorder) CallWithState(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
|
func (mr *MockCallerMockRecorder) CallWithState(ctx, args, blockNrOrHash, state, overrides, blockOverrides interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallWithState", reflect.TypeOf((*MockCaller)(nil).CallWithState), arg0, arg1, arg2, arg3, arg4, arg5)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CallWithState", reflect.TypeOf((*MockCaller)(nil).CallWithState), ctx, args, blockNrOrHash, state, overrides, blockOverrides)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBalance mocks base method.
|
||||||
|
func (m *MockCaller) GetBalance(ctx context.Context, address common.Address, blockNrOrHash *rpc.BlockNumberOrHash) (*big.Int, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetBalance", ctx, address, blockNrOrHash)
|
||||||
|
ret0, _ := ret[0].(*big.Int)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBalance indicates an expected call of GetBalance.
|
||||||
|
func (mr *MockCallerMockRecorder) GetBalance(ctx, address, blockNrOrHash interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockCaller)(nil).GetBalance), ctx, address, blockNrOrHash)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue