Implement expected withdrawals endpoint (#4390)

## Issue Addressed

[#4029](https://github.com/sigp/lighthouse/issues/4029)

## Proposed Changes

implement expected_withdrawals HTTP API per the spec 

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

## Additional Info
This commit is contained in:
Eitan Seri-Levi
2023-08-24 05:54:36 +00:00
parent f92b856cd1
commit 661779f08e
5 changed files with 252 additions and 0 deletions

View File

@@ -1261,6 +1261,23 @@ impl BeaconNodeHttpClient {
Ok(())
}
// GET builder/states/{state_id}/expected_withdrawals
pub async fn get_expected_withdrawals(
&self,
state_id: &StateId,
) -> Result<ExecutionOptimisticFinalizedResponse<Vec<Withdrawal>>, Error> {
let mut path = self.eth_path(V1)?;
path.path_segments_mut()
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
.push("builder")
.push("states")
.push(&state_id.to_string())
.push("expected_withdrawals");
self.get(path).await
}
/// `POST validator/contribution_and_proofs`
pub async fn post_validator_contribution_and_proofs<T: EthSpec>(
&self,

View File

@@ -581,6 +581,11 @@ pub struct SyncingData {
pub sync_distance: Slot,
}
#[derive(Serialize, Deserialize)]
pub struct ExpectedWithdrawalsQuery {
pub proposal_slot: Option<Slot>,
}
#[derive(Clone, PartialEq, Debug, Deserialize)]
#[serde(try_from = "String", bound = "T: FromStr")]
pub struct QueryVec<T: FromStr> {