Implement proposer lookahead endpoint (#8815)

closes #8809


  Implement GET /eth/v1/beacon/states/{state_id}/proposer_lookahead ([beacon-APIs#565](https://github.com/ethereum/beacon-APIs/pull/565)). Returns the proposer lookahead from Fulu+ states; 400 for pre-Fulu. Includes integration test.


Co-Authored-By: romeoscript <romeobourne211@gmail.com>

Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io>
This commit is contained in:
Romeo
2026-03-10 14:36:58 +01:00
committed by GitHub
parent 081229b748
commit 906400ed34
4 changed files with 196 additions and 3 deletions

View File

@@ -898,6 +898,47 @@ impl BeaconNodeHttpClient {
.map(|opt| opt.map(BeaconResponse::ForkVersioned))
}
/// `GET beacon/states/{state_id}/proposer_lookahead`
///
/// Returns `Ok(None)` on a 404 error.
pub async fn get_beacon_states_proposer_lookahead(
&self,
state_id: StateId,
) -> Result<Option<ExecutionOptimisticFinalizedBeaconResponse<Vec<u64>>>, Error> {
let mut path = self.eth_path(V1)?;
path.path_segments_mut()
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
.push("beacon")
.push("states")
.push(&state_id.to_string())
.push("proposer_lookahead");
self.get_fork_contextual(path, |fork| fork)
.await
.map(|opt| opt.map(BeaconResponse::ForkVersioned))
}
/// `GET beacon/states/{state_id}/proposer_lookahead`
///
/// Returns `Ok(None)` on a 404 error.
pub async fn get_beacon_states_proposer_lookahead_ssz(
&self,
state_id: StateId,
) -> Result<Option<Vec<u8>>, Error> {
let mut path = self.eth_path(V1)?;
path.path_segments_mut()
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
.push("beacon")
.push("states")
.push(&state_id.to_string())
.push("proposer_lookahead");
self.get_bytes_opt_accept_header(path, Accept::Ssz, self.timeouts.default)
.await
}
/// `GET beacon/light_client/updates`
///
/// Returns `Ok(None)` on a 404 error.