From 5d317779bb1f77d4aa563f70736b763993ed7ab8 Mon Sep 17 00:00:00 2001 From: Mac L Date: Fri, 5 Aug 2022 06:46:58 +0000 Subject: [PATCH] Ensure `validator/blinded_blocks/{slot}` endpoint conforms to spec (#3429) ## Issue Addressed #3418 ## Proposed Changes - Remove `eth/v2/validator/blinded_blocks/{slot}` as this endpoint does not exist in the spec. - Return `version` in the `eth/v1/validator/blinded_blocks/{slot}` endpoint. ## Additional Info Since this removes the `v2` endpoint, this is *technically* a breaking change, but as this does not exist in the spec users may or may not be relying on this. Depending on what we feel is appropriate, I'm happy to edit this so we keep the `v2` endpoint for now but simply bring the `v1` endpoint in line with `v2`. --- beacon_node/http_api/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index 0152f20e98..ba1dd01cc3 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -1988,7 +1988,7 @@ pub fn serve( ); // GET validator/blinded_blocks/{slot} - let get_validator_blinded_blocks = any_version + let get_validator_blinded_blocks = eth_v1 .and(warp::path("validator")) .and(warp::path("blinded_blocks")) .and(warp::path::param::().or_else(|_| async { @@ -2001,8 +2001,7 @@ pub fn serve( .and(warp::query::()) .and(chain_filter.clone()) .and_then( - |endpoint_version: EndpointVersion, - slot: Slot, + |slot: Slot, query: api_types::ValidatorBlocksQuery, chain: Arc>| async move { let randao_reveal = query.randao_reveal.as_ref().map_or_else( @@ -2044,7 +2043,8 @@ pub fn serve( .to_ref() .fork_name(&chain.spec) .map_err(inconsistent_fork_rejection)?; - fork_versioned_response(endpoint_version, fork_name, block) + // Pose as a V2 endpoint so we return the fork `version`. + fork_versioned_response(V2, fork_name, block) .map(|response| warp::reply::json(&response)) }, );