Add pending_consolidations Beacon API endpoint (#7290)

#7282


  Adds the missing `beacon/states/{state_id}/pending_consolidations` Beacon API endpoint along with related tests.
This commit is contained in:
Mac L
2025-04-10 11:21:01 +10:00
committed by GitHub
parent ec643843e0
commit 7534f5752d
3 changed files with 83 additions and 0 deletions

View File

@@ -1246,6 +1246,33 @@ impl ApiTester {
self
}
pub async fn test_beacon_states_pending_consolidations(self) -> Self {
for state_id in self.interesting_state_ids() {
let mut state_opt = state_id
.state(&self.chain)
.ok()
.map(|(state, _execution_optimistic, _finalized)| state);
let result = self
.client
.get_beacon_states_pending_consolidations(state_id.0)
.await
.unwrap()
.map(|res| res.data);
if result.is_none() && state_opt.is_none() {
continue;
}
let state = state_opt.as_mut().expect("result should be none");
let expected = state.pending_consolidations().unwrap();
assert_eq!(result.unwrap(), expected.to_vec());
}
self
}
pub async fn test_beacon_headers_all_slots(self) -> Self {
for slot in 0..CHAIN_LENGTH {
let slot = Slot::from(slot);
@@ -6404,6 +6431,8 @@ async fn beacon_get_state_info_electra() {
.test_beacon_states_pending_deposits()
.await
.test_beacon_states_pending_partial_withdrawals()
.await
.test_beacon_states_pending_consolidations()
.await;
}