diff --git a/beacon_node/http_api/src/beacon/states.rs b/beacon_node/http_api/src/beacon/states.rs index 02ac3f4da7..84ef3c1f26 100644 --- a/beacon_node/http_api/src/beacon/states.rs +++ b/beacon_node/http_api/src/beacon/states.rs @@ -9,7 +9,7 @@ use crate::version::{ use beacon_chain::{BeaconChain, BeaconChainError, BeaconChainTypes, WhenSlotSkipped}; use eth2::types::{ self as api_types, ValidatorBalancesRequestBody, ValidatorId, ValidatorIdentitiesRequestBody, - ValidatorsRequestBody, + ValidatorIndexData, ValidatorsRequestBody, }; use ssz::Encode; use std::sync::Arc; @@ -213,7 +213,7 @@ pub fn get_beacon_state_proposer_lookahead( ResponseIncludesVersion::Yes(fork_name), execution_optimistic, finalized, - data, + ValidatorIndexData(data), ) .map(|res| warp::reply::json(&res).into_response()), } diff --git a/beacon_node/http_api/tests/tests.rs b/beacon_node/http_api/tests/tests.rs index a97ce01ac1..aed7a6b200 100644 --- a/beacon_node/http_api/tests/tests.rs +++ b/beacon_node/http_api/tests/tests.rs @@ -1430,10 +1430,11 @@ impl ApiTester { } let state = state_opt.as_mut().expect("result should be none"); - let expected = state.proposer_lookahead().unwrap(); + let expected = state.proposer_lookahead().unwrap().to_vec(); let response = result.unwrap(); - assert_eq!(response.data(), &expected.to_vec()); + // Compare Vec directly, not Vec + assert_eq!(response.data().0, expected); // Check that the version header is returned in the response let fork_name = state.fork_name(&self.chain.spec).unwrap(); diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index 5547ced491..af87af14ba 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -904,7 +904,7 @@ impl BeaconNodeHttpClient { pub async fn get_beacon_states_proposer_lookahead( &self, state_id: StateId, - ) -> Result>>, Error> { + ) -> Result>, Error> { let mut path = self.eth_path(V1)?; path.path_segments_mut() diff --git a/common/eth2/src/types.rs b/common/eth2/src/types.rs index 2f86170812..94dff95bc6 100644 --- a/common/eth2/src/types.rs +++ b/common/eth2/src/types.rs @@ -708,6 +708,15 @@ pub struct DataColumnIndicesQuery { #[serde(transparent)] pub struct ValidatorIndexData(#[serde(with = "serde_utils::quoted_u64_vec")] pub Vec); +impl<'de, T> ContextDeserialize<'de, T> for ValidatorIndexData { + fn context_deserialize(deserializer: D, _context: T) -> Result + where + D: Deserializer<'de>, + { + Self::deserialize(deserializer) + } +} + /// Borrowed variant of `ValidatorIndexData`, for serializing/sending. #[derive(Clone, Copy, Serialize)] #[serde(transparent)]