Skip to content

Commit

Permalink
chore(engine): Remove Unused Errors and Functions (berachain#2384)
Browse files Browse the repository at this point in the history
  • Loading branch information
rezbera authored Jan 21, 2025
1 parent 4dc9ae7 commit a5f27ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 36 deletions.
2 changes: 1 addition & 1 deletion consensus-types/types/payload_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
9 changes: 2 additions & 7 deletions engine-primitives/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
30 changes: 2 additions & 28 deletions execution/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a5f27ba

Please sign in to comment.