Silence candidate errors when pre-genesis

This commit is contained in:
Mac L
2024-06-06 16:06:57 +10:00
parent e348231d24
commit 5c8dc21865
2 changed files with 17 additions and 9 deletions

View File

@@ -77,7 +77,7 @@ pub fn cli_app() -> Command {
) )
.arg( .arg(
Arg::new("vc-count") Arg::new("vc-count")
.short('c') .short('n')
.long("vc-count") .long("vc-count")
.action(ArgAction::Set) .action(ArgAction::Set)
.default_value("3") .default_value("3")

View File

@@ -129,8 +129,9 @@ impl<T: Debug> fmt::Display for Errors<T> {
} }
/// Reasons why a candidate might not be ready. /// Reasons why a candidate might not be ready.
#[derive(Debug, Clone, Copy, Deserialize, Serialize)] #[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize)]
pub enum CandidateError { pub enum CandidateError {
PreGenesis,
Uninitialized, Uninitialized,
Offline, Offline,
Incompatible, Incompatible,
@@ -210,7 +211,12 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
if let Some(slot_clock) = slot_clock { if let Some(slot_clock) = slot_clock {
match check_node_health(&self.beacon_node, log).await { match check_node_health(&self.beacon_node, log).await {
Ok((head, is_optimistic, el_offline)) => { Ok((head, is_optimistic, el_offline)) => {
let slot_clock_head = slot_clock.now().ok_or(CandidateError::Uninitialized)?; let Some(slot_clock_head) = slot_clock.now() else {
match slot_clock.is_prior_to_genesis() {
Some(true) => return Err(CandidateError::PreGenesis),
_ => return Err(CandidateError::Uninitialized),
}
};
if head > slot_clock_head + FUTURE_SLOT_TOLERANCE { if head > slot_clock_head + FUTURE_SLOT_TOLERANCE {
return Err(CandidateError::TimeDiscrepancy); return Err(CandidateError::TimeDiscrepancy);
@@ -457,12 +463,14 @@ impl<T: SlotClock, E: EthSpec> BeaconNodeFallback<T, E> {
for (result, node) in results { for (result, node) in results {
if let Err(e) = result { if let Err(e) = result {
warn!( if *e != CandidateError::PreGenesis {
self.log, warn!(
"A connected beacon node errored during routine health check."; self.log,
"error" => ?e, "A connected beacon node errored during routine health check.";
"endpoint" => node, "error" => ?e,
); "endpoint" => node,
);
}
} }
} }