diff --git a/consensus/taiko/consensus.go b/consensus/taiko/consensus.go index 3ec5255c134d..0638649b1e32 100644 --- a/consensus/taiko/consensus.go +++ b/consensus/taiko/consensus.go @@ -243,6 +243,17 @@ func (t *Taiko) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *t return types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)), nil } +// CHANGE(taiko): same as FinalizeAndAssemble but just don't validate anchor tx in taiko engine. +func (t *Taiko) FinalizeAndAssembleWithoutAnchorTx(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, error) { + if body.Withdrawals == nil { + body.Withdrawals = make([]*types.Withdrawal, 0) + } + + // Finalize block + t.Finalize(chain, header, state, body) + return types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)), nil +} + // Seal generates a new sealing request for the given input block and pushes // the result into the given channel. // diff --git a/miner/worker.go b/miner/worker.go index 434f698370dc..3f21bbb23c0a 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/misc/eip1559" "github.com/ethereum/go-ethereum/consensus/misc/eip4844" + "github.com/ethereum/go-ethereum/consensus/taiko" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/stateless" @@ -125,10 +126,20 @@ func (miner *Miner) generateWork(params *generateParams, witness bool) *newPaylo } body.Requests = requests } - block, err := miner.engine.FinalizeAndAssemble(miner.chain, work.header, work.state, &body, work.receipts) + + // CHANGE(taiko): If the calling path is from miner.Pending and the engine is taiko engine then use `FinalizeAndAssembleWithoutAnchorTx`. + var block *types.Block + switch miner.engine.(type) { + case *taiko.Taiko: + engine := miner.engine.(*taiko.Taiko) + block, err = engine.FinalizeAndAssembleWithoutAnchorTx(miner.chain, work.header, work.state, &body, work.receipts) + default: + block, err = miner.engine.FinalizeAndAssemble(miner.chain, work.header, work.state, &body, work.receipts) + } if err != nil { return &newPayloadResult{err: err} } + return &newPayloadResult{ block: block, fees: totalFees(block, work.receipts),