Gracefully handle missing sync committee duties (#3086)

## Issue Addressed

Closes https://github.com/sigp/lighthouse/issues/3085
Closes https://github.com/sigp/lighthouse/issues/2953

## Proposed Changes

Downgrade some of the warnings logged by the VC which were useful during development of the sync committee service but are creating trouble now that we avoid populating the `sync_duties` map with 0 active validators.
This commit is contained in:
Michael Sproul 2022-03-14 06:16:49 +00:00
parent f5d8fdbb4e
commit c2e9354126
2 changed files with 20 additions and 6 deletions

View File

@ -403,7 +403,7 @@ pub async fn poll_sync_committee_duties_for_period<T: SlotClock + 'static, E: Et
if local_indices.is_empty() {
debug!(
duties_service.context.log(),
"No validators, not polling for sync comittee";
"No validators, not polling for sync committee duties";
"sync_committee_period" => sync_committee_period,
);
return Ok(());

View File

@ -4,7 +4,7 @@ use environment::RuntimeContext;
use eth2::types::BlockId;
use futures::future::join_all;
use futures::future::FutureExt;
use slog::{crit, debug, error, info, trace, warn};
use slog::{crit, debug, error, info, trace};
use slot_clock::SlotClock;
use std::collections::HashMap;
use std::ops::Deref;
@ -154,11 +154,16 @@ impl<T: SlotClock + 'static, E: EthSpec> SyncCommitteeService<T, E> {
.checked_sub(slot_duration / 3)
.unwrap_or_else(|| Duration::from_secs(0));
let slot_duties = self
let slot_duties = if let Some(duties) = self
.duties_service
.sync_duties
.get_duties_for_slot::<E>(slot, &self.duties_service.spec)
.ok_or_else(|| format!("Error fetching duties for slot {}", slot))?;
{
duties
} else {
debug!(log, "No duties known for slot {}", slot);
return Ok(());
};
if slot_duties.duties.is_empty() {
debug!(
@ -490,9 +495,9 @@ impl<T: SlotClock + 'static, E: EthSpec> SyncCommitteeService<T, E> {
spec,
)),
None => {
warn!(
debug!(
log,
"Missing duties for subscription";
"No duties for subscription";
"slot" => duty_slot,
);
all_succeeded = false;
@ -500,6 +505,15 @@ impl<T: SlotClock + 'static, E: EthSpec> SyncCommitteeService<T, E> {
}
}
if subscriptions.is_empty() {
debug!(
log,
"No sync subscriptions to send";
"slot" => slot,
);
return Ok(());
}
// Post subscriptions to BN.
debug!(
log,