Implement proposer duties v2 endpoint (#8918)

Fix the issue with the `proposer_duties` endpoint using the wrong dependent root post-Fulu by implementing the new v2 endpoint:

- https://github.com/ethereum/beacon-APIs/pull/563

We need to add this in time for Gloas, and then we can we can deprecate and remove v1.


  - Add a new API handler for the v2 endpoint
- Add client code in the `eth2` crate
- Update existing tests and add some new ones to confirm the different behaviour of v1 and v2

There's a bit of test duplication with v1, but this will be resolved once v1 and its tests are deleted.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>

Co-Authored-By: chonghe <44791194+chong-he@users.noreply.github.com>
This commit is contained in:
Michael Sproul
2026-03-10 18:57:51 +11:00
committed by GitHub
parent 9f3873f2bf
commit 081229b748
6 changed files with 438 additions and 32 deletions

View File

@@ -2144,6 +2144,24 @@ impl BeaconNodeHttpClient {
.await
}
/// `GET v2/validator/duties/proposer/{epoch}`
pub async fn get_validator_duties_proposer_v2(
&self,
epoch: Epoch,
) -> Result<DutiesResponse<Vec<ProposerData>>, Error> {
let mut path = self.eth_path(V2)?;
path.path_segments_mut()
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
.push("validator")
.push("duties")
.push("proposer")
.push(&epoch.to_string());
self.get_with_timeout(path, self.timeouts.proposer_duties)
.await
}
/// `GET v2/validator/blocks/{slot}`
pub async fn get_validator_blocks<E: EthSpec>(
&self,