Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard Liveness Endpoint #4853

Merged
merged 8 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3869,12 +3869,16 @@ pub fn serve<T: BeaconChainTypes>(
)));
}

let liveness: Vec<api_types::StandardLivenessResponseData> = indices
let liveness: Vec<api_types::LivenessResponseData> = indices
.iter()
.cloned()
.map(|index| {
let is_live = chain.validator_seen_at_epoch(index as usize, epoch);
api_types::StandardLivenessResponseData { index, is_live }
api_types::LivenessResponseData {
index,
epoch,
is_live,
}
})
.collect();

Expand Down
5 changes: 3 additions & 2 deletions beacon_node/http_api/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3270,12 +3270,13 @@ impl ApiTester {
.collect::<Vec<_>>();

// Construct the expected response
let expected: Vec<StandardLivenessResponseData> = head_state
let expected: Vec<LivenessResponseData> = head_state
.validators()
.iter()
.enumerate()
.map(|(index, _)| StandardLivenessResponseData {
.map(|(index, _)| LivenessResponseData {
index: index as u64,
epoch,
is_live: false,
})
.collect();
Expand Down
2 changes: 1 addition & 1 deletion common/eth2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ impl BeaconNodeHttpClient {
&self,
epoch: Epoch,
indices: Vec<u64>,
) -> Result<GenericResponse<Vec<StandardLivenessResponseData>>, Error> {
) -> Result<GenericResponse<Vec<LivenessResponseData>>, Error> {
let mut path = self.eth_path(V1)?;

path.path_segments_mut()
Expand Down
4 changes: 2 additions & 2 deletions validator_client/src/doppelganger_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async fn beacon_node_liveness<'a, T: 'static + SlotClock, E: EthSpec>(
OfflineOnFailure::Yes,
|beacon_node| async move {
beacon_node
.post_lighthouse_liveness(validator_indices, previous_epoch)
.post_validator_liveness_epoch(previous_epoch, validator_indices.to_vec())
.await
.map_err(|e| format!("Failed query for validator liveness: {:?}", e))
.map(|result| result.data)
Expand All @@ -209,7 +209,7 @@ async fn beacon_node_liveness<'a, T: 'static + SlotClock, E: EthSpec>(
OfflineOnFailure::Yes,
|beacon_node| async move {
beacon_node
.post_lighthouse_liveness(validator_indices, current_epoch)
.post_validator_liveness_epoch(current_epoch, validator_indices.to_vec())
.await
.map_err(|e| format!("Failed query for validator liveness: {:?}", e))
.map(|result| result.data)
Expand Down