Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(exec): lgtm dw about it #1643

Merged
merged 1 commit into from
Jun 28, 2024
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
4 changes: 2 additions & 2 deletions mod/execution/pkg/client/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

// jwtRefreshLoop refreshes the JWT token for the execution client.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) jwtRefreshLoop(
ctx context.Context,
) {
Expand All @@ -54,7 +54,7 @@ func (s *EngineClient[
// buildJWTHeader builds an http.Header that has the JWT token
// attached for authorization.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) buildJWTHeader() (http.Header, error) {
header := make(http.Header)

Expand Down
13 changes: 6 additions & 7 deletions mod/execution/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"strings"
"time"

engineprimitives "github.com/berachain/beacon-kit/mod/engine-primitives/pkg/engine-primitives"
"github.com/berachain/beacon-kit/mod/errors"
"github.com/berachain/beacon-kit/mod/execution/pkg/client/cache"
"github.com/berachain/beacon-kit/mod/execution/pkg/client/ethclient"
Expand All @@ -40,7 +39,7 @@ import (
// EngineClient is a struct that holds a pointer to an Eth1Client.
type EngineClient[
ExecutionPayloadT constraints.EngineType[ExecutionPayloadT],
PayloadAttributesT engineprimitives.PayloadAttributer,
PayloadAttributesT PayloadAttributes,
] struct {
// Eth1Client is a struct that holds the Ethereum 1 client and
// its configuration.
Expand All @@ -67,7 +66,7 @@ type EngineClient[
// EngineClient.
func New[
ExecutionPayloadT constraints.EngineType[ExecutionPayloadT],
PayloadAttributesT engineprimitives.PayloadAttributer,
PayloadAttributesT PayloadAttributes,
](
cfg *Config,
logger log.Logger[any],
Expand All @@ -91,14 +90,14 @@ func New[

// Name returns the name of the engine client.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) Name() string {
return "engine-client"
}

// Start the engine client.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) Start(
ctx context.Context,
) error {
Expand Down Expand Up @@ -154,7 +153,7 @@ func (s *EngineClient[
// setupConnection dials the execution client and
// ensures the chain ID is correct.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) initializeConnection(
ctx context.Context,
) error {
Expand Down Expand Up @@ -219,7 +218,7 @@ func (s *EngineClient[

// dialExecutionRPCClient dials the execution client's RPC endpoint.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
ExecutionPayloadT, _,
]) dialExecutionRPCClient(
ctx context.Context,
) error {
Expand Down
8 changes: 4 additions & 4 deletions mod/execution/pkg/client/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (

// NewPayload calls the engine_newPayloadVX method via JSON-RPC.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
ExecutionPayloadT, _,
]) NewPayload(
ctx context.Context,
payload ExecutionPayloadT,
Expand Down Expand Up @@ -84,7 +84,7 @@ func (s *EngineClient[

// ForkchoiceUpdated calls the engine_forkchoiceUpdatedV1 method via JSON-RPC.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, PayloadAttributesT,
]) ForkchoiceUpdated(
ctx context.Context,
state *engineprimitives.ForkchoiceStateV1,
Expand Down Expand Up @@ -135,7 +135,7 @@ func (s *EngineClient[
// GetPayload calls the engine_getPayloadVX method via JSON-RPC. It returns
// the execution data as well as the blobs bundle.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
ExecutionPayloadT, _,
]) GetPayload(
ctx context.Context,
payloadID engineprimitives.PayloadID,
Expand Down Expand Up @@ -168,7 +168,7 @@ func (s *EngineClient[
// ExchangeCapabilities calls the engine_exchangeCapabilities method via
// JSON-RPC.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) ExchangeCapabilities(
ctx context.Context,
) ([]string, error) {
Expand Down
2 changes: 1 addition & 1 deletion mod/execution/pkg/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var (

// Handles errors received from the RPC server according to the specification.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) handleRPCError(
err error,
) error {
Expand Down
4 changes: 2 additions & 2 deletions mod/execution/pkg/client/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

// HeaderByNumber retrieves the block header by its number.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) HeaderByNumber(
ctx context.Context,
number *big.Int,
Expand Down Expand Up @@ -62,7 +62,7 @@ func (s *EngineClient[

// HeaderByHash retrieves the block header by its hash.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) HeaderByHash(
ctx context.Context,
hash common.ExecutionHash,
Expand Down
2 changes: 1 addition & 1 deletion mod/execution/pkg/client/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
// createContextWithTimeout creates a context with a timeout and returns it
// along with the cancel function.
func (s *EngineClient[
ExecutionPayloadT, PayloadAttributesT,
_, _,
]) createContextWithTimeout(
ctx context.Context,
) (context.Context, context.CancelFunc) {
Expand Down
14 changes: 7 additions & 7 deletions mod/execution/pkg/client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ package client

import (
"time"

"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
)

// ExecutionPayload is an interface that defines the Version method.
type ExecutionPayload interface {
// Version returns the version of the payload.
Version() uint32
type PayloadAttributes interface {
// IsNil returns true if the payload attributes are nil.
IsNil() bool
// GetSuggestedFeeRecipient returns the suggested fee recipient.
GetSuggestedFeeRecipient() common.ExecutionAddress
}

// TelemetrySink is an interface for sending metrics to a telemetry backend.
type TelemetrySink interface {
// IncrementCounter increments a counter metric identified by the provided
// keys.
IncrementCounter(key string, args ...string)
// SetGauge sets a gauge metric to the specified value, identified by the
// provided keys.
SetGauge(key string, value int64, args ...string)
// MeasureSince measures the time since the provided start time,
// identified by the provided keys.
MeasureSince(key string, start time.Time, args ...string)
Expand Down
Loading