Log a WARN in the VC for a mismatched Capella fork epoch (#4050)

## Issue Addressed

NA

## Proposed Changes

- Adds a `WARN` statement for Capella, just like the previous forks.
- Adds a hint message to all those WARNs to suggest the user update the BN or VC.

## Additional Info

NA
This commit is contained in:
Paul Hauner 2023-03-06 04:08:48 +00:00
parent 4dc0c4c5b7
commit f775404c10

View File

@ -18,6 +18,9 @@ use std::time::{Duration, Instant};
use tokio::{sync::RwLock, time::sleep}; use tokio::{sync::RwLock, time::sleep};
use types::{ChainSpec, Config, EthSpec}; use types::{ChainSpec, Config, EthSpec};
/// Message emitted when the VC detects the BN is using a different spec.
const UPDATE_REQUIRED_LOG_HINT: &str = "this VC or the remote BN may need updating";
/// The number of seconds *prior* to slot start that we will try and update the state of fallback /// The number of seconds *prior* to slot start that we will try and update the state of fallback
/// nodes. /// nodes.
/// ///
@ -270,6 +273,7 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
"Beacon node has mismatched Altair fork epoch"; "Beacon node has mismatched Altair fork epoch";
"endpoint" => %self.beacon_node, "endpoint" => %self.beacon_node,
"endpoint_altair_fork_epoch" => ?beacon_node_spec.altair_fork_epoch, "endpoint_altair_fork_epoch" => ?beacon_node_spec.altair_fork_epoch,
"hint" => UPDATE_REQUIRED_LOG_HINT,
); );
} else if beacon_node_spec.bellatrix_fork_epoch != spec.bellatrix_fork_epoch { } else if beacon_node_spec.bellatrix_fork_epoch != spec.bellatrix_fork_epoch {
warn!( warn!(
@ -277,6 +281,15 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
"Beacon node has mismatched Bellatrix fork epoch"; "Beacon node has mismatched Bellatrix fork epoch";
"endpoint" => %self.beacon_node, "endpoint" => %self.beacon_node,
"endpoint_bellatrix_fork_epoch" => ?beacon_node_spec.bellatrix_fork_epoch, "endpoint_bellatrix_fork_epoch" => ?beacon_node_spec.bellatrix_fork_epoch,
"hint" => UPDATE_REQUIRED_LOG_HINT,
);
} else if beacon_node_spec.capella_fork_epoch != spec.capella_fork_epoch {
warn!(
log,
"Beacon node has mismatched Capella fork epoch";
"endpoint" => %self.beacon_node,
"endpoint_capella_fork_epoch" => ?beacon_node_spec.capella_fork_epoch,
"hint" => UPDATE_REQUIRED_LOG_HINT,
); );
} }