diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index bdad67286..153667d7e 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -1256,8 +1256,12 @@ impl BeaconNodeHttpClient { .push("attester") .push(&epoch.to_string()); - self.post_with_timeout_and_response(path, &indices, self.timeouts.attester_duties) - .await + self.post_with_timeout_and_response( + path, + &ValidatorIndexDataRef(indices), + self.timeouts.attester_duties, + ) + .await } /// `POST validator/aggregate_and_proofs` @@ -1356,8 +1360,12 @@ impl BeaconNodeHttpClient { .push("sync") .push(&epoch.to_string()); - self.post_with_timeout_and_response(path, &indices, self.timeouts.sync_duties) - .await + self.post_with_timeout_and_response( + path, + &ValidatorIndexDataRef(indices), + self.timeouts.sync_duties, + ) + .await } } diff --git a/common/eth2/src/types.rs b/common/eth2/src/types.rs index 169a8de59..a761b9ed1 100644 --- a/common/eth2/src/types.rs +++ b/common/eth2/src/types.rs @@ -591,6 +591,13 @@ pub struct ValidatorBalancesQuery { #[serde(transparent)] pub struct ValidatorIndexData(#[serde(with = "eth2_serde_utils::quoted_u64_vec")] pub Vec); +/// Borrowed variant of `ValidatorIndexData`, for serializing/sending. +#[derive(Clone, Copy, Serialize)] +#[serde(transparent)] +pub struct ValidatorIndexDataRef<'a>( + #[serde(serialize_with = "eth2_serde_utils::quoted_u64_vec::serialize")] pub &'a [u64], +); + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct AttesterData { pub pubkey: PublicKeyBytes,