From a4fdd77d93d74e3f7103a1421131203e4d42faad Mon Sep 17 00:00:00 2001 From: Dhruv Bodani Date: Thu, 8 Feb 2024 20:30:08 +0530 Subject: [PATCH] core/validatorapi: return 404 for propose block v3 (#2868) Returns 404 with message `endpoint not supported` for produce block v3 endpoint to signal VC it is not supported by charon yet. Otherwise charon will proxy this request to beacon node. category: feature ticket: #2749 --- core/validatorapi/router.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/validatorapi/router.go b/core/validatorapi/router.go index 3d29ac1c7..32b14ef27 100644 --- a/core/validatorapi/router.go +++ b/core/validatorapi/router.go @@ -136,6 +136,12 @@ func NewRouter(ctx context.Context, h Handler, eth2Cl eth2wrap.Client) (*mux.Rou Handler: proposeBlock(h), Methods: []string{http.MethodGet}, }, + { + Name: "propose_block_v3", + Path: "/eth/v3/validator/blocks/{slot}", + Handler: proposeBlockV3(), + Methods: []string{http.MethodGet}, + }, { Name: "submit_proposal_v1", Path: "/eth/v1/beacon/blocks", @@ -353,6 +359,17 @@ func wrapTrace(endpoint string, handler http.HandlerFunc) http.Handler { return otelhttp.NewHandler(handler, "core/validatorapi."+endpoint) } +// proposeBlockV3 returns a handler function which receives the randao from the validator and returns an unsigned +// BeaconBlock or BlindedBeaconBlock. +func proposeBlockV3() handlerFunc { + return func(context.Context, map[string]string, url.Values, contentType, []byte) (res any, headers http.Header, err error) { + return nil, nil, apiError{ + StatusCode: 404, + Message: "endpoint not supported", + } + } +} + // getValidators returns a handler function for the get validators by pubkey or index endpoint. func getValidators(p eth2client.ValidatorsProvider) handlerFunc { return func(ctx context.Context, params map[string]string, query url.Values, _ contentType, body []byte) (any, http.Header, error) {