From c0122e1a526cc0f30c7fb990065256aa47796fe4 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Mon, 27 Sep 2021 04:22:07 +0000 Subject: [PATCH] Refine VC->BN config check (#2636) ## Proposed Changes Instead of checking for strict equality between a BN's spec and the VC's local spec, just check the genesis fork version. This prevents us from failing eagerly for minor differences, while still protecting the VC from connecting to a completely incompatible BN. A warning is retained for the previous case where the specs are not exactly equal, which is to be expected if e.g. running against Infura before Infura configures the mainnet Altair fork epoch. --- validator_client/src/beacon_node_fallback.rs | 30 ++++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/validator_client/src/beacon_node_fallback.rs b/validator_client/src/beacon_node_fallback.rs index 153e88028a..487b5744d0 100644 --- a/validator_client/src/beacon_node_fallback.rs +++ b/validator_client/src/beacon_node_fallback.rs @@ -244,17 +244,35 @@ impl CandidateBeaconNode { ); } - if *spec == beacon_node_spec { - Ok(()) - } else { + if beacon_node_spec.genesis_fork_version != spec.genesis_fork_version { error!( log, - "The beacon node is using a different Eth2 specification to this validator client. \ - See the --network command."; + "Beacon node is configured for a different network"; "endpoint" => %self.beacon_node, + "bn_genesis_fork" => ?beacon_node_spec.genesis_fork_version, + "our_genesis_fork" => ?spec.genesis_fork_version, + ); + return Err(CandidateError::Incompatible); + } else if *spec != beacon_node_spec { + warn!( + log, + "Beacon node config does not match exactly"; + "endpoint" => %self.beacon_node, + "advice" => "check that the BN is updated and configured for any upcoming forks", + ); + debug!( + log, + "Beacon node config"; + "config" => ?beacon_node_spec, + ); + debug!( + log, + "Our config"; + "config" => ?spec, ); - Err(CandidateError::Incompatible) } + + Ok(()) } /// Checks if the beacon node is synced.