Skip to content

Commit

Permalink
core/validatorapi: return 404 for propose block v3 (#2868)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dB2510 authored and gsora committed Feb 8, 2024
1 parent fd70377 commit a4fdd77
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/validatorapi/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a4fdd77

Please sign in to comment.