From 0589a14afeb69c0dcbaac68b108f9852779915cd Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Thu, 26 Nov 2020 23:13:46 +0000 Subject: [PATCH] Log better error message (#1981) ## Issue Addressed Fixes #1965 ## Proposed Changes Log an error and don't update eth1 caches if `chain_id = 0` --- beacon_node/eth1/src/service.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/beacon_node/eth1/src/service.rs b/beacon_node/eth1/src/service.rs index e63883546..0bc5e9432 100644 --- a/beacon_node/eth1/src/service.rs +++ b/beacon_node/eth1/src/service.rs @@ -32,7 +32,7 @@ const GET_BLOCK_TIMEOUT_MILLIS: u64 = STANDARD_TIMEOUT_MILLIS; /// Timeout when doing an eth_getLogs to read the deposit contract logs. const GET_DEPOSIT_LOG_TIMEOUT_MILLIS: u64 = STANDARD_TIMEOUT_MILLIS; -const WARNING_MSG: &str = "BLOCK PROPOSALS WILL FAIL WITHOUT VALID ETH1 CONNECTION"; +const WARNING_MSG: &str = "BLOCK PROPOSALS WILL FAIL WITHOUT VALID, SYNCED ETH1 CONNECTION"; /// A factor used to reduce the eth1 follow distance to account for discrepancies in the block time. const ETH1_BLOCK_TIME_TOLERANCE_FACTOR: u64 = 4; @@ -450,6 +450,16 @@ impl Service { ); return Ok(()); } + // Eth1 nodes return chain_id = 0 if the node is not synced + // Handle the special case + if chain_id == Eth1Id::Custom(0) { + crit!( + self.log, + "Remote eth1 node is not synced"; + "warning" => WARNING_MSG, + ); + return Ok(()); + } if chain_id != config_chain_id { crit!( self.log,