From 4b619c63d71b35487c80f9a6e938cdd816f94d13 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 5 Oct 2023 02:14:55 +0000 Subject: [PATCH] Exit aggregation step early if no validator is aggregator (#4774) ## Issue Addressed Closes https://github.com/sigp/lighthouse/issues/4712 ## Proposed Changes Exit aggregation step early if no validator is aggregator. This avoids an unnecessary request to the beacon node and more importantly fixes noisy errors if Lighthouse VC is used with other clients such as Lodestar and Prysm. ## Additional Info Related issue https://github.com/ChainSafe/lodestar/issues/5553 --- validator_client/src/attestation_service.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/validator_client/src/attestation_service.rs b/validator_client/src/attestation_service.rs index f0a9258c7..1b7b391a0 100644 --- a/validator_client/src/attestation_service.rs +++ b/validator_client/src/attestation_service.rs @@ -491,6 +491,14 @@ impl AttestationService { ) -> Result<(), String> { let log = self.context.log(); + if !validator_duties + .iter() + .any(|duty_and_proof| duty_and_proof.selection_proof.is_some()) + { + // Exit early if no validator is aggregator + return Ok(()); + } + let aggregated_attestation = &self .beacon_nodes .first_success(