Skip to content

Commit

Permalink
validator liveness endpoint should accept string encoded indices (sig…
Browse files Browse the repository at this point in the history
…p#5184)

* deserialize string indices as u64

* client should send quoted indices
  • Loading branch information
eserilev authored Feb 9, 2024
1 parent 4172d9f commit e7ef2a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3864,7 +3864,7 @@ pub fn serve<T: BeaconChainTypes>(
},
);

// POST vaidator/liveness/{epoch}
// POST validator/liveness/{epoch}
let post_validator_liveness_epoch = eth_v1
.and(warp::path("validator"))
.and(warp::path("liveness"))
Expand All @@ -3875,7 +3875,7 @@ pub fn serve<T: BeaconChainTypes>(
.and(chain_filter.clone())
.then(
|epoch: Epoch,
indices: Vec<u64>,
indices: api_types::ValidatorIndexData,
task_spawner: TaskSpawner<T::EthSpec>,
chain: Arc<BeaconChain<T>>| {
task_spawner.blocking_json_task(Priority::P0, move || {
Expand All @@ -3894,6 +3894,7 @@ pub fn serve<T: BeaconChainTypes>(
}

let liveness: Vec<api_types::StandardLivenessResponseData> = indices
.0
.iter()
.cloned()
.map(|index| {
Expand Down
10 changes: 7 additions & 3 deletions common/eth2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,7 @@ impl BeaconNodeHttpClient {
pub async fn post_validator_liveness_epoch(
&self,
epoch: Epoch,
indices: &Vec<u64>,
indices: &[u64],
) -> Result<GenericResponse<Vec<StandardLivenessResponseData>>, Error> {
let mut path = self.eth_path(V1)?;

Expand All @@ -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}`
Expand Down

0 comments on commit e7ef2a3

Please sign in to comment.