diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index 8d3f3cac3..0eb261d96 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -3324,10 +3324,10 @@ pub fn serve( ))) }); - // GET lighthouse/beacon/blob_sidecars/{block_id} - let get_blob_sidecars = warp::path("lighthouse") + // GET lighthouse/beacon/blobs_sidecars/{block_id} + let get_blobs_sidecars = warp::path("lighthouse") .and(warp::path("beacon")) - .and(warp::path("blob_sidecars")) + .and(warp::path("blobs_sidecars")) .and(block_id_or_err) .and(warp::path::end()) .and(chain_filter.clone()) @@ -3494,7 +3494,7 @@ pub fn serve( .or(get_lighthouse_attestation_performance.boxed()) .or(get_lighthouse_block_packing_efficiency.boxed()) .or(get_lighthouse_merge_readiness.boxed()) - .or(get_blob_sidecars.boxed()) + .or(get_blobs_sidecars.boxed()) .or(get_events.boxed()), ) .boxed() diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index fcfff7284..f08c4eb30 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -680,6 +680,19 @@ impl BeaconNodeHttpClient { Ok(path) } + /// Path for `lighthouse/beacon/blobs_sidecars/{block_id}` + pub fn get_blobs_sidecar_path(&self, block_id: BlockId) -> Result { + let mut path = self.server.full.clone(); + + path.path_segments_mut() + .map_err(|()| Error::InvalidUrl(self.server.clone()))? + .push("lighthouse") + .push("beacon") + .push("blobs_sidecars") + .push(&block_id.to_string()); + Ok(path) + } + /// Path for `v1/beacon/blinded_blocks/{block_id}` pub fn get_beacon_blinded_blocks_path(&self, block_id: BlockId) -> Result { let mut path = self.eth_path(V1)?; @@ -735,6 +748,23 @@ impl BeaconNodeHttpClient { })) } + /// `GET lighthouse/beacon/blobs_sidecars/{block_id}` + /// + /// Returns `Ok(None)` on a 404 error. + pub async fn get_blobs_sidecar( + &self, + block_id: BlockId, + ) -> Result>>, Error> { + let path = self.get_blobs_sidecar_path(block_id)?; + let response = match self.get_response(path, |b| b).await.optional()? { + Some(res) => res, + None => return Ok(None), + }; + + let GenericResponse { data } = response.json().await?; + Ok(Some(GenericResponse { data })) + } + /// `GET v1/beacon/blinded_blocks/{block_id}` /// /// Returns `Ok(None)` on a 404 error.