From a5f27ba02798aebec0639a79720e221e34b632c9 Mon Sep 17 00:00:00 2001 From: Rez Date: Tue, 21 Jan 2025 06:25:38 -0500 Subject: [PATCH] chore(engine): Remove Unused Errors and Functions (#2384) --- consensus-types/types/payload_requests.go | 2 +- engine-primitives/errors/errors.go | 9 ++----- execution/engine/engine.go | 30 ++--------------------- 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/consensus-types/types/payload_requests.go b/consensus-types/types/payload_requests.go index 5c717d69c0..4834ca6fc3 100644 --- a/consensus-types/types/payload_requests.go +++ b/consensus-types/types/payload_requests.go @@ -115,7 +115,7 @@ func (n *NewPayloadRequest) HasValidVersionedAndBlockHashes() error { gethprimitives.NewStackTrie(nil), ) - // Verify that the payload is telling the truth about it's block hash. + // Verify that the payload is telling the truth about its block hash. //#nosec:G103 // its okay. if block := gethprimitives.NewBlockWithHeader( &gethprimitives.Header{ diff --git a/engine-primitives/errors/errors.go b/engine-primitives/errors/errors.go index 26bddb2224..9989a1c573 100644 --- a/engine-primitives/errors/errors.go +++ b/engine-primitives/errors/errors.go @@ -68,13 +68,8 @@ var ( // ErrInvalidPayloadStatus indicates an invalid payload status. ErrInvalidPayloadStatus = errors.New( - "payload status is INVALID") - - // ErrInvalidBlockHashPayloadStatus indicates a failure in validating the - // block hash for the payload. - ErrInvalidBlockHashPayloadStatus = errors.New( - "payload status is INVALID_BLOCK_HASH") - + "payload status is INVALID", + ) // ErrNilForkchoiceResponse indicates a nil forkchoice response. ErrNilForkchoiceResponse = errors.New( "nil forkchoice response", diff --git a/execution/engine/engine.go b/execution/engine/engine.go index c9364b687e..f0cc8343a3 100644 --- a/execution/engine/engine.go +++ b/execution/engine/engine.go @@ -58,19 +58,6 @@ func New( } } -// Start spawns any goroutines required by the service. -func (ee *Engine) Start( - ctx context.Context, -) error { - go func() { - // TODO: handle better - if err := ee.ec.Start(ctx); err != nil { - panic(err) - } - }() - return nil -} - // GetPayload returns the payload and blobs bundle for the given slot. func (ee *Engine) GetPayload( ctx context.Context, @@ -112,14 +99,7 @@ func (ee *Engine) NotifyForkchoiceUpdate( // If we get invalid payload status, we will need to find a valid // ancestor block and force a recovery. - // - // These two cases are semantically the same: - // https://github.com/ethereum/execution-apis/issues/270 - case errors.IsAny( - err, - engineerrors.ErrInvalidPayloadStatus, - engineerrors.ErrInvalidBlockHashPayloadStatus, - ): + case errors.Is(err, engineerrors.ErrInvalidPayloadStatus): ee.metrics.markForkchoiceUpdateInvalid(req.State, err) return payloadID, latestValidHash, ErrBadBlockProduced @@ -202,13 +182,7 @@ func (ee *Engine) VerifyAndNotifyNewPayload( req.Optimistic, ) - // These two cases are semantically the same: - // https://github.com/ethereum/execution-apis/issues/270 - case errors.IsAny( - err, - engineerrors.ErrInvalidPayloadStatus, - engineerrors.ErrInvalidBlockHashPayloadStatus, - ): + case errors.Is(err, engineerrors.ErrInvalidPayloadStatus): ee.metrics.markNewPayloadInvalidPayloadStatus( req.ExecutionPayload.GetBlockHash(), req.Optimistic,