Gossip cache timeout adjustments (#2997)

## Proposed Changes

- Do not retry to publish sync committee messages.
- Give a more lenient timeout to slashings and exits
This commit is contained in:
Divma 2022-02-07 23:25:06 +00:00
parent 675c7b7e26
commit 36fc887a40
2 changed files with 11 additions and 6 deletions

View File

@ -96,19 +96,19 @@ impl GossipCacheBuilder {
} }
/// Timeout for attester slashings. /// Timeout for attester slashings.
pub fn attester_slashing(mut self, timeout: Duration) -> Self { pub fn attester_slashing_timeout(mut self, timeout: Duration) -> Self {
self.attester_slashing = Some(timeout); self.attester_slashing = Some(timeout);
self self
} }
/// Timeout for aggregated sync commitee signatures. /// Timeout for aggregated sync commitee signatures.
pub fn signed_contribution_and_proof(mut self, timeout: Duration) -> Self { pub fn signed_contribution_and_proof_timeout(mut self, timeout: Duration) -> Self {
self.signed_contribution_and_proof = Some(timeout); self.signed_contribution_and_proof = Some(timeout);
self self
} }
/// Timeout for sync commitee messages. /// Timeout for sync commitee messages.
pub fn sync_committee_message(mut self, timeout: Duration) -> Self { pub fn sync_committee_message_timeout(mut self, timeout: Duration) -> Self {
self.sync_committee_message = Some(timeout); self.sync_committee_message = Some(timeout);
self self
} }

View File

@ -288,13 +288,18 @@ impl<TSpec: EthSpec> Behaviour<TSpec> {
}; };
let slot_duration = std::time::Duration::from_secs(ctx.chain_spec.seconds_per_slot); let slot_duration = std::time::Duration::from_secs(ctx.chain_spec.seconds_per_slot);
// Half an epoch let half_epoch = std::time::Duration::from_secs(
let gossip_max_retry_delay = std::time::Duration::from_secs(
ctx.chain_spec.seconds_per_slot * TSpec::slots_per_epoch() / 2, ctx.chain_spec.seconds_per_slot * TSpec::slots_per_epoch() / 2,
); );
let gossip_cache = GossipCache::builder() let gossip_cache = GossipCache::builder()
.default_timeout(gossip_max_retry_delay)
.beacon_block_timeout(slot_duration) .beacon_block_timeout(slot_duration)
.aggregates_timeout(half_epoch)
.attestation_timeout(half_epoch)
.voluntary_exit_timeout(half_epoch * 2)
.proposer_slashing_timeout(half_epoch * 2)
.attester_slashing_timeout(half_epoch * 2)
// .signed_contribution_and_proof_timeout(timeout) // Do not retry
// .sync_committee_message_timeout(timeout) // Do not retry
.build(); .build();
Ok(Behaviour { Ok(Behaviour {