Skip to content

Commit

Permalink
engine: Remove engine_getPayloadBodiesBy{Hash|Range}V2 (#12487)
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis authored Oct 25, 2024
1 parent c13dbaa commit 3dd73c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
28 changes: 7 additions & 21 deletions turbo/engineapi/engine_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ func (s *EngineServer) forkchoiceUpdated(ctx context.Context, forkchoiceState *e
}, nil
}

func (s *EngineServer) getPayloadBodiesByHash(ctx context.Context, request []libcommon.Hash, version clparams.StateVersion) ([]*engine_types.ExecutionPayloadBody, error) {
func (s *EngineServer) getPayloadBodiesByHash(ctx context.Context, request []libcommon.Hash) ([]*engine_types.ExecutionPayloadBody, error) {
if len(request) > 1024 {
return nil, &engine_helpers.TooLargeRequestErr
}
Expand All @@ -609,12 +609,12 @@ func (s *EngineServer) getPayloadBodiesByHash(ctx context.Context, request []lib

resp := make([]*engine_types.ExecutionPayloadBody, len(bodies))
for i, body := range bodies {
resp[i] = extractPayloadBodyFromBody(body, version)
resp[i] = extractPayloadBodyFromBody(body)
}
return resp, nil
}

func extractPayloadBodyFromBody(body *types.RawBody, version clparams.StateVersion) *engine_types.ExecutionPayloadBody {
func extractPayloadBodyFromBody(body *types.RawBody) *engine_types.ExecutionPayloadBody {
if body == nil {
return nil
}
Expand All @@ -628,7 +628,7 @@ func extractPayloadBodyFromBody(body *types.RawBody, version clparams.StateVersi
return ret
}

func (s *EngineServer) getPayloadBodiesByRange(ctx context.Context, start, count uint64, version clparams.StateVersion) ([]*engine_types.ExecutionPayloadBody, error) {
func (s *EngineServer) getPayloadBodiesByRange(ctx context.Context, start, count uint64) ([]*engine_types.ExecutionPayloadBody, error) {
if start == 0 || count == 0 {
return nil, &rpc.InvalidParamsError{Message: fmt.Sprintf("invalid start or count, start: %v count: %v", start, count)}
}
Expand All @@ -642,7 +642,7 @@ func (s *EngineServer) getPayloadBodiesByRange(ctx context.Context, start, count

resp := make([]*engine_types.ExecutionPayloadBody, len(bodies))
for idx, body := range bodies {
resp[idx] = extractPayloadBodyFromBody(body, version)
resp[idx] = extractPayloadBodyFromBody(body)
}
return resp, nil
}
Expand Down Expand Up @@ -740,25 +740,13 @@ func (e *EngineServer) NewPayloadV4(ctx context.Context, payload *engine_types.E
// Returns an array of execution payload bodies referenced by their block hashes
// See https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1
func (e *EngineServer) GetPayloadBodiesByHashV1(ctx context.Context, hashes []libcommon.Hash) ([]*engine_types.ExecutionPayloadBody, error) {
return e.getPayloadBodiesByHash(ctx, hashes, clparams.DenebVersion)
}

// Returns an array of execution payload bodies referenced by their block hashes
// See https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md#engine_getpayloadbodiesbyhashv2
func (e *EngineServer) GetPayloadBodiesByHashV2(ctx context.Context, hashes []libcommon.Hash) ([]*engine_types.ExecutionPayloadBody, error) {
return e.getPayloadBodiesByHash(ctx, hashes, clparams.ElectraVersion)
return e.getPayloadBodiesByHash(ctx, hashes)
}

// Returns an ordered (as per canonical chain) array of execution payload bodies, with corresponding execution block numbers from "start", up to "count"
// See https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#engine_getpayloadbodiesbyrangev1
func (e *EngineServer) GetPayloadBodiesByRangeV1(ctx context.Context, start, count hexutil.Uint64) ([]*engine_types.ExecutionPayloadBody, error) {
return e.getPayloadBodiesByRange(ctx, uint64(start), uint64(count), clparams.CapellaVersion)
}

// Returns an ordered (as per canonical chain) array of execution payload bodies, with corresponding execution block numbers from "start", up to "count"
// See https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md#engine_getpayloadbodiesbyrangev2
func (e *EngineServer) GetPayloadBodiesByRangeV2(ctx context.Context, start, count hexutil.Uint64) ([]*engine_types.ExecutionPayloadBody, error) {
return e.getPayloadBodiesByRange(ctx, uint64(start), uint64(count), clparams.ElectraVersion)
return e.getPayloadBodiesByRange(ctx, uint64(start), uint64(count))
}

var ourCapabilities = []string{
Expand All @@ -774,9 +762,7 @@ var ourCapabilities = []string{
"engine_getPayloadV3",
"engine_getPayloadV4",
"engine_getPayloadBodiesByHashV1",
"engine_getPayloadBodiesByHashV2",
"engine_getPayloadBodiesByRangeV1",
"engine_getPayloadBodiesByRangeV2",
}

func (e *EngineServer) ExchangeCapabilities(fromCl []string) []string {
Expand Down
2 changes: 0 additions & 2 deletions turbo/engineapi/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,5 @@ type EngineAPI interface {
GetPayloadV3(ctx context.Context, payloadID hexutility.Bytes) (*engine_types.GetPayloadResponse, error)
GetPayloadV4(ctx context.Context, payloadID hexutility.Bytes) (*engine_types.GetPayloadResponse, error)
GetPayloadBodiesByHashV1(ctx context.Context, hashes []common.Hash) ([]*engine_types.ExecutionPayloadBody, error)
GetPayloadBodiesByHashV2(ctx context.Context, hashes []common.Hash) ([]*engine_types.ExecutionPayloadBody, error)
GetPayloadBodiesByRangeV1(ctx context.Context, start, count hexutil.Uint64) ([]*engine_types.ExecutionPayloadBody, error)
GetPayloadBodiesByRangeV2(ctx context.Context, start, count hexutil.Uint64) ([]*engine_types.ExecutionPayloadBody, error)
}

0 comments on commit 3dd73c9

Please sign in to comment.