Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions op-node/rollup/derive/engine_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (
"io"
"time"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"

"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
Expand Down Expand Up @@ -238,17 +241,29 @@ func (eq *EngineQueue) forceNextSafeAttributes(ctx context.Context) error {
SafeBlockHash: eq.safeHead.Hash,
FinalizedBlockHash: eq.finalized.Hash,
}
payload, rpcErr, payloadErr := InsertHeadBlock(ctx, eq.log, eq.engine, fc, eq.safeAttributes[0], true)
attrs := eq.safeAttributes[0]
payload, rpcErr, payloadErr := InsertHeadBlock(ctx, eq.log, eq.engine, fc, attrs, true)
if rpcErr != nil {
// RPC errors are recoverable, we can retry the buffered payload attributes later.
eq.log.Error("failed to insert new block", "err", rpcErr)
return nil
}
if payloadErr != nil {
// invalid payloads are dropped, we move on to the next attributes
eq.log.Warn("could not derive valid payload from L1 data", "err", payloadErr)
eq.safeAttributes = eq.safeAttributes[1:]
return nil
eq.log.Warn("could not process payload derived from L1 data", "err", payloadErr)
// filter everything but the deposits
var deposits []hexutil.Bytes
for _, tx := range attrs.Transactions {
if len(tx) > 0 && tx[0] == types.DepositTxType {
deposits = append(deposits, tx)
}
}
if len(attrs.Transactions) > len(deposits) {
eq.log.Warn("dropping sequencer transactions from payload for re-attempt, batcher may have included invalid transactions",
"txs", len(attrs.Transactions), "deposits", len(deposits), "parent", eq.safeHead)
eq.safeAttributes[0].Transactions = deposits
return nil
}
return fmt.Errorf("critical: failed to process block with only deposit transactions: %v", payloadErr)
}
ref, err := PayloadToBlockRef(payload, &eq.cfg.Genesis)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions op-node/rollup/derive/engine_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func InsertHeadBlock(ctx context.Context, log log.Logger, eng Engine, fc eth.For
if err != nil {
return nil, fmt.Errorf("failed to create new block via forkchoice: %w", err), nil
}
if fcRes.PayloadStatus.Status == eth.ExecutionInvalid || fcRes.PayloadStatus.Status == eth.ExecutionInvalidBlockHash {
return nil, nil, eth.ForkchoiceUpdateErr(fcRes.PayloadStatus)
}
if fcRes.PayloadStatus.Status != eth.ExecutionValid {
return nil, eth.ForkchoiceUpdateErr(fcRes.PayloadStatus), nil
}
Expand All @@ -94,6 +97,9 @@ func InsertHeadBlock(ctx context.Context, log log.Logger, eng Engine, fc eth.For
if err != nil {
return nil, fmt.Errorf("failed to insert execution payload: %w", err), nil
}
if status.Status == eth.ExecutionInvalid || status.Status == eth.ExecutionInvalidBlockHash {
return nil, nil, eth.NewPayloadErr(payload, status)
}
if status.Status != eth.ExecutionValid {
return nil, eth.NewPayloadErr(payload, status), nil
}
Expand Down