Implement /eth/v1/validator/{beacon,sync}_committee_selections Beacon API end-points (#4760)

This commit is contained in:
tersec 2023-03-21 23:47:36 +00:00 committed by GitHub
parent eb678be0ff
commit 44b38ef137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 0 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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": {