Skip to content

Commit

Permalink
Implement /eth/v1/validator/{beacon,sync}_committee_selections Beacon…
Browse files Browse the repository at this point in the history
… API end-points (#4760)
  • Loading branch information
tersec authored Mar 21, 2023
1 parent eb678be commit 44b38ef
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions beacon_chain/rpc/rest_constants.nim
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,5 @@ const
"Invalid BLS to execution change; it won't validate, so it's rejected"
BlsToExecutionChangeValidationSuccess* =
"BLS to execution change was broadcast"
AggregationSelectionNotImplemented* =
"Attestation and sync committee aggreggation selection are not implemented"
24 changes: 24 additions & 0 deletions beacon_chain/rpc/rest_validator_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -993,3 +993,27 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
)
)
return RestApiResponse.jsonResponse(response)

# https://github.com/ethereum/beacon-APIs/blob/f087fbf2764e657578a6c29bdf0261b36ee8db1e/apis/validator/beacon_committee_selections.yaml
router.api(MethodPost, "/eth/v1/validator/beacon_committee_selections") do (
contentBody: Option[ContentBody]) -> RestApiResponse:
# "Consensus clients need not support this endpoint and may return a 501."
# https://github.com/ethereum/beacon-APIs/pull/224: "This endpoint need not
# be implemented on the CL side. Once a validator client is aware of it and
# able to use it when a feature flag is turned on, the intercepting
# middleware can handle and swallow the request. I suggest a CL either
# returns 501 Not Implemented [or] 400 Bad Request."
return RestApiResponse.jsonError(
Http501, AggregationSelectionNotImplemented)

# https://github.com/ethereum/beacon-APIs/blob/f087fbf2764e657578a6c29bdf0261b36ee8db1e/apis/validator/sync_committee_selections.yaml
router.api(MethodPost, "/eth/v1/validator/sync_committee_selections") do (
contentBody: Option[ContentBody]) -> RestApiResponse:
# "Consensus clients need not support this endpoint and may return a 501."
# https://github.com/ethereum/beacon-APIs/pull/224: "This endpoint need not
# be implemented on the CL side. Once a validator client is aware of it and
# able to use it when a feature flag is turned on, the intercepting
# middleware can handle and swallow the request. I suggest a CL either
# returns 501 Not Implemented [or] 400 Bad Request."
return RestApiResponse.jsonError(
Http501, AggregationSelectionNotImplemented)
26 changes: 26 additions & 0 deletions ncli/resttest-rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -3333,6 +3333,32 @@
"body": [{"operator": "jstructcmpns", "value": {"code": 400, "message": ""}}]
}
},
{
"topics": ["validator", "beacon_committee_selections"],
"request": {
"url": "/eth/v1/validator/beacon_committee_selections",
"method": "POST",
"headers": {"Accept": "application/json"}
},
"response": {
"status": {"operator": "equals", "value": "501"},
"headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}],
"body": [{"operator": "jstructcmpns", "value": {"code": 501, "message": ""}}]
}
},
{
"topics": ["validator", "sync_committee_selections"],
"request": {
"url": "/eth/v1/validator/sync_committee_selections",
"method": "POST",
"headers": {"Accept": "application/json"}
},
"response": {
"status": {"operator": "equals", "value": "501"},
"headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}],
"body": [{"operator": "jstructcmpns", "value": {"code": 501, "message": ""}}]
}
},
{
"topics": ["validator", "register_validators"],
"request": {
Expand Down

0 comments on commit 44b38ef

Please sign in to comment.