From a835f4cf0af6861374d12d3273116e0055466691 Mon Sep 17 00:00:00 2001 From: Krish Date: Tue, 5 Nov 2024 16:29:00 +0800 Subject: [PATCH] feat: handle sequencer recover related logic --- op-node/rollup/attributes/attributes.go | 4 ++++ op-node/rollup/derive/engine_update.go | 2 +- op-service/eth/status.go | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/op-node/rollup/attributes/attributes.go b/op-node/rollup/attributes/attributes.go index 52f04170c4..a2ca56ff1b 100644 --- a/op-node/rollup/attributes/attributes.go +++ b/op-node/rollup/attributes/attributes.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io" + "strings" "time" "github.com/ethereum/go-ethereum" @@ -153,6 +154,9 @@ func (eq *AttributesHandler) forceNextSafeAttributes(ctx context.Context, attrib _ = eq.ec.CancelPayload(ctx, true) return derive.NewResetError(fmt.Errorf("need reset to resolve pre-state problem: %w", err)) case derive.BlockInsertPayloadErr: + if strings.Contains(err.Error(), "INCONSISTENT") { + return derive.NewTemporaryError(fmt.Errorf("temporarily cannot insert new safe block: %w", err)) + } _ = eq.ec.CancelPayload(ctx, true) eq.log.Warn("could not process payload derived from L1 data, dropping batch", "err", err) // Count the number of deposits to see if the tx list is deposit only. diff --git a/op-node/rollup/derive/engine_update.go b/op-node/rollup/derive/engine_update.go index d3e3c8bf19..30226d35d0 100644 --- a/op-node/rollup/derive/engine_update.go +++ b/op-node/rollup/derive/engine_update.go @@ -166,7 +166,7 @@ func confirmPayload( if err != nil { return nil, BlockInsertTemporaryErr, fmt.Errorf("failed to insert execution payload: %w", err) } - if status.Status == eth.ExecutionInvalid || status.Status == eth.ExecutionInvalidBlockHash { + if status.Status == eth.ExecutionInvalid || status.Status == eth.ExecutionInvalidBlockHash || status.Status == eth.ExecutionInconsistent { agossip.Clear() return nil, BlockInsertPayloadErr, eth.NewPayloadErr(payload, status) } diff --git a/op-service/eth/status.go b/op-service/eth/status.go index 3baab5725f..def3faef7f 100644 --- a/op-service/eth/status.go +++ b/op-service/eth/status.go @@ -34,6 +34,8 @@ func NewPayloadErr(payload *ExecutionPayload, payloadStatus *PayloadStatusV1) er return fmt.Errorf("engine is misconfigured. Received invalid-terminal-block error while engine API should be active at genesis. err: %v", payloadStatus.ValidationError) case ExecutionAccepted: return fmt.Errorf("execution payload cannot be validated yet, latest valid hash is %s", payloadStatus.LatestValidHash) + case ExecutionInconsistent: + return fmt.Errorf("execution payload meets an INCONSISTENT status, latest valid hash is %s", payloadStatus.LatestValidHash) default: return fmt.Errorf("unknown execution status on %s: %q, ", payload.ID(), string(payloadStatus.Status)) }