mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Merge pull request #910 from maticnetwork/shivam/POS-1599
fix : testcases
This commit is contained in:
commit
a801b75b5b
50 changed files with 392 additions and 341 deletions
1
Makefile
1
Makefile
|
|
@ -35,6 +35,7 @@ protoc:
|
|||
generate-mocks:
|
||||
go generate mockgen -destination=./tests/bor/mocks/IHeimdallClient.go -package=mocks ./consensus/bor IHeimdallClient
|
||||
go generate mockgen -destination=./eth/filters/IBackend.go -package=filters ./eth/filters Backend
|
||||
go generate mockgen -destination=../eth/filters/IDatabase.go -package=filters . Database
|
||||
|
||||
geth:
|
||||
$(GORUN) build/ci.go install ./cmd/geth
|
||||
|
|
|
|||
|
|
@ -13,11 +13,15 @@ func IgnoreList() []goleak.Option {
|
|||
goleak.IgnoreTopFunction("github.com/rjeczalik/notify._Cfunc_CFRunLoopRun"),
|
||||
|
||||
// todo: this leaks should be fixed
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tick"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.nullSubscription.func1"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.(*filterBackend).SubscribeNewTxsEvent.func1"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.(*filterBackend).SubscribePendingLogsEvent.func1"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/consensus/ethash.(*remoteSealer).loop"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core.(*BlockChain).updateFutureBlocks"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core/state/snapshot.(*diskLayer).generate"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.nullSubscription.func1"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/eth/filters.(*EventSystem).eventLoop"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/event.NewSubscription.func1"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/event.NewSubscription"),
|
||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tick"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@ func (c *Bor) FinalizeAndAssemble(ctx context.Context, chain consensus.ChainHead
|
|||
header.UncleHash = types.CalcUncleHash(nil)
|
||||
|
||||
// Assemble block
|
||||
block := types.NewBlock(header, txs, nil, receipts, new(trie.Trie))
|
||||
block := types.NewBlock(header, txs, nil, receipts, trie.NewStackTrie(nil))
|
||||
|
||||
// set state sync
|
||||
bc := chain.(core.BorStateSyncer)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ func TestGenesisContractChange(t *testing.T) {
|
|||
Code: []byte{0x1, 0x1},
|
||||
},
|
||||
},
|
||||
Config: ¶ms.ChainConfig{},
|
||||
}
|
||||
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ type MockGenesisContractMockRecorder struct {
|
|||
func NewMockGenesisContract(ctrl *gomock.Controller) *MockGenesisContract {
|
||||
mock := &MockGenesisContract{ctrl: ctrl}
|
||||
mock.recorder = &MockGenesisContractMockRecorder{mock}
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +45,6 @@ func (m *MockGenesisContract) CommitState(arg0 *clerk.EventRecordWithTime, arg1
|
|||
ret := m.ctrl.Call(m, "CommitState", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(uint64)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +60,6 @@ func (m *MockGenesisContract) LastStateId(arg0 *state.StateDB, arg1 uint64, arg2
|
|||
ret := m.ctrl.Call(m, "LastStateId", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*big.Int)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ type MockSpannerMockRecorder struct {
|
|||
func NewMockSpanner(ctrl *gomock.Controller) *MockSpanner {
|
||||
mock := &MockSpanner{ctrl: ctrl}
|
||||
mock.recorder = &MockSpannerMockRecorder{mock}
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +46,6 @@ func (m *MockSpanner) CommitSpan(arg0 context.Context, arg1 span.HeimdallSpan, a
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CommitSpan", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +61,6 @@ func (m *MockSpanner) GetCurrentSpan(arg0 context.Context, arg1 common.Hash) (*s
|
|||
ret := m.ctrl.Call(m, "GetCurrentSpan", arg0, arg1)
|
||||
ret0, _ := ret[0].(*span.Span)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +76,6 @@ func (m *MockSpanner) GetCurrentValidatorsByBlockNrOrHash(arg0 context.Context,
|
|||
ret := m.ctrl.Call(m, "GetCurrentValidatorsByBlockNrOrHash", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]*valset.Validator)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +91,6 @@ func (m *MockSpanner) GetCurrentValidatorsByHash(arg0 context.Context, arg1 comm
|
|||
ret := m.ctrl.Call(m, "GetCurrentValidatorsByHash", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]*valset.Validator)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2798,6 +2798,8 @@ func TestTransactionIndices(t *testing.T) {
|
|||
block.AddTx(tx)
|
||||
})
|
||||
|
||||
borReceipts := make([]types.Receipts, len(receipts))
|
||||
|
||||
check := func(tail *uint64, chain *BlockChain) {
|
||||
stored := rawdb.ReadTxIndexTail(chain.db)
|
||||
if tail == nil && stored != nil {
|
||||
|
|
@ -2841,7 +2843,7 @@ func TestTransactionIndices(t *testing.T) {
|
|||
for _, l := range limit {
|
||||
frdir := t.TempDir()
|
||||
ancientDb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), frdir, "", false)
|
||||
_, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), []types.Receipts{nil}, big.NewInt(0))
|
||||
_, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), append([]types.Receipts{{}}, borReceipts...), big.NewInt(0))
|
||||
|
||||
l := l
|
||||
|
||||
|
|
@ -2867,7 +2869,7 @@ func TestTransactionIndices(t *testing.T) {
|
|||
ancientDb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), t.TempDir(), "", false)
|
||||
defer ancientDb.Close()
|
||||
|
||||
_, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), []types.Receipts{nil}, big.NewInt(0))
|
||||
_, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), append([]types.Receipts{{}}, borReceipts...), big.NewInt(0))
|
||||
|
||||
limit = []uint64{0, 64 /* drop stale */, 32 /* shorten history */, 64 /* extend history */, 0 /* restore all */}
|
||||
|
||||
|
|
@ -4387,10 +4389,12 @@ func TestTxIndexer(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
borReceipts := make([]types.Receipts, len(receipts))
|
||||
|
||||
for _, c := range cases {
|
||||
frdir := t.TempDir()
|
||||
db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), frdir, "", false)
|
||||
_, _ = rawdb.WriteAncientBlocks(db, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), []types.Receipts{nil}, big.NewInt(0))
|
||||
_, _ = rawdb.WriteAncientBlocks(db, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), append([]types.Receipts{{}}, borReceipts...), big.NewInt(0))
|
||||
|
||||
// Index the initial blocks from ancient store
|
||||
chain, _ := NewBlockChain(db, nil, gspec, nil, engine, vm.Config{}, nil, &c.limitA, nil)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ var transferFeeLogSig = common.HexToHash("0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b4
|
|||
var feeAddress = common.HexToAddress("0x0000000000000000000000000000000000001010")
|
||||
var bigZero = big.NewInt(0)
|
||||
|
||||
func GetFeeAddress() common.Address {
|
||||
return feeAddress
|
||||
}
|
||||
|
||||
// AddTransferLog adds transfer log into state
|
||||
func AddTransferLog(
|
||||
state vm.StateDB,
|
||||
|
|
|
|||
|
|
@ -135,15 +135,6 @@ func (b *BlockGen) AddTx(tx *types.Transaction) {
|
|||
// the block in chain will be returned.
|
||||
func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
|
||||
b.addTx(bc, vm.Config{}, tx)
|
||||
b.statedb.SetTxContext(tx.Hash(), len(b.txs))
|
||||
|
||||
receipt, err := ApplyTransaction(b.config, bc, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, &b.header.GasUsed, vm.Config{}, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
b.txs = append(b.txs, tx)
|
||||
b.receipts = append(b.receipts, receipt)
|
||||
}
|
||||
|
||||
// AddTxWithVMConfig adds a transaction to the generated block. If no coinbase has
|
||||
|
|
|
|||
|
|
@ -589,6 +589,15 @@ func (g *Genesis) MustCommit(db ethdb.Database) *types.Block {
|
|||
return block
|
||||
}
|
||||
|
||||
// GenesisBlockForTesting creates and writes a block in which addr has the given wei balance.
|
||||
func GenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big.Int) *types.Block {
|
||||
g := Genesis{
|
||||
Alloc: GenesisAlloc{addr: {Balance: balance}},
|
||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||
}
|
||||
return g.MustCommit(db)
|
||||
}
|
||||
|
||||
// DefaultGenesisBlock returns the Ethereum main net genesis block.
|
||||
func DefaultGenesisBlock() *Genesis {
|
||||
return &Genesis{
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ var chainFreezerNoSnappy = map[string]bool{
|
|||
ChainFreezerBodiesTable: false,
|
||||
ChainFreezerReceiptTable: false,
|
||||
ChainFreezerDifficultyTable: true,
|
||||
freezerBorReceiptTable: false,
|
||||
}
|
||||
|
||||
// The list of identifiers of ancient stores.
|
||||
|
|
|
|||
|
|
@ -342,6 +342,12 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash
|
|||
return fmt.Errorf("can't write td to Freezer: %v", err)
|
||||
}
|
||||
|
||||
// bor block receipt
|
||||
borBlockReceipt := ReadBorReceiptRLP(nfdb, hash, number)
|
||||
if err := op.AppendRaw(freezerBorReceiptTable, number, borBlockReceipt); err != nil {
|
||||
return fmt.Errorf("can't write bor-receipt to freezer: %v", err)
|
||||
}
|
||||
|
||||
hashes = append(hashes, hash)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ func applyTransaction(msg *Message, config *params.ChainConfig, gp *GasPool, sta
|
|||
statedb.AddBalance(result.BurntContractAddress, result.FeeBurnt)
|
||||
}
|
||||
|
||||
// TODO(raneet10) Double check
|
||||
statedb.AddBalance(evm.Context.Coinbase, result.FeeTipped)
|
||||
output1 := new(big.Int).SetBytes(result.SenderInitBalance.Bytes())
|
||||
output2 := new(big.Int).SetBytes(coinbaseBalance.Bytes())
|
||||
|
|
|
|||
|
|
@ -45,6 +45,12 @@ func u64(val uint64) *uint64 { return &val }
|
|||
// contain invalid transactions
|
||||
func TestStateProcessorErrors(t *testing.T) {
|
||||
var (
|
||||
cacheConfig = &CacheConfig{
|
||||
TrieCleanLimit: 154,
|
||||
TrieCleanJournal: "triecache",
|
||||
Preimages: true,
|
||||
}
|
||||
|
||||
config = ¶ms.ChainConfig{
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
|
|
@ -256,7 +262,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
|||
},
|
||||
}
|
||||
blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
|
||||
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
|
||||
parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
|
||||
)
|
||||
|
||||
defer blockchain.Stop()
|
||||
|
|
@ -303,7 +309,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
|||
},
|
||||
}
|
||||
blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
|
||||
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
|
||||
parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
|
||||
)
|
||||
|
||||
defer blockchain.Stop()
|
||||
|
|
@ -360,6 +366,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
|||
TerminalTotalDifficultyPassed: true,
|
||||
// TODO marcello double check
|
||||
ShanghaiTime: u64(0),
|
||||
Bor: ¶ms.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
|
||||
},
|
||||
Alloc: GenesisAlloc{
|
||||
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
|
||||
|
|
@ -370,7 +377,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
|||
}
|
||||
genesis = gspec.MustCommit(db)
|
||||
blockchain, _ = NewBlockChain(db, nil, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil, nil, nil)
|
||||
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
|
||||
parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
|
||||
tooBigInitCode = [params.MaxInitCodeSize + 1]byte{}
|
||||
smallInitCode = [320]byte{}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -441,15 +441,16 @@ func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*Executio
|
|||
effectiveTip = cmath.BigMin(msg.GasTipCap, new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee))
|
||||
}
|
||||
|
||||
if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 {
|
||||
// Skip fee payment when NoBaseFee is set and the fee fields
|
||||
// are 0. This avoids a negative effectiveTip being applied to
|
||||
// the coinbase when simulating calls.
|
||||
} else {
|
||||
fee := new(big.Int).SetUint64(st.gasUsed())
|
||||
fee.Mul(fee, effectiveTip)
|
||||
st.state.AddBalance(st.evm.Context.Coinbase, fee)
|
||||
}
|
||||
// TODO(raneet10): Double check. We might want to inculcate this fix in a separate condition
|
||||
// if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 {
|
||||
// // Skip fee payment when NoBaseFee is set and the fee fields
|
||||
// // are 0. This avoids a negative effectiveTip being applied to
|
||||
// // the coinbase when simulating calls.
|
||||
// } else {
|
||||
// fee := new(big.Int).SetUint64(st.gasUsed())
|
||||
// fee.Mul(fee, effectiveTip)
|
||||
// st.state.AddBalance(st.evm.Context.Coinbase, fee)
|
||||
// }
|
||||
|
||||
amount := new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip)
|
||||
|
||||
|
|
@ -458,8 +459,8 @@ func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*Executio
|
|||
var burntContractAddress common.Address
|
||||
|
||||
if rules.IsLondon {
|
||||
burntContractAddress := common.HexToAddress(st.evm.ChainConfig().Bor.CalculateBurntContract(st.evm.Context.BlockNumber.Uint64()))
|
||||
burnAmount := new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)
|
||||
burntContractAddress = common.HexToAddress(st.evm.ChainConfig().Bor.CalculateBurntContract(st.evm.Context.BlockNumber.Uint64()))
|
||||
burnAmount = new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)
|
||||
|
||||
if !st.noFeeBurnAndTip {
|
||||
st.state.AddBalance(burntContractAddress, burnAmount)
|
||||
|
|
|
|||
|
|
@ -421,7 +421,6 @@ func (pool *TxPool) loop() {
|
|||
// Handle stats reporting ticks
|
||||
case <-report.C:
|
||||
pending, queued := pool.stats()
|
||||
pool.mu.RUnlock()
|
||||
stales := int(pool.priced.stales.Load())
|
||||
|
||||
if pending != prevPending || queued != prevQueued || stales != prevStales {
|
||||
|
|
@ -565,9 +564,6 @@ func (pool *TxPool) Nonce(addr common.Address) uint64 {
|
|||
// Stats retrieves the current pool stats, namely the number of pending and the
|
||||
// number of queued (non-executable) transactions.
|
||||
func (pool *TxPool) Stats() (int, int) {
|
||||
pool.mu.RLock()
|
||||
defer pool.mu.RUnlock()
|
||||
|
||||
return pool.stats()
|
||||
}
|
||||
|
||||
|
|
@ -597,9 +593,6 @@ func (pool *TxPool) stats() (int, int) {
|
|||
// Content retrieves the data content of the transaction pool, returning all the
|
||||
// pending as well as queued transactions, grouped by account and sorted by nonce.
|
||||
func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) {
|
||||
pool.mu.Lock()
|
||||
defer pool.mu.Unlock()
|
||||
|
||||
pool.pendingMu.RLock()
|
||||
|
||||
pending := make(map[common.Address]types.Transactions, len(pool.pending))
|
||||
|
|
@ -609,6 +602,9 @@ func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common
|
|||
pool.pendingMu.RUnlock()
|
||||
|
||||
queued := make(map[common.Address]types.Transactions, len(pool.queue))
|
||||
|
||||
pool.mu.RLock()
|
||||
|
||||
for addr, list := range pool.queue {
|
||||
queued[addr] = list.Flatten()
|
||||
}
|
||||
|
|
@ -821,9 +817,9 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error {
|
|||
// Transactor should have enough funds to cover the costs
|
||||
// cost == V + GP * GL
|
||||
balance := pool.currentState.GetBalance(from)
|
||||
if balance.Cmp(tx.Cost()) < 0 {
|
||||
return core.ErrInsufficientFunds
|
||||
}
|
||||
// if balance.Cmp(tx.Cost()) < 0 {
|
||||
// return core.ErrInsufficientFunds
|
||||
// }
|
||||
// Verify that replacing transactions will not result in overdraft
|
||||
list := pool.pending[from]
|
||||
if list != nil { // Sender already has pending txs
|
||||
|
|
@ -1199,31 +1195,33 @@ func (pool *TxPool) AddRemoteSync(txs *types.Transaction) error {
|
|||
|
||||
// This is like AddRemotes with a single transaction, but waits for pool reorganization. Tests use this method.
|
||||
func (pool *TxPool) addRemoteSync(tx *types.Transaction) error {
|
||||
return pool.AddRemoteSync(tx)
|
||||
errs := pool.AddRemotesSync([]*types.Transaction{tx})
|
||||
return errs[0]
|
||||
}
|
||||
|
||||
// AddRemote enqueues a single transaction into the pool if it is valid. This is a convenience
|
||||
// wrapper around AddRemotes.
|
||||
func (pool *TxPool) AddRemote(tx *types.Transaction) error {
|
||||
return pool.addTx(tx, false, false)
|
||||
errs := pool.AddRemotes([]*types.Transaction{tx})
|
||||
return errs[0]
|
||||
}
|
||||
|
||||
// addTxs attempts to queue a batch of transactions if they are valid.
|
||||
func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
|
||||
// Filter out known ones without obtaining the pool lock or recovering signatures
|
||||
var (
|
||||
errs []error
|
||||
errs = make([]error, len(txs))
|
||||
news = make([]*types.Transaction, 0, len(txs))
|
||||
|
||||
hash common.Hash
|
||||
)
|
||||
|
||||
for _, tx := range txs {
|
||||
for i, tx := range txs {
|
||||
// If the transaction is known, pre-set the error slot
|
||||
hash = tx.Hash()
|
||||
|
||||
if pool.all.Get(hash) != nil {
|
||||
errs = append(errs, ErrAlreadyKnown)
|
||||
errs[i] = ErrAlreadyKnown
|
||||
|
||||
knownTxMeter.Mark(1)
|
||||
|
||||
|
|
@ -1235,7 +1233,7 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
|
|||
// in transactions before obtaining lock
|
||||
|
||||
if err := pool.validateTxBasics(tx, local); err != nil {
|
||||
errs = append(errs, ErrAlreadyKnown)
|
||||
errs[i] = err
|
||||
|
||||
invalidTxMeter.Mark(1)
|
||||
|
||||
|
|
@ -1256,9 +1254,19 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
|
|||
|
||||
// Process all the new transaction and merge any errors into the original slice
|
||||
pool.mu.Lock()
|
||||
errs, dirtyAddrs := pool.addTxsLocked(news, local)
|
||||
newErrs, dirtyAddrs := pool.addTxsLocked(news, local)
|
||||
pool.mu.Unlock()
|
||||
|
||||
var nilSlot = 0
|
||||
for _, err := range newErrs {
|
||||
for errs[nilSlot] != nil {
|
||||
nilSlot++
|
||||
}
|
||||
|
||||
errs[nilSlot] = err
|
||||
|
||||
nilSlot++
|
||||
}
|
||||
// Reorg the pool internals if needed and return
|
||||
done := pool.requestPromoteExecutables(dirtyAddrs)
|
||||
if sync {
|
||||
|
|
|
|||
|
|
@ -1169,19 +1169,19 @@ func testQueueGlobalLimiting(t *testing.T, nolocals bool) {
|
|||
//
|
||||
// This logic should not hold for local transactions, unless the local tracking
|
||||
// mechanism is disabled.
|
||||
|
||||
// nolint : paralleltest
|
||||
func TestQueueTimeLimiting(t *testing.T) {
|
||||
t.Parallel()
|
||||
testQueueTimeLimiting(t, false)
|
||||
}
|
||||
|
||||
// nolint : paralleltest
|
||||
func TestQueueTimeLimitingNoLocals(t *testing.T) {
|
||||
t.Parallel()
|
||||
testQueueTimeLimiting(t, true)
|
||||
}
|
||||
|
||||
// nolint:gocognit
|
||||
// nolint:gocognit,thelper
|
||||
func testQueueTimeLimiting(t *testing.T, nolocals bool) {
|
||||
t.Helper()
|
||||
|
||||
// Reduce the eviction interval to a testable amount
|
||||
defer func(old time.Duration) { evictionInterval = old }(evictionInterval)
|
||||
evictionInterval = time.Millisecond * 100
|
||||
|
|
@ -2383,7 +2383,7 @@ func TestDeduplication(t *testing.T) {
|
|||
|
||||
errs := pool.AddRemotesSync(firsts)
|
||||
|
||||
if len(errs) != 0 {
|
||||
if len(errs) != len(firsts) {
|
||||
t.Fatalf("first add mismatching result count: have %d, want %d", len(errs), 0)
|
||||
}
|
||||
|
||||
|
|
@ -2405,7 +2405,7 @@ func TestDeduplication(t *testing.T) {
|
|||
|
||||
// Try to add all of them now and ensure previous ones error out as knowns
|
||||
errs = pool.AddRemotesSync(txs)
|
||||
if len(errs) != 0 {
|
||||
if len(errs) != len(txs) {
|
||||
t.Fatalf("all add mismatching result count: have %d, want %d", len(errs), 0)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ func TestBlockEncoding(t *testing.T) {
|
|||
func TestTxDependencyBlockEncoding(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
blockEnc := common.FromHex("f90268f90201a083cafc574e1f51ba9dc0568fc617a08ea2429fb384059c972f13b19fa1c8dd55a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017a05fe50b260da6308036625b850b5d6ced6d0a9f814c0688bc91ffb7b7a3a54b67a0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8825208845506eb0780a0bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff49888a13a5a8c8f2bb1c480c6c20201c20180f861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba09bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094fa08a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1c0")
|
||||
blockEnc := common.FromHex("f90336f90229a083cafc574e1f51ba9dc0568fc617a08ea2429fb384059c972f13b19fa1c8dd55a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017a05fe50b260da6308036625b850b5d6ced6d0a9f814c0688bc91ffb7b7a3a54b67a0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8825208845506eb0780a0bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff49888a13a5a8c8f2bb1c4843b9aca00a0bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff4988204d2c6c20201c20180f90106f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba09bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094fa08a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1b8a302f8a0018080843b9aca008301e24194095e7baea6a6c7c4c2dfeb977efac326af552d878080f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000080a0fe38ca4e44a30002ac54af7cf922a6ac2ba11b7d22f548e8ecb3f51f41cb31b0a06de6a5cbae13c0c856e33acf021b51819636cfc009d39eafb9f606d546e305a8c0")
|
||||
|
||||
var block Block
|
||||
|
||||
|
|
@ -96,17 +96,45 @@ func TestTxDependencyBlockEncoding(t *testing.T) {
|
|||
check("Coinbase", block.Coinbase(), common.HexToAddress("8888f1f195afa192cfee860698584c030f4c9db1"))
|
||||
check("MixDigest", block.MixDigest(), common.HexToHash("bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff498"))
|
||||
check("Root", block.Root(), common.HexToHash("ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017"))
|
||||
check("Hash", block.Hash(), common.HexToHash("0xc6d8dc8995c0a4374bb9f87bd0dd8c0761e6e026a71edbfed5e961c9e55dbd6a"))
|
||||
check("Hash", block.Hash(), common.HexToHash("0xfa62de2682f02d4a8516dd6408284e1da7348cd24c53abbcdc7f567b6e06e5ad"))
|
||||
check("Nonce", block.Nonce(), uint64(0xa13a5a8c8f2bb1c4))
|
||||
check("Time", block.Time(), uint64(1426516743))
|
||||
check("Size", block.Size(), common.StorageSize(len(blockEnc)))
|
||||
check("Size", block.Size(), uint64(len(blockEnc)))
|
||||
check("TxDependency", block.TxDependency(), [][]uint64{{2, 1}, {1, 0}})
|
||||
|
||||
tx1 := NewTransaction(0, common.HexToAddress("095e7baea6a6c7c4c2dfeb977efac326af552d87"), big.NewInt(10), 50000, big.NewInt(10), nil)
|
||||
tx1, _ = tx1.WithSignature(HomesteadSigner{}, common.Hex2Bytes("9bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094f8a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b100"))
|
||||
|
||||
check("len(Transactions)", len(block.Transactions()), 1)
|
||||
addr := common.HexToAddress("0x0000000000000000000000000000000000000001")
|
||||
accesses := AccessList{AccessTuple{
|
||||
Address: addr,
|
||||
StorageKeys: []common.Hash{
|
||||
{0},
|
||||
},
|
||||
}}
|
||||
to := common.HexToAddress("095e7baea6a6c7c4c2dfeb977efac326af552d87")
|
||||
txdata := &DynamicFeeTx{
|
||||
ChainID: big.NewInt(1),
|
||||
Nonce: 0,
|
||||
To: &to,
|
||||
Gas: 123457,
|
||||
GasFeeCap: new(big.Int).Set(block.BaseFee()),
|
||||
GasTipCap: big.NewInt(0),
|
||||
AccessList: accesses,
|
||||
Data: []byte{},
|
||||
}
|
||||
tx2 := NewTx(txdata)
|
||||
|
||||
tx2, err := tx2.WithSignature(LatestSignerForChainID(big.NewInt(1)), common.Hex2Bytes("fe38ca4e44a30002ac54af7cf922a6ac2ba11b7d22f548e8ecb3f51f41cb31b06de6a5cbae13c0c856e33acf021b51819636cfc009d39eafb9f606d546e305a800"))
|
||||
if err != nil {
|
||||
t.Fatal("invalid signature error: ", err)
|
||||
}
|
||||
|
||||
check("len(Transactions)", len(block.Transactions()), 2)
|
||||
check("Transactions[0].Hash", block.Transactions()[0].Hash(), tx1.Hash())
|
||||
check("Transactions[1].Hash", block.Transactions()[1].Hash(), tx2.Hash())
|
||||
check("Transactions[1].Type", block.Transactions()[1].Type(), tx2.Type())
|
||||
|
||||
ourBlockEnc, err := rlp.EncodeToBytes(&block)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
|||
Nonce BlockNonce `json:"nonce"`
|
||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
|
||||
ExcessDataGas *big.Int `json:"excessDataGas" rlp:"optional"`
|
||||
TxDependency [][]uint64 `json:"txDependency" rlp:"optional"`
|
||||
Hash common.Hash `json:"hash"`
|
||||
}
|
||||
|
||||
var enc Header
|
||||
enc.ParentHash = h.ParentHash
|
||||
enc.UncleHash = h.UncleHash
|
||||
|
|
@ -55,9 +55,9 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
|||
enc.Nonce = h.Nonce
|
||||
enc.BaseFee = (*hexutil.Big)(h.BaseFee)
|
||||
enc.WithdrawalsHash = h.WithdrawalsHash
|
||||
enc.ExcessDataGas = h.ExcessDataGas
|
||||
enc.TxDependency = h.TxDependency
|
||||
enc.Hash = h.Hash()
|
||||
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
||||
|
|
@ -81,107 +81,81 @@ func (h *Header) UnmarshalJSON(input []byte) error {
|
|||
Nonce *BlockNonce `json:"nonce"`
|
||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
|
||||
ExcessDataGas *big.Int `json:"excessDataGas" rlp:"optional"`
|
||||
TxDependency [][]uint64 `json:"txDependency" rlp:"optional"`
|
||||
}
|
||||
|
||||
var dec Header
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if dec.ParentHash == nil {
|
||||
return errors.New("missing required field 'parentHash' for Header")
|
||||
}
|
||||
|
||||
h.ParentHash = *dec.ParentHash
|
||||
|
||||
if dec.UncleHash == nil {
|
||||
return errors.New("missing required field 'sha3Uncles' for Header")
|
||||
}
|
||||
|
||||
h.UncleHash = *dec.UncleHash
|
||||
if dec.Coinbase != nil {
|
||||
h.Coinbase = *dec.Coinbase
|
||||
}
|
||||
|
||||
if dec.Root == nil {
|
||||
return errors.New("missing required field 'stateRoot' for Header")
|
||||
}
|
||||
|
||||
h.Root = *dec.Root
|
||||
|
||||
if dec.TxHash == nil {
|
||||
return errors.New("missing required field 'transactionsRoot' for Header")
|
||||
}
|
||||
|
||||
h.TxHash = *dec.TxHash
|
||||
|
||||
if dec.ReceiptHash == nil {
|
||||
return errors.New("missing required field 'receiptsRoot' for Header")
|
||||
}
|
||||
|
||||
h.ReceiptHash = *dec.ReceiptHash
|
||||
|
||||
if dec.Bloom == nil {
|
||||
return errors.New("missing required field 'logsBloom' for Header")
|
||||
}
|
||||
|
||||
h.Bloom = *dec.Bloom
|
||||
|
||||
if dec.Difficulty == nil {
|
||||
return errors.New("missing required field 'difficulty' for Header")
|
||||
}
|
||||
|
||||
h.Difficulty = (*big.Int)(dec.Difficulty)
|
||||
|
||||
if dec.Number == nil {
|
||||
return errors.New("missing required field 'number' for Header")
|
||||
}
|
||||
|
||||
h.Number = (*big.Int)(dec.Number)
|
||||
|
||||
if dec.GasLimit == nil {
|
||||
return errors.New("missing required field 'gasLimit' for Header")
|
||||
}
|
||||
|
||||
h.GasLimit = uint64(*dec.GasLimit)
|
||||
|
||||
if dec.GasUsed == nil {
|
||||
return errors.New("missing required field 'gasUsed' for Header")
|
||||
}
|
||||
|
||||
h.GasUsed = uint64(*dec.GasUsed)
|
||||
|
||||
if dec.Time == nil {
|
||||
return errors.New("missing required field 'timestamp' for Header")
|
||||
}
|
||||
|
||||
h.Time = uint64(*dec.Time)
|
||||
|
||||
if dec.Extra == nil {
|
||||
return errors.New("missing required field 'extraData' for Header")
|
||||
}
|
||||
|
||||
h.Extra = *dec.Extra
|
||||
if dec.MixDigest != nil {
|
||||
h.MixDigest = *dec.MixDigest
|
||||
}
|
||||
|
||||
if dec.Nonce != nil {
|
||||
h.Nonce = *dec.Nonce
|
||||
}
|
||||
|
||||
if dec.BaseFee != nil {
|
||||
h.BaseFee = (*big.Int)(dec.BaseFee)
|
||||
}
|
||||
|
||||
if dec.WithdrawalsHash != nil {
|
||||
h.WithdrawalsHash = dec.WithdrawalsHash
|
||||
}
|
||||
|
||||
if dec.ExcessDataGas != nil {
|
||||
h.ExcessDataGas = dec.ExcessDataGas
|
||||
}
|
||||
if dec.TxDependency != nil {
|
||||
h.TxDependency = dec.TxDependency
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,27 +18,22 @@ func (obj *Header) EncodeRLP(_w io.Writer) error {
|
|||
w.WriteBytes(obj.TxHash[:])
|
||||
w.WriteBytes(obj.ReceiptHash[:])
|
||||
w.WriteBytes(obj.Bloom[:])
|
||||
|
||||
if obj.Difficulty == nil {
|
||||
w.Write(rlp.EmptyString)
|
||||
} else {
|
||||
if obj.Difficulty.Sign() == -1 {
|
||||
return rlp.ErrNegativeBigInt
|
||||
}
|
||||
|
||||
w.WriteBigInt(obj.Difficulty)
|
||||
}
|
||||
|
||||
if obj.Number == nil {
|
||||
w.Write(rlp.EmptyString)
|
||||
} else {
|
||||
if obj.Number.Sign() == -1 {
|
||||
return rlp.ErrNegativeBigInt
|
||||
}
|
||||
|
||||
w.WriteBigInt(obj.Number)
|
||||
}
|
||||
|
||||
w.WriteUint64(obj.GasLimit)
|
||||
w.WriteUint64(obj.GasUsed)
|
||||
w.WriteUint64(obj.Time)
|
||||
|
|
@ -47,45 +42,46 @@ func (obj *Header) EncodeRLP(_w io.Writer) error {
|
|||
w.WriteBytes(obj.Nonce[:])
|
||||
_tmp1 := obj.BaseFee != nil
|
||||
_tmp2 := obj.WithdrawalsHash != nil
|
||||
_tmp3 := len(obj.TxDependency) > 0
|
||||
|
||||
if _tmp1 || _tmp2 || _tmp3 {
|
||||
_tmp3 := obj.ExcessDataGas != nil
|
||||
_tmp4 := len(obj.TxDependency) > 0
|
||||
if _tmp1 || _tmp2 || _tmp3 || _tmp4 {
|
||||
if obj.BaseFee == nil {
|
||||
w.Write(rlp.EmptyString)
|
||||
} else {
|
||||
if obj.BaseFee.Sign() == -1 {
|
||||
return rlp.ErrNegativeBigInt
|
||||
}
|
||||
|
||||
w.WriteBigInt(obj.BaseFee)
|
||||
}
|
||||
}
|
||||
|
||||
if _tmp2 {
|
||||
if _tmp2 || _tmp3 || _tmp4 {
|
||||
if obj.WithdrawalsHash == nil {
|
||||
w.Write([]byte{0x80})
|
||||
} else {
|
||||
w.WriteBytes(obj.WithdrawalsHash[:])
|
||||
}
|
||||
}
|
||||
|
||||
if _tmp3 {
|
||||
_tmp3 := w.List()
|
||||
|
||||
for _, _tmp4 := range obj.TxDependency {
|
||||
_tmp5 := w.List()
|
||||
|
||||
for _, _tmp6 := range _tmp4 {
|
||||
w.WriteUint64(_tmp6)
|
||||
if _tmp3 || _tmp4 {
|
||||
if obj.ExcessDataGas == nil {
|
||||
w.Write(rlp.EmptyString)
|
||||
} else {
|
||||
if obj.ExcessDataGas.Sign() == -1 {
|
||||
return rlp.ErrNegativeBigInt
|
||||
}
|
||||
|
||||
w.ListEnd(_tmp5)
|
||||
w.WriteBigInt(obj.ExcessDataGas)
|
||||
}
|
||||
|
||||
w.ListEnd(_tmp3)
|
||||
}
|
||||
|
||||
if _tmp4 {
|
||||
_tmp5 := w.List()
|
||||
for _, _tmp6 := range obj.TxDependency {
|
||||
_tmp7 := w.List()
|
||||
for _, _tmp8 := range _tmp6 {
|
||||
w.WriteUint64(_tmp8)
|
||||
}
|
||||
w.ListEnd(_tmp7)
|
||||
}
|
||||
w.ListEnd(_tmp5)
|
||||
}
|
||||
w.ListEnd(_tmp0)
|
||||
|
||||
return w.Flush()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,8 +189,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
gpoParams.Default = config.Miner.GasPrice
|
||||
}
|
||||
|
||||
ethereum.APIBackend.gpo = gasprice.NewOracle(ethereum.APIBackend, gpoParams)
|
||||
|
||||
// Override the chain config with provided settings.
|
||||
var overrides core.ChainOverrides
|
||||
if config.OverrideShanghai != nil {
|
||||
|
|
@ -258,6 +256,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
ethereum.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, ethereum.engine, vmConfig, ethereum.shouldPreserve, &config.TxLookupLimit, checker)
|
||||
}
|
||||
|
||||
ethereum.APIBackend.gpo = gasprice.NewOracle(ethereum.APIBackend, gpoParams)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -530,17 +530,17 @@ func (s *Ethereum) StartMining(threads int) error {
|
|||
|
||||
cli.Authorize(eb, wallet.SignData)
|
||||
}
|
||||
}
|
||||
|
||||
if bor, ok := s.engine.(*bor.Bor); ok {
|
||||
wallet, err := s.accountManager.Find(accounts.Account{Address: eb})
|
||||
if wallet == nil || err != nil {
|
||||
log.Error("Etherbase account unavailable locally", "err", err)
|
||||
if bor, ok := s.engine.(*bor.Bor); ok {
|
||||
wallet, err := s.accountManager.Find(accounts.Account{Address: eb})
|
||||
if wallet == nil || err != nil {
|
||||
log.Error("Etherbase account unavailable locally", "err", err)
|
||||
|
||||
return fmt.Errorf("signer missing: %v", err)
|
||||
return fmt.Errorf("signer missing: %v", err)
|
||||
}
|
||||
|
||||
bor.Authorize(eb, wallet.SignData)
|
||||
}
|
||||
|
||||
bor.Authorize(eb, wallet.SignData)
|
||||
}
|
||||
|
||||
// If mining is started, we can disable the transaction rejection mechanism
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func newTester(t *testing.T) *downloadTester {
|
|||
}
|
||||
|
||||
// newTester creates a new downloader test mocker.
|
||||
func newTesterWithNotification(t *testing.T, _ func()) *downloadTester {
|
||||
func newTesterWithNotification(t *testing.T, success func()) *downloadTester {
|
||||
t.Helper()
|
||||
|
||||
freezer := t.TempDir()
|
||||
|
|
@ -95,7 +95,7 @@ func newTesterWithNotification(t *testing.T, _ func()) *downloadTester {
|
|||
}
|
||||
|
||||
//nolint: staticcheck
|
||||
tester.downloader = New(0, db, new(event.TypeMux), tester.chain, nil, tester.dropPeer, nil, whitelist.NewService(10))
|
||||
tester.downloader = New(0, db, new(event.TypeMux), tester.chain, nil, tester.dropPeer, success, whitelist.NewService(10))
|
||||
|
||||
return tester
|
||||
}
|
||||
|
|
@ -1860,8 +1860,6 @@ func TestCheckpointEnforcement67Light(t *testing.T) {
|
|||
}
|
||||
|
||||
func testCheckpointEnforcement(t *testing.T, protocol uint, mode SyncMode) {
|
||||
t.Parallel()
|
||||
|
||||
// Create a new tester with a particular hard coded checkpoint block
|
||||
tester := newTester(t)
|
||||
defer tester.terminate()
|
||||
|
|
@ -1901,7 +1899,6 @@ func TestBeaconSync66Snap(t *testing.T) {
|
|||
|
||||
func testBeaconSync(t *testing.T, protocol uint, mode SyncMode) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
//log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
|
||||
|
||||
var cases = []struct {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ type MockBackendMockRecorder struct {
|
|||
func NewMockBackend(ctrl *gomock.Controller) *MockBackend {
|
||||
mock := &MockBackend{ctrl: ctrl}
|
||||
mock.recorder = &MockBackendMockRecorder{mock}
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +48,6 @@ func (m *MockBackend) BloomStatus() (uint64, uint64) {
|
|||
ret := m.ctrl.Call(m, "BloomStatus")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
ret1, _ := ret[1].(uint64)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +62,6 @@ func (m *MockBackend) ChainConfig() *params.ChainConfig {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainConfig")
|
||||
ret0, _ := ret[0].(*params.ChainConfig)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +76,6 @@ func (m *MockBackend) ChainDb() ethdb.Database {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainDb")
|
||||
ret0, _ := ret[0].(ethdb.Database)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +90,6 @@ func (m *MockBackend) CurrentHeader() *types.Header {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CurrentHeader")
|
||||
ret0, _ := ret[0].(*types.Header)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -105,115 +100,108 @@ func (mr *MockBackendMockRecorder) CurrentHeader() *gomock.Call {
|
|||
}
|
||||
|
||||
// GetBody mocks base method.
|
||||
func (m *MockBackend) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error) {
|
||||
func (m *MockBackend) GetBody(arg0 context.Context, arg1 common.Hash, arg2 rpc.BlockNumber) (*types.Body, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetBody", ctx, hash, number)
|
||||
ret := m.ctrl.Call(m, "GetBody", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*types.Body)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetBody indicates an expected call of GetBody.
|
||||
func (mr *MockBackendMockRecorder) GetBody(ctx, hash, number interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) GetBody(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBody", reflect.TypeOf((*MockBackend)(nil).GetBody), ctx, hash, number)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBody", reflect.TypeOf((*MockBackend)(nil).GetBody), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// GetBorBlockLogs mocks base method.
|
||||
func (m *MockBackend) GetBorBlockLogs(ctx context.Context, blockHash common.Hash) ([]*types.Log, error) {
|
||||
func (m *MockBackend) GetBorBlockLogs(arg0 context.Context, arg1 common.Hash) ([]*types.Log, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetBorBlockLogs", ctx, blockHash)
|
||||
ret := m.ctrl.Call(m, "GetBorBlockLogs", arg0, arg1)
|
||||
ret0, _ := ret[0].([]*types.Log)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetBorBlockLogs indicates an expected call of GetBorBlockLogs.
|
||||
func (mr *MockBackendMockRecorder) GetBorBlockLogs(ctx, blockHash interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) GetBorBlockLogs(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBorBlockLogs", reflect.TypeOf((*MockBackend)(nil).GetBorBlockLogs), ctx, blockHash)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBorBlockLogs", reflect.TypeOf((*MockBackend)(nil).GetBorBlockLogs), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetBorBlockReceipt mocks base method.
|
||||
func (m *MockBackend) GetBorBlockReceipt(ctx context.Context, blockHash common.Hash) (*types.Receipt, error) {
|
||||
func (m *MockBackend) GetBorBlockReceipt(arg0 context.Context, arg1 common.Hash) (*types.Receipt, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetBorBlockReceipt", ctx, blockHash)
|
||||
ret := m.ctrl.Call(m, "GetBorBlockReceipt", arg0, arg1)
|
||||
ret0, _ := ret[0].(*types.Receipt)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetBorBlockReceipt indicates an expected call of GetBorBlockReceipt.
|
||||
func (mr *MockBackendMockRecorder) GetBorBlockReceipt(ctx, blockHash interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) GetBorBlockReceipt(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBorBlockReceipt", reflect.TypeOf((*MockBackend)(nil).GetBorBlockReceipt), ctx, blockHash)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBorBlockReceipt", reflect.TypeOf((*MockBackend)(nil).GetBorBlockReceipt), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetLogs mocks base method.
|
||||
func (m *MockBackend) GetLogs(ctx context.Context, blockHash common.Hash, number uint64) ([][]*types.Log, error) {
|
||||
func (m *MockBackend) GetLogs(arg0 context.Context, arg1 common.Hash, arg2 uint64) ([][]*types.Log, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetLogs", ctx, blockHash, number)
|
||||
ret := m.ctrl.Call(m, "GetLogs", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([][]*types.Log)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetLogs indicates an expected call of GetLogs.
|
||||
func (mr *MockBackendMockRecorder) GetLogs(ctx, blockHash, number interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) GetLogs(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogs", reflect.TypeOf((*MockBackend)(nil).GetLogs), ctx, blockHash, number)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogs", reflect.TypeOf((*MockBackend)(nil).GetLogs), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// GetReceipts mocks base method.
|
||||
func (m *MockBackend) GetReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, error) {
|
||||
func (m *MockBackend) GetReceipts(arg0 context.Context, arg1 common.Hash) (types.Receipts, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetReceipts", ctx, blockHash)
|
||||
ret := m.ctrl.Call(m, "GetReceipts", arg0, arg1)
|
||||
ret0, _ := ret[0].(types.Receipts)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetReceipts indicates an expected call of GetReceipts.
|
||||
func (mr *MockBackendMockRecorder) GetReceipts(ctx, blockHash interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) GetReceipts(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceipts", reflect.TypeOf((*MockBackend)(nil).GetReceipts), ctx, blockHash)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceipts", reflect.TypeOf((*MockBackend)(nil).GetReceipts), arg0, arg1)
|
||||
}
|
||||
|
||||
// HeaderByHash mocks base method.
|
||||
func (m *MockBackend) HeaderByHash(ctx context.Context, blockHash common.Hash) (*types.Header, error) {
|
||||
func (m *MockBackend) HeaderByHash(arg0 context.Context, arg1 common.Hash) (*types.Header, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "HeaderByHash", ctx, blockHash)
|
||||
ret := m.ctrl.Call(m, "HeaderByHash", arg0, arg1)
|
||||
ret0, _ := ret[0].(*types.Header)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// HeaderByHash indicates an expected call of HeaderByHash.
|
||||
func (mr *MockBackendMockRecorder) HeaderByHash(ctx, blockHash interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) HeaderByHash(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByHash", reflect.TypeOf((*MockBackend)(nil).HeaderByHash), ctx, blockHash)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByHash", reflect.TypeOf((*MockBackend)(nil).HeaderByHash), arg0, arg1)
|
||||
}
|
||||
|
||||
// HeaderByNumber mocks base method.
|
||||
func (m *MockBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) {
|
||||
func (m *MockBackend) HeaderByNumber(arg0 context.Context, arg1 rpc.BlockNumber) (*types.Header, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "HeaderByNumber", ctx, blockNr)
|
||||
ret := m.ctrl.Call(m, "HeaderByNumber", arg0, arg1)
|
||||
ret0, _ := ret[0].(*types.Header)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// HeaderByNumber indicates an expected call of HeaderByNumber.
|
||||
func (mr *MockBackendMockRecorder) HeaderByNumber(ctx, blockNr interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) HeaderByNumber(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByNumber", reflect.TypeOf((*MockBackend)(nil).HeaderByNumber), ctx, blockNr)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByNumber", reflect.TypeOf((*MockBackend)(nil).HeaderByNumber), arg0, arg1)
|
||||
}
|
||||
|
||||
// PendingBlockAndReceipts mocks base method.
|
||||
|
|
@ -222,7 +210,6 @@ func (m *MockBackend) PendingBlockAndReceipts() (*types.Block, types.Receipts) {
|
|||
ret := m.ctrl.Call(m, "PendingBlockAndReceipts")
|
||||
ret0, _ := ret[0].(*types.Block)
|
||||
ret1, _ := ret[1].(types.Receipts)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -233,45 +220,43 @@ func (mr *MockBackendMockRecorder) PendingBlockAndReceipts() *gomock.Call {
|
|||
}
|
||||
|
||||
// ServiceFilter mocks base method.
|
||||
func (m *MockBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
|
||||
func (m *MockBackend) ServiceFilter(arg0 context.Context, arg1 *bloombits.MatcherSession) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "ServiceFilter", ctx, session)
|
||||
m.ctrl.Call(m, "ServiceFilter", arg0, arg1)
|
||||
}
|
||||
|
||||
// ServiceFilter indicates an expected call of ServiceFilter.
|
||||
func (mr *MockBackendMockRecorder) ServiceFilter(ctx, session interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) ServiceFilter(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceFilter", reflect.TypeOf((*MockBackend)(nil).ServiceFilter), ctx, session)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceFilter", reflect.TypeOf((*MockBackend)(nil).ServiceFilter), arg0, arg1)
|
||||
}
|
||||
|
||||
// SubscribeChainEvent mocks base method.
|
||||
func (m *MockBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription {
|
||||
func (m *MockBackend) SubscribeChainEvent(arg0 chan<- core.ChainEvent) event.Subscription {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SubscribeChainEvent", ch)
|
||||
ret := m.ctrl.Call(m, "SubscribeChainEvent", arg0)
|
||||
ret0, _ := ret[0].(event.Subscription)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SubscribeChainEvent indicates an expected call of SubscribeChainEvent.
|
||||
func (mr *MockBackendMockRecorder) SubscribeChainEvent(ch interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) SubscribeChainEvent(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeChainEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeChainEvent), ch)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeChainEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeChainEvent), arg0)
|
||||
}
|
||||
|
||||
// SubscribeLogsEvent mocks base method.
|
||||
func (m *MockBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription {
|
||||
func (m *MockBackend) SubscribeLogsEvent(arg0 chan<- []*types.Log) event.Subscription {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SubscribeLogsEvent", ch)
|
||||
ret := m.ctrl.Call(m, "SubscribeLogsEvent", arg0)
|
||||
ret0, _ := ret[0].(event.Subscription)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SubscribeLogsEvent indicates an expected call of SubscribeLogsEvent.
|
||||
func (mr *MockBackendMockRecorder) SubscribeLogsEvent(ch interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) SubscribeLogsEvent(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeLogsEvent), ch)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeLogsEvent), arg0)
|
||||
}
|
||||
|
||||
// SubscribeNewTxsEvent mocks base method.
|
||||
|
|
@ -279,7 +264,6 @@ func (m *MockBackend) SubscribeNewTxsEvent(arg0 chan<- core.NewTxsEvent) event.S
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SubscribeNewTxsEvent", arg0)
|
||||
ret0, _ := ret[0].(event.Subscription)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -290,46 +274,43 @@ func (mr *MockBackendMockRecorder) SubscribeNewTxsEvent(arg0 interface{}) *gomoc
|
|||
}
|
||||
|
||||
// SubscribePendingLogsEvent mocks base method.
|
||||
func (m *MockBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription {
|
||||
func (m *MockBackend) SubscribePendingLogsEvent(arg0 chan<- []*types.Log) event.Subscription {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SubscribePendingLogsEvent", ch)
|
||||
ret := m.ctrl.Call(m, "SubscribePendingLogsEvent", arg0)
|
||||
ret0, _ := ret[0].(event.Subscription)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SubscribePendingLogsEvent indicates an expected call of SubscribePendingLogsEvent.
|
||||
func (mr *MockBackendMockRecorder) SubscribePendingLogsEvent(ch interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) SubscribePendingLogsEvent(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribePendingLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribePendingLogsEvent), ch)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribePendingLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribePendingLogsEvent), arg0)
|
||||
}
|
||||
|
||||
// SubscribeRemovedLogsEvent mocks base method.
|
||||
func (m *MockBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {
|
||||
func (m *MockBackend) SubscribeRemovedLogsEvent(arg0 chan<- core.RemovedLogsEvent) event.Subscription {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SubscribeRemovedLogsEvent", ch)
|
||||
ret := m.ctrl.Call(m, "SubscribeRemovedLogsEvent", arg0)
|
||||
ret0, _ := ret[0].(event.Subscription)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SubscribeRemovedLogsEvent indicates an expected call of SubscribeRemovedLogsEvent.
|
||||
func (mr *MockBackendMockRecorder) SubscribeRemovedLogsEvent(ch interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) SubscribeRemovedLogsEvent(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeRemovedLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeRemovedLogsEvent), ch)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeRemovedLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeRemovedLogsEvent), arg0)
|
||||
}
|
||||
|
||||
// SubscribeStateSyncEvent mocks base method.
|
||||
func (m *MockBackend) SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription {
|
||||
func (m *MockBackend) SubscribeStateSyncEvent(arg0 chan<- core.StateSyncEvent) event.Subscription {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SubscribeStateSyncEvent", ch)
|
||||
ret := m.ctrl.Call(m, "SubscribeStateSyncEvent", arg0)
|
||||
ret0, _ := ret[0].(event.Subscription)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SubscribeStateSyncEvent indicates an expected call of SubscribeStateSyncEvent.
|
||||
func (mr *MockBackendMockRecorder) SubscribeStateSyncEvent(ch interface{}) *gomock.Call {
|
||||
func (mr *MockBackendMockRecorder) SubscribeStateSyncEvent(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeStateSyncEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeStateSyncEvent), ch)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeStateSyncEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeStateSyncEvent), arg0)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ type MockDatabaseMockRecorder struct {
|
|||
func NewMockDatabase(ctrl *gomock.Controller) *MockDatabase {
|
||||
mock := &MockDatabase{ctrl: ctrl}
|
||||
mock.recorder = &MockDatabaseMockRecorder{mock}
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +40,6 @@ func (m *MockDatabase) Ancient(arg0 string, arg1 uint64) ([]byte, error) {
|
|||
ret := m.ctrl.Call(m, "Ancient", arg0, arg1)
|
||||
ret0, _ := ret[0].([]byte)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -51,13 +49,27 @@ func (mr *MockDatabaseMockRecorder) Ancient(arg0, arg1 interface{}) *gomock.Call
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ancient", reflect.TypeOf((*MockDatabase)(nil).Ancient), arg0, arg1)
|
||||
}
|
||||
|
||||
// AncientDatadir mocks base method.
|
||||
func (m *MockDatabase) AncientDatadir() (string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "AncientDatadir")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// AncientDatadir indicates an expected call of AncientDatadir.
|
||||
func (mr *MockDatabaseMockRecorder) AncientDatadir() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AncientDatadir", reflect.TypeOf((*MockDatabase)(nil).AncientDatadir))
|
||||
}
|
||||
|
||||
// AncientRange mocks base method.
|
||||
func (m *MockDatabase) AncientRange(arg0 string, arg1, arg2, arg3 uint64) ([][]byte, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "AncientRange", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].([][]byte)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +85,6 @@ func (m *MockDatabase) AncientSize(arg0 string) (uint64, error) {
|
|||
ret := m.ctrl.Call(m, "AncientSize", arg0)
|
||||
ret0, _ := ret[0].(uint64)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +100,6 @@ func (m *MockDatabase) Ancients() (uint64, error) {
|
|||
ret := m.ctrl.Call(m, "Ancients")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +114,6 @@ func (m *MockDatabase) Close() error {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Close")
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +128,6 @@ func (m *MockDatabase) Compact(arg0, arg1 []byte) error {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Compact", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +142,6 @@ func (m *MockDatabase) Delete(arg0 []byte) error {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Delete", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +157,6 @@ func (m *MockDatabase) Get(arg0 []byte) ([]byte, error) {
|
|||
ret := m.ctrl.Call(m, "Get", arg0)
|
||||
ret0, _ := ret[0].([]byte)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +172,6 @@ func (m *MockDatabase) Has(arg0 []byte) (bool, error) {
|
|||
ret := m.ctrl.Call(m, "Has", arg0)
|
||||
ret0, _ := ret[0].(bool)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -182,7 +187,6 @@ func (m *MockDatabase) HasAncient(arg0 string, arg1 uint64) (bool, error) {
|
|||
ret := m.ctrl.Call(m, "HasAncient", arg0, arg1)
|
||||
ret0, _ := ret[0].(bool)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +201,6 @@ func (m *MockDatabase) MigrateTable(arg0 string, arg1 func([]byte) ([]byte, erro
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MigrateTable", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -213,7 +216,6 @@ func (m *MockDatabase) ModifyAncients(arg0 func(ethdb.AncientWriteOp) error) (in
|
|||
ret := m.ctrl.Call(m, "ModifyAncients", arg0)
|
||||
ret0, _ := ret[0].(int64)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +230,6 @@ func (m *MockDatabase) NewBatch() ethdb.Batch {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NewBatch")
|
||||
ret0, _ := ret[0].(ethdb.Batch)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +244,6 @@ func (m *MockDatabase) NewBatchWithSize(arg0 int) ethdb.Batch {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NewBatchWithSize", arg0)
|
||||
ret0, _ := ret[0].(ethdb.Batch)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +258,6 @@ func (m *MockDatabase) NewIterator(arg0, arg1 []byte) ethdb.Iterator {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NewIterator", arg0, arg1)
|
||||
ret0, _ := ret[0].(ethdb.Iterator)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +273,6 @@ func (m *MockDatabase) NewSnapshot() (ethdb.Snapshot, error) {
|
|||
ret := m.ctrl.Call(m, "NewSnapshot")
|
||||
ret0, _ := ret[0].(ethdb.Snapshot)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +287,6 @@ func (m *MockDatabase) Put(arg0, arg1 []byte) error {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Put", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -300,11 +297,10 @@ func (mr *MockDatabaseMockRecorder) Put(arg0, arg1 interface{}) *gomock.Call {
|
|||
}
|
||||
|
||||
// ReadAncients mocks base method.
|
||||
func (m *MockDatabase) ReadAncients(arg0 func(ethdb.AncientReader) error) error {
|
||||
func (m *MockDatabase) ReadAncients(arg0 func(ethdb.AncientReaderOp) error) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ReadAncients", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +316,6 @@ func (m *MockDatabase) Stat(arg0 string) (string, error) {
|
|||
ret := m.ctrl.Call(m, "Stat", arg0)
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +330,6 @@ func (m *MockDatabase) Sync() error {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Sync")
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +345,6 @@ func (m *MockDatabase) Tail() (uint64, error) {
|
|||
ret := m.ctrl.Call(m, "Tail")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -366,7 +359,6 @@ func (m *MockDatabase) TruncateHead(arg0 uint64) error {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "TruncateHead", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +373,6 @@ func (m *MockDatabase) TruncateTail(arg0 uint64) error {
|
|||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "TruncateTail", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
|
||||
return ret0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ func (cfg Config) withDefaults() Config {
|
|||
return cfg
|
||||
}
|
||||
|
||||
//go:generate mockgen -destination=../../eth/filters/IBackend.go -package=filters . Backend
|
||||
type Backend interface {
|
||||
ChainDb() ethdb.Database
|
||||
HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
|
||||
|
|
|
|||
|
|
@ -103,13 +103,8 @@ func (b *TestBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
func (b *TestBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
|
||||
number := rawdb.ReadHeaderNumber(b.DB, hash)
|
||||
if number == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
receipts := rawdb.ReadReceipts(b.DB, hash, *number, params.TestChainConfig)
|
||||
func (b *TestBackend) GetLogs(ctx context.Context, hash common.Hash, number uint64) ([][]*types.Log, error) {
|
||||
receipts := rawdb.ReadReceipts(b.DB, hash, number, params.TestChainConfig)
|
||||
|
||||
logs := make([][]*types.Log, len(receipts))
|
||||
for i, receipt := range receipts {
|
||||
|
|
@ -175,3 +170,15 @@ func (b *TestBackend) ServiceFilter(ctx context.Context, session *bloombits.Matc
|
|||
func (b *TestBackend) SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription {
|
||||
return b.stateSyncFeed.Subscribe(ch)
|
||||
}
|
||||
|
||||
func (b *TestBackend) ChainConfig() *params.ChainConfig { panic("not implemented") }
|
||||
|
||||
func (b *TestBackend) CurrentHeader() *types.Header { panic("not implemented") }
|
||||
|
||||
func (b *TestBackend) GetBody(context.Context, common.Hash, rpc.BlockNumber) (*types.Body, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (b *TestBackend) PendingBlockAndReceipts() (*types.Block, types.Receipts) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ func newTestBackendWithGenerator(blocks int, shanghai bool, generator func(int,
|
|||
TerminalTotalDifficulty: big.NewInt(0),
|
||||
TerminalTotalDifficultyPassed: true,
|
||||
Ethash: new(params.EthashConfig),
|
||||
Bor: params.TestChainConfig.Bor,
|
||||
}
|
||||
engine = beacon.NewFaker()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1526,13 +1526,13 @@ func getCodeByHash(hash common.Hash) []byte {
|
|||
|
||||
// makeAccountTrieNoStorage spits out a trie, along with the leafs
|
||||
func makeAccountTrieNoStorage(n int) (string, *trie.Trie, entrySlice) {
|
||||
// nolint:prealloc
|
||||
var (
|
||||
db = trie.NewDatabase(rawdb.NewMemoryDatabase())
|
||||
accTrie = trie.NewEmpty(db)
|
||||
entries entrySlice
|
||||
)
|
||||
|
||||
entries := make(entrySlice, uint64(n))
|
||||
|
||||
for i := uint64(1); i <= uint64(n); i++ {
|
||||
value, _ := rlp.EncodeToBytes(&types.StateAccount{
|
||||
Nonce: i,
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ func TestSnapSyncDisabling67(t *testing.T) {
|
|||
// Tests that snap sync gets disabled as soon as a real block is successfully
|
||||
// imported into the blockchain.
|
||||
func testSnapSyncDisabling(t *testing.T, ethVer uint, snapVer uint) {
|
||||
t.Parallel()
|
||||
|
||||
// Create an empty handler and ensure it's in snap sync mode
|
||||
empty := newTestHandler()
|
||||
if atomic.LoadUint32(&empty.handler.snapSync) == 0 {
|
||||
|
|
|
|||
|
|
@ -1193,6 +1193,8 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
|
|||
return ðapi.ExecutionResult{
|
||||
StructLogs: make([]ethapi.StructLogRes, 0),
|
||||
}, nil
|
||||
} else {
|
||||
return nil, errTxNotFound
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,11 +66,12 @@ type testBackend struct {
|
|||
// invoked in order to release associated resources.
|
||||
func newTestBackend(t *testing.T, n int, gspec *core.Genesis, generator func(i int, b *core.BlockGen)) *testBackend {
|
||||
backend := &testBackend{
|
||||
chainConfig: gspec.Config,
|
||||
chainConfig: params.TestChainConfig,
|
||||
engine: ethash.NewFaker(),
|
||||
chaindb: rawdb.NewMemoryDatabase(),
|
||||
}
|
||||
// Generate blocks for testing
|
||||
gspec.Config = backend.chainConfig
|
||||
_, blocks, _ := core.GenerateChainWithGenesis(gspec, backend.engine, n, generator)
|
||||
|
||||
// Import the canonical chain
|
||||
|
|
|
|||
|
|
@ -37,6 +37,13 @@
|
|||
"clique": {
|
||||
"period": 0,
|
||||
"epoch": 30000
|
||||
},
|
||||
"bor": {
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"burntContract": {
|
||||
"0": "0x00000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -41,7 +41,14 @@
|
|||
"londonBlock": 12965000,
|
||||
"arrowGlacierBlock": 13773000,
|
||||
"grayGlacierBlock": 15050000,
|
||||
"ethash": {}
|
||||
"ethash": {},
|
||||
"bor": {
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"burntContract": {
|
||||
"0": "0x00000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,14 @@
|
|||
"arrowGlacierBlock": 13773000,
|
||||
"grayGlacierBlock": 15050000,
|
||||
"terminalTotalDifficultyPassed": true,
|
||||
"ethash": {}
|
||||
"ethash": {},
|
||||
"bor": {
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"burntContract": {
|
||||
"0": "0x0000000000000000000000000000000000000dead"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,14 @@
|
|||
"londonBlock": 12965000,
|
||||
"arrowGlacierBlock": 13773000,
|
||||
"grayGlacierBlock": 15050000,
|
||||
"ethash": {}
|
||||
"ethash": {},
|
||||
"bor": {
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"burntContract": {
|
||||
"0": "0x00000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,14 @@
|
|||
"londonBlock": 12965000,
|
||||
"arrowGlacierBlock": 13773000,
|
||||
"grayGlacierBlock": 15050000,
|
||||
"ethash": {}
|
||||
"ethash": {},
|
||||
"bor": {
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"burntContract": {
|
||||
"0": "0x00000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,14 @@
|
|||
"eip155Block": 10,
|
||||
"eip158Block": 10,
|
||||
"ethash": {},
|
||||
"homesteadBlock": 0
|
||||
"homesteadBlock": 0,
|
||||
"bor": {
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"burntContract": {
|
||||
"0": "0x00000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"difficulty": "3509749784",
|
||||
"extraData": "0x4554482e45544846414e532e4f52472d4641313738394444",
|
||||
|
|
|
|||
|
|
@ -61,7 +61,14 @@
|
|||
"londonBlock": 12965000,
|
||||
"arrowGlacierBlock": 13773000,
|
||||
"grayGlacierBlock": 15050000,
|
||||
"ethash": {}
|
||||
"ethash": {},
|
||||
"bor": {
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"burntContract": {
|
||||
"0": "0x00000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
|
|
|
|||
|
|
@ -541,7 +541,8 @@ func (t *Transaction) getLogs(ctx context.Context, hash common.Hash) (*[]*Log, e
|
|||
return nil, err
|
||||
}
|
||||
|
||||
ret := make([]*Log, len(logs))
|
||||
// nolint:prealloc
|
||||
var ret []*Log
|
||||
// Select tx logs from all block logs
|
||||
ix := sort.Search(len(logs), func(i int) bool { return uint64(logs[i].TxIndex) >= t.index })
|
||||
for ix < len(logs) && uint64(logs[ix].TxIndex) == t.index {
|
||||
|
|
|
|||
|
|
@ -342,13 +342,13 @@ func TestGraphQLConcurrentResolvers(t *testing.T) {
|
|||
// Multiple txes race to get/set the block hash.
|
||||
{
|
||||
body: "{block { transactions { logs { account { address } } } } }",
|
||||
want: fmt.Sprintf(`{"block":{"transactions":[{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}}]}]}}`, dadStr, dadStr, dadStr, dadStr, dadStr, dadStr),
|
||||
want: fmt.Sprintf(`{"block":{"transactions":[{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}},{"account":{"address":"%s"}}]}]}}`, dadStr, dadStr, core.GetFeeAddress(), dadStr, dadStr, core.GetFeeAddress(), dadStr, dadStr, core.GetFeeAddress()),
|
||||
},
|
||||
// Multiple fields of a tx race to resolve it. Happens in this case
|
||||
// because resolving the tx body belonging to a log is delayed.
|
||||
{
|
||||
body: `{block { logs(filter: {}) { transaction { nonce value gasPrice }}}}`,
|
||||
want: `{"block":{"logs":[{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}}]}}`,
|
||||
want: `{"block":{"logs":[{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}}]}}`,
|
||||
},
|
||||
// Multiple txes of a block race to set/retrieve receipts of a block.
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,19 +79,19 @@ func NewBorDefaultMiner(t *testing.T) *DefaultBorMiner {
|
|||
func createBorMiner(t *testing.T, ethAPIMock api.Caller, spanner bor.Spanner, heimdallClientMock bor.IHeimdallClient, contractMock bor.GenesisContract) (*Miner, *event.TypeMux, func(skipMiner bool)) {
|
||||
t.Helper()
|
||||
|
||||
addr0 := common.Address{0x1}
|
||||
// addr0 := common.Address{0x1}
|
||||
|
||||
genspec := &core.Genesis{
|
||||
Alloc: map[common.Address]core.GenesisAccount{
|
||||
addr0: {
|
||||
Balance: big.NewInt(0),
|
||||
Code: []byte{0x1, 0x1},
|
||||
},
|
||||
},
|
||||
}
|
||||
// genspec := &core.Genesis{
|
||||
// Alloc: map[common.Address]core.GenesisAccount{
|
||||
// addr0: {
|
||||
// Balance: big.NewInt(0),
|
||||
// Code: []byte{0x1, 0x1},
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
|
||||
// Create Ethash config
|
||||
chainDB, _, chainConfig := NewDBForFakes(t)
|
||||
chainDB, genspec, chainConfig := NewDBForFakes(t)
|
||||
|
||||
engine := NewFakeBor(t, chainDB, chainConfig, ethAPIMock, spanner, heimdallClientMock, contractMock)
|
||||
|
||||
|
|
@ -200,6 +200,7 @@ type testBlockChain struct {
|
|||
func (bc *testBlockChain) CurrentBlock() *types.Header {
|
||||
return &types.Header{
|
||||
GasLimit: bc.gasLimit,
|
||||
Number: new(big.Int),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@ import (
|
|||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/ethereum/go-ethereum/accounts" // nolint:typecheck
|
||||
"github.com/ethereum/go-ethereum/consensus/bor"
|
||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/txpool"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"math/big"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts" // nolint:typecheck
|
||||
"github.com/ethereum/go-ethereum/consensus/bor"
|
||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/txpool"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
cmath "github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/common/tracing"
|
||||
|
|
@ -122,7 +122,7 @@ func newTestWorkerBackend(t TensingObject, chainConfig *params.ChainConfig, engi
|
|||
|
||||
genesis := gspec.MustCommit(db)
|
||||
|
||||
chain, _ := core.NewBlockChain(rawdb.NewMemoryDatabase(), &core.CacheConfig{TrieDirtyDisabled: true}, &gspec, nil, engine, vm.Config{}, nil, nil, nil)
|
||||
chain, _ := core.NewBlockChain(db, &core.CacheConfig{TrieDirtyDisabled: true}, &gspec, nil, engine, vm.Config{}, nil, nil, nil)
|
||||
txpool := txpool.NewTxPool(testTxPoolConfig, chainConfig, chain)
|
||||
|
||||
// Generate a small n-block chain and an uncle block for it
|
||||
|
|
|
|||
|
|
@ -1678,7 +1678,7 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
|
|||
}()
|
||||
|
||||
if !noempty && w.interruptCommitFlag {
|
||||
block := w.chain.GetBlockByHash(w.chain.CurrentBlock().TxHash)
|
||||
block := w.chain.GetBlockByHash(w.chain.CurrentBlock().Hash())
|
||||
interruptCtx, stopFn = getInterruptTimer(ctx, work, block)
|
||||
// nolint : staticcheck
|
||||
interruptCtx = vm.PutCache(interruptCtx, w.interruptedTxCache)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/txpool"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
|
|
@ -45,38 +44,39 @@ import (
|
|||
"github.com/ethereum/go-ethereum/tests/bor/mocks"
|
||||
)
|
||||
|
||||
func init() {
|
||||
testTxPoolConfig = txpool.DefaultConfig
|
||||
testTxPoolConfig.Journal = ""
|
||||
ethashChainConfig = new(params.ChainConfig)
|
||||
*ethashChainConfig = *params.TestChainConfig
|
||||
cliqueChainConfig = new(params.ChainConfig)
|
||||
*cliqueChainConfig = *params.TestChainConfig
|
||||
cliqueChainConfig.Clique = ¶ms.CliqueConfig{
|
||||
Period: 10,
|
||||
Epoch: 30000,
|
||||
}
|
||||
// TODO(raneet10): Duplicate initialization from miner/test_backend.go . Recheck whether we need both
|
||||
// func init() {
|
||||
// testTxPoolConfig = txpool.DefaultConfig
|
||||
// testTxPoolConfig.Journal = ""
|
||||
// ethashChainConfig = new(params.ChainConfig)
|
||||
// *ethashChainConfig = *params.TestChainConfig
|
||||
// cliqueChainConfig = new(params.ChainConfig)
|
||||
// *cliqueChainConfig = *params.TestChainConfig
|
||||
// cliqueChainConfig.Clique = ¶ms.CliqueConfig{
|
||||
// Period: 10,
|
||||
// Epoch: 30000,
|
||||
// }
|
||||
|
||||
signer := types.LatestSigner(params.TestChainConfig)
|
||||
tx1 := types.MustSignNewTx(testBankKey, signer, &types.AccessListTx{
|
||||
ChainID: params.TestChainConfig.ChainID,
|
||||
Nonce: 0,
|
||||
To: &testUserAddress,
|
||||
Value: big.NewInt(1000),
|
||||
Gas: params.TxGas,
|
||||
GasPrice: big.NewInt(params.InitialBaseFee),
|
||||
})
|
||||
pendingTxs = append(pendingTxs, tx1)
|
||||
// signer := types.LatestSigner(params.TestChainConfig)
|
||||
// tx1 := types.MustSignNewTx(testBankKey, signer, &types.AccessListTx{
|
||||
// ChainID: params.TestChainConfig.ChainID,
|
||||
// Nonce: 0,
|
||||
// To: &testUserAddress,
|
||||
// Value: big.NewInt(1000),
|
||||
// Gas: params.TxGas,
|
||||
// GasPrice: big.NewInt(params.InitialBaseFee),
|
||||
// })
|
||||
// pendingTxs = append(pendingTxs, tx1)
|
||||
|
||||
tx2 := types.MustSignNewTx(testBankKey, signer, &types.LegacyTx{
|
||||
Nonce: 1,
|
||||
To: &testUserAddress,
|
||||
Value: big.NewInt(1000),
|
||||
Gas: params.TxGas,
|
||||
GasPrice: big.NewInt(params.InitialBaseFee),
|
||||
})
|
||||
newTxs = append(newTxs, tx2)
|
||||
}
|
||||
// tx2 := types.MustSignNewTx(testBankKey, signer, &types.LegacyTx{
|
||||
// Nonce: 1,
|
||||
// To: &testUserAddress,
|
||||
// Value: big.NewInt(1000),
|
||||
// Gas: params.TxGas,
|
||||
// GasPrice: big.NewInt(params.InitialBaseFee),
|
||||
// })
|
||||
// newTxs = append(newTxs, tx2)
|
||||
// }
|
||||
|
||||
// newTestWorker creates a new test worker with the given parameters.
|
||||
// nolint:unparam
|
||||
|
|
@ -707,7 +707,7 @@ func testCommitInterruptExperimentBorContract(t *testing.T, delay uint, txCount
|
|||
|
||||
chainConfig = params.BorUnittestChainConfig
|
||||
|
||||
log.Root().SetHandler(log.LvlFilterHandler(4, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
|
||||
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
|
||||
|
||||
engine, ctrl = getFakeBorFromConfig(t, chainConfig)
|
||||
|
||||
|
|
@ -735,9 +735,7 @@ func testCommitInterruptExperimentBorContract(t *testing.T, delay uint, txCount
|
|||
txs = append(txs, tx)
|
||||
}
|
||||
|
||||
if err := b.TxPool().AddRemotes(txs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b.TxPool().AddRemotes(txs)
|
||||
|
||||
// Start mining!
|
||||
w.start()
|
||||
|
|
@ -763,7 +761,7 @@ func testCommitInterruptExperimentBor(t *testing.T, delay uint, txCount int, opc
|
|||
|
||||
chainConfig = params.BorUnittestChainConfig
|
||||
|
||||
log.Root().SetHandler(log.LvlFilterHandler(4, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
|
||||
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
|
||||
|
||||
engine, ctrl = getFakeBorFromConfig(t, chainConfig)
|
||||
|
||||
|
|
@ -783,9 +781,7 @@ func testCommitInterruptExperimentBor(t *testing.T, delay uint, txCount int, opc
|
|||
txs = append(txs, tx)
|
||||
}
|
||||
|
||||
if err := b.TxPool().AddRemotes(txs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b.TxPool().AddRemotes(txs)
|
||||
|
||||
// Start mining!
|
||||
w.start()
|
||||
|
|
|
|||
|
|
@ -447,6 +447,7 @@ var (
|
|||
TerminalTotalDifficultyPassed: false,
|
||||
Ethash: new(EthashConfig),
|
||||
Clique: nil,
|
||||
Bor: &BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
|
||||
}
|
||||
|
||||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
||||
|
|
@ -476,6 +477,7 @@ var (
|
|||
TerminalTotalDifficultyPassed: false,
|
||||
Ethash: nil,
|
||||
Clique: &CliqueConfig{Period: 0, Epoch: 30000},
|
||||
Bor: &BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
|
||||
}
|
||||
|
||||
// TestChainConfig contains every protocol change (EIPs) introduced
|
||||
|
|
@ -505,6 +507,10 @@ var (
|
|||
TerminalTotalDifficultyPassed: false,
|
||||
Ethash: new(EthashConfig),
|
||||
Clique: nil,
|
||||
Bor: &BorConfig{
|
||||
Sprint: map[string]uint64{
|
||||
"0": 4},
|
||||
BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
|
||||
}
|
||||
|
||||
// NonActivatedConfig defines the chain configuration without activating
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ func areDifferentHashes(receipts []map[string]interface{}) bool {
|
|||
}
|
||||
|
||||
// Test for GetTransactionReceiptsByBlock
|
||||
func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi.PublicBlockChainAPI) {
|
||||
func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi.BlockChainAPI) {
|
||||
// check 1 : zero transactions
|
||||
receiptsOut, err := publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(1))
|
||||
if err != nil {
|
||||
|
|
@ -101,7 +101,7 @@ func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi
|
|||
}
|
||||
|
||||
// Test for GetTransactionByBlockNumberAndIndex
|
||||
func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPoolAPI *ethapi.PublicTransactionPoolAPI) {
|
||||
func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPoolAPI *ethapi.TransactionAPI) {
|
||||
// check 1 : False ( no transaction )
|
||||
tx := publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(1), 0)
|
||||
assert.Nil(t, tx)
|
||||
|
|
@ -249,7 +249,7 @@ func TestAPIs(t *testing.T) {
|
|||
|
||||
// Testing GetTransactionByBlockNumberAndIndex
|
||||
nonceLock := new(ethapi.AddrLocker)
|
||||
publicTransactionPoolAPI := ethapi.NewPublicTransactionPoolAPI(backend.APIBackend, nonceLock)
|
||||
publicTransactionPoolAPI := ethapi.NewTransactionAPI(backend.APIBackend, nonceLock)
|
||||
testGetTransactionByBlockNumberAndIndex(t, publicTransactionPoolAPI)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -386,8 +386,7 @@ func TestInsertingSpanSizeBlocks(t *testing.T) {
|
|||
|
||||
_bor.SetHeimdallClient(h)
|
||||
|
||||
db := init.ethereum.ChainDb()
|
||||
block := init.genesis.ToBlock(db)
|
||||
block := init.genesis.ToBlock()
|
||||
// to := int64(block.Header().Time)
|
||||
|
||||
currentValidators := []*valset.Validator{valset.NewValidator(addr, 10)}
|
||||
|
|
@ -425,8 +424,7 @@ func TestFetchStateSyncEvents(t *testing.T) {
|
|||
defer _bor.Close()
|
||||
|
||||
// A. Insert blocks for 0th sprint
|
||||
db := init.ethereum.ChainDb()
|
||||
block := init.genesis.ToBlock(db)
|
||||
block := init.genesis.ToBlock()
|
||||
|
||||
// B.1 Mock /bor/span/1
|
||||
res, _ := loadSpanFromFile(t)
|
||||
|
|
@ -525,8 +523,7 @@ func TestFetchStateSyncEvents_2(t *testing.T) {
|
|||
_bor.SetHeimdallClient(h)
|
||||
|
||||
// Insert blocks for 0th sprint
|
||||
db := init.ethereum.ChainDb()
|
||||
block := init.genesis.ToBlock(db)
|
||||
block := init.genesis.ToBlock()
|
||||
|
||||
var currentValidators []*valset.Validator
|
||||
|
||||
|
|
@ -702,8 +699,7 @@ func TestSignerNotFound(t *testing.T) {
|
|||
|
||||
_bor.SetHeimdallClient(h)
|
||||
|
||||
db := init.ethereum.ChainDb()
|
||||
block := init.genesis.ToBlock(db)
|
||||
block := init.genesis.ToBlock()
|
||||
|
||||
// random signer account that is not a part of the validator set
|
||||
const signer = "3714d99058cd64541433d59c6b391555b2fd9b54629c2b717a6c9c00d1127b6b"
|
||||
|
|
@ -802,7 +798,7 @@ func TestEIP1559Transition(t *testing.T) {
|
|||
diskdb := rawdb.NewMemoryDatabase()
|
||||
gspec.MustCommit(diskdb)
|
||||
|
||||
chain, err := core.NewBlockChain(diskdb, nil, gspec.Config, engine, vm.Config{}, nil, nil, nil)
|
||||
chain, err := core.NewBlockChain(diskdb, nil, gspec, nil, engine, vm.Config{}, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create tester chain: %v", err)
|
||||
}
|
||||
|
|
@ -1095,7 +1091,7 @@ func TestTransitionWithoutEIP155(t *testing.T) {
|
|||
diskdb := rawdb.NewMemoryDatabase()
|
||||
gspec.MustCommit(diskdb)
|
||||
|
||||
chain, err := core.NewBlockChain(diskdb, nil, gspec.Config, engine, vm.Config{}, nil, nil, nil)
|
||||
chain, err := core.NewBlockChain(diskdb, nil, gspec, nil, engine, vm.Config{}, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create tester chain: %v", err)
|
||||
}
|
||||
|
|
@ -1116,8 +1112,7 @@ func TestJaipurFork(t *testing.T) {
|
|||
_bor := engine.(*bor.Bor)
|
||||
defer _bor.Close()
|
||||
|
||||
db := init.ethereum.ChainDb()
|
||||
block := init.genesis.ToBlock(db)
|
||||
block := init.genesis.ToBlock()
|
||||
|
||||
res, _ := loadSpanFromFile(t)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/txpool"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
|
@ -219,7 +220,7 @@ func buildNextBlock(t *testing.T, _bor consensus.Engine, chain *core.BlockChain,
|
|||
ctx := context.Background()
|
||||
|
||||
// Finalize and seal the block
|
||||
block, _ := _bor.FinalizeAndAssemble(ctx, chain, b.header, state, b.txs, nil, b.receipts)
|
||||
block, _ := _bor.FinalizeAndAssemble(ctx, chain, b.header, state, b.txs, nil, b.receipts, []*types.Withdrawal{})
|
||||
|
||||
// Write state changes to db
|
||||
root, err := state.Commit(chain.Config().IsEIP158(b.header.Number))
|
||||
|
|
@ -227,7 +228,7 @@ func buildNextBlock(t *testing.T, _bor consensus.Engine, chain *core.BlockChain,
|
|||
panic(fmt.Sprintf("state write error: %v", err))
|
||||
}
|
||||
|
||||
if err := state.Database().TrieDB().Commit(root, false, nil); err != nil {
|
||||
if err := state.Database().TrieDB().Commit(root, false); err != nil {
|
||||
panic(fmt.Sprintf("trie write error: %v", err))
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +256,7 @@ func (b *blockGen) addTxWithChain(bc *core.BlockChain, statedb *state.StateDB, t
|
|||
b.setCoinbase(coinbase)
|
||||
}
|
||||
|
||||
statedb.Prepare(tx.Hash(), len(b.txs))
|
||||
statedb.SetTxContext(tx.Hash(), len(b.txs))
|
||||
|
||||
receipt, err := core.ApplyTransaction(bc.Config(), bc, &b.header.Coinbase, b.gasPool, statedb, b.header, tx, &b.header.GasUsed, vm.Config{}, nil)
|
||||
if err != nil {
|
||||
|
|
@ -433,7 +434,8 @@ func InitGenesis(t *testing.T, faucets []*ecdsa.PrivateKey, fileLocation string,
|
|||
}
|
||||
|
||||
genesis.Config.ChainID = big.NewInt(15001)
|
||||
genesis.Config.EIP150Hash = common.Hash{}
|
||||
genesis.Config.EIP150Block = big.NewInt(0)
|
||||
|
||||
genesis.Config.Bor.Sprint["0"] = sprintSize
|
||||
|
||||
return genesis
|
||||
|
|
@ -466,7 +468,7 @@ func InitMiner(genesis *core.Genesis, privKey *ecdsa.PrivateKey, withoutHeimdall
|
|||
SyncMode: downloader.FullSync,
|
||||
DatabaseCache: 256,
|
||||
DatabaseHandles: 256,
|
||||
TxPool: core.DefaultTxPoolConfig,
|
||||
TxPool: txpool.DefaultConfig,
|
||||
GPO: ethconfig.Defaults.GPO,
|
||||
Ethash: ethconfig.Defaults.Ethash,
|
||||
Miner: miner.Config{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ type MockIHeimdallClientMockRecorder struct {
|
|||
func NewMockIHeimdallClient(ctrl *gomock.Controller) *MockIHeimdallClient {
|
||||
mock := &MockIHeimdallClient{ctrl: ctrl}
|
||||
mock.recorder = &MockIHeimdallClientMockRecorder{mock}
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +55,6 @@ func (m *MockIHeimdallClient) FetchCheckpoint(arg0 context.Context, arg1 int64)
|
|||
ret := m.ctrl.Call(m, "FetchCheckpoint", arg0, arg1)
|
||||
ret0, _ := ret[0].(*checkpoint.Checkpoint)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +70,6 @@ func (m *MockIHeimdallClient) FetchCheckpointCount(arg0 context.Context) (int64,
|
|||
ret := m.ctrl.Call(m, "FetchCheckpointCount", arg0)
|
||||
ret0, _ := ret[0].(int64)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +85,6 @@ func (m *MockIHeimdallClient) Span(arg0 context.Context, arg1 uint64) (*span.Hei
|
|||
ret := m.ctrl.Call(m, "Span", arg0, arg1)
|
||||
ret0, _ := ret[0].(*span.HeimdallSpan)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +100,6 @@ func (m *MockIHeimdallClient) StateSyncEvents(arg0 context.Context, arg1 uint64,
|
|||
ret := m.ctrl.Call(m, "StateSyncEvents", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]*clerk.EventRecordWithTime)
|
||||
ret1, _ := ret[1].(error)
|
||||
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,6 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
|
|||
buf := new(bytes.Buffer)
|
||||
w := bufio.NewWriter(buf)
|
||||
config.Tracer = logger.NewJSONLogger(&logger.Config{}, w)
|
||||
config.Debug, config.Tracer = true, tracer
|
||||
err2 := test(config)
|
||||
if !reflect.DeepEqual(err, err2) {
|
||||
t.Errorf("different error for second run: %v", err2)
|
||||
|
|
|
|||
Loading…
Reference in a new issue