From 38fdfe083f61f5aad11b5a0efb41215c674f3186 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 5 Jun 2024 13:36:32 +0300 Subject: [PATCH] fix(en): Fix transient error detection in consistency checker (#2140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Considers a subset of contract call errors as transient. ## Why ❔ Currently, consistency checker considers all contract call errors fatal, which leads to EN terminating when it shouldn't. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Code has been formatted via `zk fmt` and `zk lint`. - [x] Spellcheck has been run via `zk spellcheck`. --- core/node/consistency_checker/src/lib.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/core/node/consistency_checker/src/lib.rs b/core/node/consistency_checker/src/lib.rs index ae092b2d1c1..79ce137560c 100644 --- a/core/node/consistency_checker/src/lib.rs +++ b/core/node/consistency_checker/src/lib.rs @@ -42,10 +42,12 @@ enum CheckError { impl CheckError { fn is_transient(&self) -> bool { - matches!( - self, - Self::Web3(err) if err.is_transient() - ) + match self { + Self::Web3(err) | Self::ContractCall(ContractCallError::EthereumGateway(err)) => { + err.is_transient() + } + _ => false, + } } } @@ -532,7 +534,10 @@ impl ConsistencyChecker { while let Err(err) = self.sanity_check_diamond_proxy_addr().await { if err.is_transient() { - tracing::warn!("Transient error checking diamond proxy contract; will retry after a delay: {err}"); + tracing::warn!( + "Transient error checking diamond proxy contract; will retry after a delay: {:#}", + anyhow::Error::from(err) + ); if tokio::time::timeout(self.sleep_interval, stop_receiver.changed()) .await .is_ok() @@ -629,7 +634,10 @@ impl ConsistencyChecker { } } Err(err) if err.is_transient() => { - tracing::warn!("Transient error while verifying L1 batch #{batch_number}; will retry after a delay: {err}"); + tracing::warn!( + "Transient error while verifying L1 batch #{batch_number}; will retry after a delay: {:#}", + anyhow::Error::from(err) + ); if tokio::time::timeout(self.sleep_interval, stop_receiver.changed()) .await .is_ok()