Skip to content

Commit c0e1851

Browse files
authored
core/validatorapi: v1/v2 endpoints warning (#3431)
Simply added WARN logging when v1/v2 propose endpoints are being hit. category: feature ticket: #3405
1 parent 5145b79 commit c0e1851

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/validatorapi/router.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ func NewRouter(ctx context.Context, h Handler, eth2Cl eth2wrap.Client, builderEn
137137
{
138138
Name: "propose_block",
139139
Path: "/eth/v2/validator/blocks/{slot}",
140-
Handler: respond404(),
140+
Handler: respond404("/eth/v2/validator/blocks/{slot}"),
141141
Methods: []string{http.MethodGet},
142142
},
143143
{
144144
Name: "propose_blinded_block",
145145
Path: "/eth/v1/validator/blinded_blocks/{slot}",
146-
Handler: respond404(),
146+
Handler: respond404("/eth/v1/validator/blinded_blocks/{slot}"),
147147
Methods: []string{http.MethodGet},
148148
},
149149
{
@@ -629,8 +629,10 @@ func submitContributionAndProofs(s eth2client.SyncCommitteeContributionsSubmitte
629629
}
630630

631631
// respond404 returns a handler function always returning http.StatusNotFound
632-
func respond404() handlerFunc {
633-
return func(_ context.Context, _ map[string]string, _ url.Values, _ contentType, _ []byte) (any, http.Header, error) {
632+
func respond404(endpoint string) handlerFunc {
633+
return func(ctx context.Context, _ map[string]string, _ url.Values, _ contentType, _ []byte) (any, http.Header, error) {
634+
log.Warn(ctx, "This endpoint shall not be hit", nil, z.Str("endpoint", endpoint))
635+
634636
return nil, nil, apiError{
635637
StatusCode: http.StatusNotFound,
636638
Message: "NotFound",

0 commit comments

Comments
 (0)