diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index aebbb566b47..49971445bca 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -3004,7 +3004,6 @@ pub fn serve( .and(warp::header::optional::("accept")) .and(not_while_syncing_filter.clone()) .and(warp::query::()) - .and(warp::header::optional::("accept")) .and(task_spawner_filter.clone()) .and(chain_filter.clone()) .and(log_filter.clone()) @@ -3013,7 +3012,6 @@ pub fn serve( slot: Slot, accept_header: Option, query: api_types::ValidatorBlocksQuery, - accept_header: Option, task_spawner: TaskSpawner, chain: Arc>, log: Logger| { @@ -3055,7 +3053,7 @@ pub fn serve( task_spawner: TaskSpawner, chain: Arc>| { task_spawner.spawn_async_with_rejection(Priority::P0, async move { - produce_blinded_block_v2(EndpointVersion(2), chain, slot, query).await + produce_blinded_block_v2(EndpointVersion(2), accept_header, chain, slot, query).await }) }, ); diff --git a/beacon_node/http_api/src/validator.rs b/beacon_node/http_api/src/validator.rs index 4fb53c9f04e..48549f65583 100644 --- a/beacon_node/http_api/src/validator.rs +++ b/beacon_node/http_api/src/validator.rs @@ -1,5 +1,5 @@ use types::{payload::BlockProductionVersion, *}; - +use bytes::Bytes; use std::sync::Arc; use beacon_chain::{ @@ -56,6 +56,7 @@ pub fn get_randao_verification( pub async fn produce_blinded_block_v2( endpoint_version: EndpointVersion, + accept_header: Option, chain: Arc>, slot: Slot, query: api_types::ValidatorBlocksQuery, diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index 838c57747c3..033087c1bf9 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -1603,6 +1603,26 @@ impl BeaconNodeHttpClient { .await } + /// `GET v2/validator/blocks/{slot}` + pub async fn get_validator_blocks_modular>( + &self, + slot: Slot, + randao_reveal: &SignatureBytes, + graffiti: Option<&Graffiti>, + skip_randao_verification: SkipRandaoVerification, + ) -> Result>, Error> { + let path = self + .get_validator_blocks_path::( + slot, + randao_reveal, + graffiti, + skip_randao_verification, + ) + .await?; + + self.get(path).await + } + /// returns `GET v2/validator/blocks/{slot}` URL path pub async fn get_validator_blocks_path>( &self, @@ -1635,26 +1655,6 @@ impl BeaconNodeHttpClient { Ok(path) } - /// `GET v2/validator/blocks/{slot}` - pub async fn get_validator_blocks_modular>( - &self, - slot: Slot, - randao_reveal: &SignatureBytes, - graffiti: Option<&Graffiti>, - skip_randao_verification: SkipRandaoVerification, - ) -> Result>, Error> { - let path = self - .get_validator_blocks_path::( - slot, - randao_reveal, - graffiti, - skip_randao_verification, - ) - .await?; - - self.get(path).await - } - /// `GET v3/validator/blocks/{slot}` pub async fn get_validator_blocks_v3( &self, @@ -1662,18 +1662,7 @@ impl BeaconNodeHttpClient { randao_reveal: &SignatureBytes, graffiti: Option<&Graffiti>, ) -> Result, Error> { - self.get_validator_blocks_v3_modular() - } - - /// `GET v2/validator/blocks/{slot}` in ssz format - pub async fn get_validator_blocks_ssz>( - &self, - slot: Slot, - randao_reveal: &SignatureBytes, - graffiti: Option<&Graffiti>, - skip_randao_verification: SkipRandaoVerification, - ) -> Result>, Error> { - self.get_validator_blocks_modular_ssz::( + self.get_validator_blocks_v3_modular( slot, randao_reveal, graffiti, @@ -1682,8 +1671,8 @@ impl BeaconNodeHttpClient { .await } - /// `GET v2/validator/blocks/{slot}` in ssz format - pub async fn get_validator_blocks_modular_ssz>( + /// `GET v3/validator/blocks/{slot}` + pub async fn get_validator_blocks_v3_modular( &self, slot: Slot, randao_reveal: &SignatureBytes, @@ -1728,8 +1717,29 @@ impl BeaconNodeHttpClient { Ok(ForkVersionedBeaconBlockType::Full(full_payload)) } - /// `GET v3/validator/blocks/{slot}` - pub async fn get_validator_blocks_v3_modular( + /// `GET v2/validator/blocks/{slot}` in ssz format + pub async fn get_validator_blocks_ssz>( + &self, + slot: Slot, + randao_reveal: &SignatureBytes, + graffiti: Option<&Graffiti>, + ) -> Result>, Error> { + self.get_validator_blocks_modular_ssz::( + slot, + randao_reveal, + graffiti, + SkipRandaoVerification::No, + ) + .await + } + + /// `GET v2/validator/blocks/{slot}` in ssz format + pub async fn get_validator_blocks_modular_ssz>( + &self, + slot: Slot, + randao_reveal: &SignatureBytes, + graffiti: Option<&Graffiti>, + skip_randao_verification: SkipRandaoVerification, ) -> Result>, Error> { let path = self .get_validator_blocks_path::(