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

core/validatorapi: v1/v2 endpoints warning #3431

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions core/validatorapi/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ func NewRouter(ctx context.Context, h Handler, eth2Cl eth2wrap.Client, builderEn
{
Name: "propose_block",
Path: "/eth/v2/validator/blocks/{slot}",
Handler: respond404(),
Handler: respond404("/eth/v2/validator/blocks/{slot}"),
Methods: []string{http.MethodGet},
},
{
Name: "propose_blinded_block",
Path: "/eth/v1/validator/blinded_blocks/{slot}",
Handler: respond404(),
Handler: respond404("/eth/v1/validator/blinded_blocks/{slot}"),
Methods: []string{http.MethodGet},
},
{
Expand Down Expand Up @@ -629,8 +629,10 @@ func submitContributionAndProofs(s eth2client.SyncCommitteeContributionsSubmitte
}

// respond404 returns a handler function always returning http.StatusNotFound
func respond404() handlerFunc {
return func(_ context.Context, _ map[string]string, _ url.Values, _ contentType, _ []byte) (any, http.Header, error) {
func respond404(endpoint string) handlerFunc {
return func(ctx context.Context, _ map[string]string, _ url.Values, _ contentType, _ []byte) (any, http.Header, error) {
log.Warn(ctx, "This endpoint shall not be hit", nil, z.Str("endpoint", endpoint))

return nil, nil, apiError{
StatusCode: http.StatusNotFound,
Message: "NotFound",
Expand Down
Loading