From e7ef2a3a54a871bac30ca1ce8a1382dd567eab8d Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Fri, 9 Feb 2024 06:59:39 +0200 Subject: [PATCH] validator liveness endpoint should accept string encoded indices (#5184) * deserialize string indices as u64 * client should send quoted indices --- beacon_node/http_api/src/lib.rs | 5 +++-- common/eth2/src/lib.rs | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index ad841b20e3a..ec3fd494d49 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -3864,7 +3864,7 @@ pub fn serve( }, ); - // POST vaidator/liveness/{epoch} + // POST validator/liveness/{epoch} let post_validator_liveness_epoch = eth_v1 .and(warp::path("validator")) .and(warp::path("liveness")) @@ -3875,7 +3875,7 @@ pub fn serve( .and(chain_filter.clone()) .then( |epoch: Epoch, - indices: Vec, + indices: api_types::ValidatorIndexData, task_spawner: TaskSpawner, chain: Arc>| { task_spawner.blocking_json_task(Priority::P0, move || { @@ -3894,6 +3894,7 @@ pub fn serve( } let liveness: Vec = indices + .0 .iter() .cloned() .map(|index| { diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index 6687788d528..3c22c822b8a 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -2258,7 +2258,7 @@ impl BeaconNodeHttpClient { pub async fn post_validator_liveness_epoch( &self, epoch: Epoch, - indices: &Vec, + indices: &[u64], ) -> Result>, Error> { let mut path = self.eth_path(V1)?; @@ -2268,8 +2268,12 @@ impl BeaconNodeHttpClient { .push("liveness") .push(&epoch.to_string()); - self.post_with_timeout_and_response(path, indices, self.timeouts.liveness) - .await + self.post_with_timeout_and_response( + path, + &ValidatorIndexDataRef(indices), + self.timeouts.liveness, + ) + .await } /// `POST validator/duties/attester/{epoch}`