From 4212f22ddb4f91b12756efe3a6767f52b7981314 Mon Sep 17 00:00:00 2001 From: sragss Date: Mon, 11 Jul 2022 01:44:42 +0000 Subject: [PATCH] add sync committee contribution timeout (#3291) ## Issue Addressed Resolves #3276. ## Proposed Changes Add a timeout for the sync committee contributions at 1/4 the slot length such that we may be able to try backup beacon nodes in the case of contribution post failure. ## Additional Info 1/4 slot length seemed standard for the timeouts, but may want to decrease this to 1/2. I did not find any timeout related / sync committee related tests, so there are no tests. Happy to write some with a bit of guidance. --- common/eth2/src/lib.rs | 9 ++++++++- validator_client/src/lib.rs | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index d37410130..2ee361838 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -110,6 +110,7 @@ pub struct Timeouts { pub liveness: Duration, pub proposal: Duration, pub proposer_duties: Duration, + pub sync_committee_contribution: Duration, pub sync_duties: Duration, } @@ -121,6 +122,7 @@ impl Timeouts { liveness: timeout, proposal: timeout, proposer_duties: timeout, + sync_committee_contribution: timeout, sync_duties: timeout, } } @@ -907,7 +909,12 @@ impl BeaconNodeHttpClient { .push("validator") .push("contribution_and_proofs"); - self.post(path, &signed_contributions).await?; + self.post_with_timeout( + path, + &signed_contributions, + self.timeouts.sync_committee_contribution, + ) + .await?; Ok(()) } diff --git a/validator_client/src/lib.rs b/validator_client/src/lib.rs index a69d6a9f5..b78b072cf 100644 --- a/validator_client/src/lib.rs +++ b/validator_client/src/lib.rs @@ -72,6 +72,7 @@ const HTTP_ATTESTER_DUTIES_TIMEOUT_QUOTIENT: u32 = 4; const HTTP_LIVENESS_TIMEOUT_QUOTIENT: u32 = 4; const HTTP_PROPOSAL_TIMEOUT_QUOTIENT: u32 = 2; const HTTP_PROPOSER_DUTIES_TIMEOUT_QUOTIENT: u32 = 4; +const HTTP_SYNC_COMMITTEE_CONTRIBUTION_TIMEOUT_QUOTIENT: u32 = 4; const HTTP_SYNC_DUTIES_TIMEOUT_QUOTIENT: u32 = 4; const DOPPELGANGER_SERVICE_NAME: &str = "doppelganger"; @@ -280,6 +281,8 @@ impl ProductionValidatorClient { liveness: slot_duration / HTTP_LIVENESS_TIMEOUT_QUOTIENT, proposal: slot_duration / HTTP_PROPOSAL_TIMEOUT_QUOTIENT, proposer_duties: slot_duration / HTTP_PROPOSER_DUTIES_TIMEOUT_QUOTIENT, + sync_committee_contribution: slot_duration + / HTTP_SYNC_COMMITTEE_CONTRIBUTION_TIMEOUT_QUOTIENT, sync_duties: slot_duration / HTTP_SYNC_DUTIES_TIMEOUT_QUOTIENT, } } else {