2022-08-11 02:56:53 -06:00
|
|
|
// Copyright 2022 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 ethapi
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-05-25 14:54:28 +08:00
|
|
|
"errors"
|
2022-08-11 02:56:53 -06:00
|
|
|
"math/big"
|
|
|
|
"reflect"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum"
|
|
|
|
"github.com/ethereum/go-ethereum/accounts"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
|
|
"github.com/ethereum/go-ethereum/consensus"
|
|
|
|
"github.com/ethereum/go-ethereum/core"
|
|
|
|
"github.com/ethereum/go-ethereum/core/bloombits"
|
|
|
|
"github.com/ethereum/go-ethereum/core/state"
|
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
|
|
|
"github.com/ethereum/go-ethereum/ethdb"
|
|
|
|
"github.com/ethereum/go-ethereum/event"
|
|
|
|
"github.com/ethereum/go-ethereum/params"
|
|
|
|
"github.com/ethereum/go-ethereum/rpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TestSetFeeDefaults tests the logic for filling in default fee values works as expected.
|
|
|
|
func TestSetFeeDefaults(t *testing.T) {
|
|
|
|
type test struct {
|
2024-01-17 17:36:14 +03:30
|
|
|
name string
|
|
|
|
fork string // options: legacy, london, cancun
|
|
|
|
in *TransactionArgs
|
|
|
|
want *TransactionArgs
|
|
|
|
err error
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
b = newBackendMock()
|
2023-12-19 03:09:41 +08:00
|
|
|
zero = (*hexutil.Big)(big.NewInt(0))
|
2022-08-11 02:56:53 -06:00
|
|
|
fortytwo = (*hexutil.Big)(big.NewInt(42))
|
|
|
|
maxFee = (*hexutil.Big)(new(big.Int).Add(new(big.Int).Mul(b.current.BaseFee, big.NewInt(2)), fortytwo.ToInt()))
|
|
|
|
al = &types.AccessList{types.AccessTuple{Address: common.Address{0xaa}, StorageKeys: []common.Hash{{0x01}}}}
|
|
|
|
)
|
|
|
|
|
|
|
|
tests := []test{
|
|
|
|
// Legacy txs
|
|
|
|
{
|
|
|
|
"legacy tx pre-London",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{},
|
|
|
|
&TransactionArgs{GasPrice: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
2023-12-19 03:09:41 +08:00
|
|
|
{
|
|
|
|
"legacy tx pre-London with zero price",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2023-12-19 03:09:41 +08:00
|
|
|
&TransactionArgs{GasPrice: zero},
|
|
|
|
&TransactionArgs{GasPrice: zero},
|
|
|
|
nil,
|
|
|
|
},
|
2022-08-11 02:56:53 -06:00
|
|
|
{
|
|
|
|
"legacy tx post-London, explicit gas price",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{GasPrice: fortytwo},
|
|
|
|
&TransactionArgs{GasPrice: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
2023-12-19 03:09:41 +08:00
|
|
|
{
|
|
|
|
"legacy tx post-London with zero price",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2023-12-19 03:09:41 +08:00
|
|
|
&TransactionArgs{GasPrice: zero},
|
2024-06-19 19:51:30 +08:00
|
|
|
&TransactionArgs{GasPrice: zero},
|
|
|
|
nil, // errors.New("gasPrice must be non-zero after london fork"),
|
2023-12-19 03:09:41 +08:00
|
|
|
},
|
2022-08-11 02:56:53 -06:00
|
|
|
|
|
|
|
// Access list txs
|
|
|
|
{
|
|
|
|
"access list tx pre-London",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{AccessList: al},
|
|
|
|
&TransactionArgs{AccessList: al, GasPrice: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"access list tx post-London, explicit gas price",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{AccessList: al, GasPrice: fortytwo},
|
|
|
|
&TransactionArgs{AccessList: al, GasPrice: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"access list tx post-London",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{AccessList: al},
|
|
|
|
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"access list tx post-London, only max fee",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee},
|
|
|
|
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"access list tx post-London, only priority fee",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee},
|
|
|
|
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
|
|
|
|
// Dynamic fee txs
|
|
|
|
{
|
|
|
|
"dynamic tx post-London",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{},
|
|
|
|
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"dynamic tx post-London, only max fee",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{MaxFeePerGas: maxFee},
|
|
|
|
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"dynamic tx post-London, only priority fee",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{MaxFeePerGas: maxFee},
|
|
|
|
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"dynamic fee tx pre-London, maxFee set",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{MaxFeePerGas: maxFee},
|
|
|
|
nil,
|
2024-02-21 12:46:32 +01:00
|
|
|
errors.New("maxFeePerGas and maxPriorityFeePerGas are not valid before London is active"),
|
2022-08-11 02:56:53 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"dynamic fee tx pre-London, priorityFee set",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
2024-02-21 12:46:32 +01:00
|
|
|
errors.New("maxFeePerGas and maxPriorityFeePerGas are not valid before London is active"),
|
2022-08-11 02:56:53 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"dynamic fee tx, maxFee < priorityFee",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: (*hexutil.Big)(big.NewInt(1000))},
|
|
|
|
nil,
|
2023-05-25 14:54:28 +08:00
|
|
|
errors.New("maxFeePerGas (0x3e) < maxPriorityFeePerGas (0x3e8)"),
|
2022-08-11 02:56:53 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"dynamic fee tx, maxFee < priorityFee while setting default",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{MaxFeePerGas: (*hexutil.Big)(big.NewInt(7))},
|
|
|
|
nil,
|
2023-05-25 14:54:28 +08:00
|
|
|
errors.New("maxFeePerGas (0x7) < maxPriorityFeePerGas (0x2a)"),
|
2022-08-11 02:56:53 -06:00
|
|
|
},
|
2023-12-19 03:09:41 +08:00
|
|
|
{
|
|
|
|
"dynamic fee tx post-London, explicit gas price",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2023-12-19 03:09:41 +08:00
|
|
|
&TransactionArgs{MaxFeePerGas: zero, MaxPriorityFeePerGas: zero},
|
2024-06-19 19:51:30 +08:00
|
|
|
&TransactionArgs{MaxFeePerGas: zero, MaxPriorityFeePerGas: zero},
|
|
|
|
nil, // errors.New("maxFeePerGas must be non-zero"),
|
2023-12-19 03:09:41 +08:00
|
|
|
},
|
2022-08-11 02:56:53 -06:00
|
|
|
|
|
|
|
// Misc
|
|
|
|
{
|
|
|
|
"set all fee parameters",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
2023-05-25 14:54:28 +08:00
|
|
|
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
2022-08-11 02:56:53 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"set gas price and maxPriorityFee",
|
2024-01-17 17:36:14 +03:30
|
|
|
"legacy",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{GasPrice: fortytwo, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
2023-05-25 14:54:28 +08:00
|
|
|
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
2022-08-11 02:56:53 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"set gas price and maxFee",
|
2024-01-17 17:36:14 +03:30
|
|
|
"london",
|
2022-08-11 02:56:53 -06:00
|
|
|
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee},
|
|
|
|
nil,
|
2023-05-25 14:54:28 +08:00
|
|
|
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
2022-08-11 02:56:53 -06:00
|
|
|
},
|
2024-01-17 17:36:14 +03:30
|
|
|
// EIP-4844
|
|
|
|
{
|
|
|
|
"set gas price and maxFee for blob transaction",
|
|
|
|
"cancun",
|
|
|
|
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, BlobHashes: []common.Hash{}},
|
|
|
|
nil,
|
|
|
|
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fill maxFeePerBlobGas",
|
|
|
|
"cancun",
|
|
|
|
&TransactionArgs{BlobHashes: []common.Hash{}},
|
|
|
|
&TransactionArgs{BlobHashes: []common.Hash{}, BlobFeeCap: (*hexutil.Big)(big.NewInt(4)), MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
2024-02-21 12:46:32 +01:00
|
|
|
{
|
|
|
|
"fill maxFeePerBlobGas when dynamic fees are set",
|
|
|
|
"cancun",
|
|
|
|
&TransactionArgs{BlobHashes: []common.Hash{}, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
&TransactionArgs{BlobHashes: []common.Hash{}, BlobFeeCap: (*hexutil.Big)(big.NewInt(4)), MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
|
|
|
nil,
|
|
|
|
},
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
for i, test := range tests {
|
2024-01-17 17:36:14 +03:30
|
|
|
if err := b.setFork(test.fork); err != nil {
|
|
|
|
t.Fatalf("failed to set fork: %v", err)
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
got := test.in
|
|
|
|
err := got.setFeeDefaults(ctx, b)
|
2024-02-21 12:46:32 +01:00
|
|
|
if err != nil {
|
|
|
|
if test.err == nil {
|
|
|
|
t.Fatalf("test %d (%s): unexpected error: %s", i, test.name, err)
|
|
|
|
} else if err.Error() != test.err.Error() {
|
|
|
|
t.Fatalf("test %d (%s): unexpected error: (got: %s, want: %s)", i, test.name, err, test.err)
|
|
|
|
}
|
|
|
|
// Matching error.
|
2022-08-11 02:56:53 -06:00
|
|
|
continue
|
2024-02-21 12:46:32 +01:00
|
|
|
} else if test.err != nil {
|
|
|
|
t.Fatalf("test %d (%s): expected error: %s", i, test.name, test.err)
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
if !reflect.DeepEqual(got, test.want) {
|
|
|
|
t.Fatalf("test %d (%s): did not fill defaults as expected: (got: %v, want: %v)", i, test.name, got, test.want)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type backendMock struct {
|
|
|
|
current *types.Header
|
|
|
|
config *params.ChainConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
func newBackendMock() *backendMock {
|
2024-01-17 17:36:14 +03:30
|
|
|
var cancunTime uint64 = 600
|
2022-08-11 02:56:53 -06:00
|
|
|
config := ¶ms.ChainConfig{
|
|
|
|
ChainID: big.NewInt(42),
|
|
|
|
HomesteadBlock: big.NewInt(0),
|
|
|
|
DAOForkBlock: nil,
|
|
|
|
DAOForkSupport: true,
|
|
|
|
EIP150Block: big.NewInt(0),
|
|
|
|
EIP155Block: big.NewInt(0),
|
|
|
|
EIP158Block: big.NewInt(0),
|
|
|
|
ByzantiumBlock: big.NewInt(0),
|
|
|
|
ConstantinopleBlock: big.NewInt(0),
|
|
|
|
PetersburgBlock: big.NewInt(0),
|
|
|
|
IstanbulBlock: big.NewInt(0),
|
|
|
|
MuirGlacierBlock: big.NewInt(0),
|
|
|
|
BerlinBlock: big.NewInt(0),
|
|
|
|
LondonBlock: big.NewInt(1000),
|
2024-01-17 17:36:14 +03:30
|
|
|
CancunTime: &cancunTime,
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
return &backendMock{
|
|
|
|
current: &types.Header{
|
|
|
|
Difficulty: big.NewInt(10000000000),
|
|
|
|
Number: big.NewInt(1100),
|
|
|
|
GasLimit: 8_000_000,
|
|
|
|
GasUsed: 8_000_000,
|
|
|
|
Time: 555,
|
|
|
|
Extra: make([]byte, 32),
|
|
|
|
BaseFee: big.NewInt(10),
|
|
|
|
},
|
|
|
|
config: config,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-17 17:36:14 +03:30
|
|
|
func (b *backendMock) setFork(fork string) error {
|
|
|
|
if fork == "legacy" {
|
|
|
|
b.current.Number = big.NewInt(900)
|
|
|
|
b.current.Time = 555
|
|
|
|
} else if fork == "london" {
|
|
|
|
b.current.Number = big.NewInt(1100)
|
|
|
|
b.current.Time = 555
|
|
|
|
} else if fork == "cancun" {
|
|
|
|
b.current.Number = big.NewInt(1100)
|
|
|
|
b.current.Time = 700
|
|
|
|
// Blob base fee will be 2
|
|
|
|
excess := uint64(2314058)
|
|
|
|
b.current.ExcessBlobGas = &excess
|
|
|
|
} else {
|
|
|
|
return errors.New("invalid fork")
|
|
|
|
}
|
|
|
|
return nil
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (b *backendMock) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
|
|
|
|
return big.NewInt(42), nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) CurrentHeader() *types.Header { return b.current }
|
|
|
|
func (b *backendMock) ChainConfig() *params.ChainConfig { return b.config }
|
|
|
|
|
|
|
|
// Other methods needed to implement Backend interface.
|
|
|
|
func (b *backendMock) SyncProgress() ethereum.SyncProgress { return ethereum.SyncProgress{} }
|
2023-03-23 16:12:37 -04:00
|
|
|
func (b *backendMock) FeeHistory(ctx context.Context, blockCount uint64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, error) {
|
2022-08-11 02:56:53 -06:00
|
|
|
return nil, nil, nil, nil, nil
|
|
|
|
}
|
2023-08-23 17:46:08 +08:00
|
|
|
|
|
|
|
func (b *backendMock) Chain() *core.BlockChain { return nil }
|
2022-08-11 02:56:53 -06:00
|
|
|
func (b *backendMock) ChainDb() ethdb.Database { return nil }
|
|
|
|
func (b *backendMock) AccountManager() *accounts.Manager { return nil }
|
|
|
|
func (b *backendMock) ExtRPCEnabled() bool { return false }
|
|
|
|
func (b *backendMock) RPCGasCap() uint64 { return 0 }
|
|
|
|
func (b *backendMock) RPCEVMTimeout() time.Duration { return time.Second }
|
|
|
|
func (b *backendMock) RPCTxFeeCap() float64 { return 0 }
|
|
|
|
func (b *backendMock) UnprotectedAllowed() bool { return false }
|
|
|
|
func (b *backendMock) SetHead(number uint64) {}
|
|
|
|
func (b *backendMock) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
2023-03-02 08:29:15 +02:00
|
|
|
func (b *backendMock) CurrentBlock() *types.Header { return nil }
|
2022-08-11 02:56:53 -06:00
|
|
|
func (b *backendMock) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
2023-02-13 10:59:27 +01:00
|
|
|
func (b *backendMock) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
2022-08-11 02:56:53 -06:00
|
|
|
func (b *backendMock) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
|
|
|
|
return nil, nil, nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error) {
|
|
|
|
return nil, nil, nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) PendingBlockAndReceipts() (*types.Block, types.Receipts) { return nil, nil }
|
|
|
|
func (b *backendMock) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
2024-03-22 22:37:47 +08:00
|
|
|
func (b *backendMock) GetBlobSidecars(ctx context.Context, hash common.Hash) (types.BlobSidecars, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
2022-08-19 14:48:49 +02:00
|
|
|
func (b *backendMock) GetLogs(ctx context.Context, blockHash common.Hash, number uint64) ([][]*types.Log, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
2022-08-11 02:56:53 -06:00
|
|
|
func (b *backendMock) GetTd(ctx context.Context, hash common.Hash) *big.Int { return nil }
|
2023-11-24 13:26:42 +02:00
|
|
|
func (b *backendMock) GetEVM(ctx context.Context, msg *core.Message, state *state.StateDB, header *types.Header, vmConfig *vm.Config, blockCtx *vm.BlockContext) *vm.EVM {
|
|
|
|
return nil
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
func (b *backendMock) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { return nil }
|
|
|
|
func (b *backendMock) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription {
|
|
|
|
return nil
|
|
|
|
}
|
2023-08-23 17:46:08 +08:00
|
|
|
func (b *backendMock) SubscribeFinalizedHeaderEvent(ch chan<- core.FinalizedHeaderEvent) event.Subscription {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) SubscribeNewVoteEvent(ch chan<- core.NewVoteEvent) event.Subscription {
|
|
|
|
return nil
|
|
|
|
}
|
2022-08-11 02:56:53 -06:00
|
|
|
func (b *backendMock) SendTx(ctx context.Context, signedTx *types.Transaction) error { return nil }
|
2024-01-23 04:05:18 +08:00
|
|
|
func (b *backendMock) GetTransaction(ctx context.Context, txHash common.Hash) (bool, *types.Transaction, common.Hash, uint64, uint64, error) {
|
|
|
|
return false, nil, [32]byte{}, 0, 0, nil
|
2022-08-11 02:56:53 -06:00
|
|
|
}
|
|
|
|
func (b *backendMock) GetPoolTransactions() (types.Transactions, error) { return nil, nil }
|
|
|
|
func (b *backendMock) GetPoolTransaction(txHash common.Hash) *types.Transaction { return nil }
|
|
|
|
func (b *backendMock) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {
|
|
|
|
return 0, nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) Stats() (pending int, queued int) { return 0, 0 }
|
2023-06-16 15:29:40 +03:00
|
|
|
func (b *backendMock) TxPoolContent() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) {
|
2022-08-11 02:56:53 -06:00
|
|
|
return nil, nil
|
|
|
|
}
|
2023-06-16 15:29:40 +03:00
|
|
|
func (b *backendMock) TxPoolContentFrom(addr common.Address) ([]*types.Transaction, []*types.Transaction) {
|
2022-08-11 02:56:53 -06:00
|
|
|
return nil, nil
|
|
|
|
}
|
2022-08-19 14:48:49 +02:00
|
|
|
func (b *backendMock) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription { return nil }
|
|
|
|
func (b *backendMock) BloomStatus() (uint64, uint64) { return 0, 0 }
|
2022-08-11 02:56:53 -06:00
|
|
|
func (b *backendMock) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {}
|
|
|
|
func (b *backendMock) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { return nil }
|
|
|
|
func (b *backendMock) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func (b *backendMock) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *backendMock) Engine() consensus.Engine { return nil }
|
2024-03-08 11:15:35 +08:00
|
|
|
|
2024-08-20 11:51:32 +08:00
|
|
|
func (b *backendMock) CurrentValidators() ([]common.Address, error) { return []common.Address{}, nil }
|
2024-07-23 13:55:45 +08:00
|
|
|
|
2024-06-13 11:13:39 +08:00
|
|
|
func (b *backendMock) MevRunning() bool { return false }
|
|
|
|
func (b *backendMock) HasBuilder(builder common.Address) bool { return false }
|
2024-03-08 11:15:35 +08:00
|
|
|
func (b *backendMock) MevParams() *types.MevParams {
|
|
|
|
return &types.MevParams{}
|
|
|
|
}
|
|
|
|
func (b *backendMock) StartMev() {}
|
|
|
|
func (b *backendMock) StopMev() {}
|
|
|
|
func (b *backendMock) AddBuilder(builder common.Address, builderUrl string) error { return nil }
|
|
|
|
func (b *backendMock) RemoveBuilder(builder common.Address) error { return nil }
|
|
|
|
func (b *backendMock) SendBid(ctx context.Context, bid *types.BidArgs) (common.Hash, error) {
|
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
func (b *backendMock) MinerInTurn() bool { return false }
|
|
|
|
func (b *backendMock) BestBidGasFee(parentHash common.Hash) *big.Int {
|
|
|
|
panic("implement me")
|
|
|
|
}
|