From a3405a3104e8505b7e9df5a775fadf42622d6829 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Fri, 17 May 2024 11:29:38 +0300 Subject: [PATCH 1/4] Fix unncessary shutdown warnings --- core/bin/external_node/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/bin/external_node/src/main.rs b/core/bin/external_node/src/main.rs index 378efc3f738a..dbd6203590f7 100644 --- a/core/bin/external_node/src/main.rs +++ b/core/bin/external_node/src/main.rs @@ -1019,9 +1019,12 @@ async fn run_node( let mut tasks = ManagedTasks::new(task_handles); tokio::select! { - () = tasks.wait_single() => {}, + // We don't want to log unnecessary warnings in `tasks.wait_single()` if we have received a stop signal. + biased; + _ = stop_receiver.changed() => {}, - }; + () = tasks.wait_single() => {}, + } // Reaching this point means that either some actor exited unexpectedly or we received a stop signal. // Broadcast the stop signal (in case it wasn't broadcast previously) to all actors and exit. From 6473212eb8e5bd6d0eb7a5b2cd14d71b10c2153a Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Fri, 17 May 2024 11:49:34 +0300 Subject: [PATCH 2/4] Tag L2 client for block fetcher --- core/node/consensus/src/era.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/node/consensus/src/era.rs b/core/node/consensus/src/era.rs index 5cf537f65300..05b5fc81720e 100644 --- a/core/node/consensus/src/era.rs +++ b/core/node/consensus/src/era.rs @@ -44,7 +44,7 @@ pub async fn run_en( let en = en::EN { pool: ConnectionPool(pool), sync_state: sync_state.clone(), - client: main_node_client, + client: main_node_client.for_component("block_fetcher"), }; let res = match cfg { Some((cfg, secrets)) => en.run(ctx, actions, cfg, secrets).await, From 5672086622f7ab34bd6b67ed7e4e3ae4814778f6 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Fri, 17 May 2024 11:50:28 +0300 Subject: [PATCH 3/4] Downgrade some client warnings --- core/lib/web3_decl/src/client/metrics.rs | 2 +- core/lib/web3_decl/src/client/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/web3_decl/src/client/metrics.rs b/core/lib/web3_decl/src/client/metrics.rs index be07e68c8a29..01daf76cf07c 100644 --- a/core/lib/web3_decl/src/client/metrics.rs +++ b/core/lib/web3_decl/src/client/metrics.rs @@ -83,7 +83,7 @@ impl L2ClientMetrics { }; let info = &self.info[&network]; if let Err(err) = info.set(config_labels) { - tracing::warn!( + tracing::debug!( "Error setting configuration info {:?} for L2 client; already set to {:?}", err.into_inner(), info.get() diff --git a/core/lib/web3_decl/src/client/mod.rs b/core/lib/web3_decl/src/client/mod.rs index 090d766f8f54..3e2795edd073 100644 --- a/core/lib/web3_decl/src/client/mod.rs +++ b/core/lib/web3_decl/src/client/mod.rs @@ -196,7 +196,7 @@ impl Client { origin, &stats, ); - tracing::warn!( + tracing::debug!( network = network_label, component = self.component_name, %origin, From 4cca698ccd94e75a5e9469e2748c72323c1d88af Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Fri, 17 May 2024 11:59:35 +0300 Subject: [PATCH 4/4] Improve transient error detection --- core/lib/web3_decl/src/error.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/lib/web3_decl/src/error.rs b/core/lib/web3_decl/src/error.rs index 1ada1f602324..692bbec8b70a 100644 --- a/core/lib/web3_decl/src/error.rs +++ b/core/lib/web3_decl/src/error.rs @@ -11,7 +11,7 @@ use std::{ task::{Context, Poll}, }; -use jsonrpsee::core::ClientError; +use jsonrpsee::{core::ClientError, types::error::ErrorCode}; use pin_project_lite::pin_project; use thiserror::Error; use zksync_types::{api::SerializationTransactionError, L1BatchNumber, L2BlockNumber}; @@ -85,10 +85,15 @@ impl EnrichedClientError { /// Whether the error should be considered transient. pub fn is_transient(&self) -> bool { - matches!( - self.as_ref(), - ClientError::Transport(_) | ClientError::RequestTimeout - ) + match self.as_ref() { + ClientError::Transport(_) | ClientError::RequestTimeout => true, + ClientError::Call(err) => { + // At least some RPC providers use "internal error" in case of the server being overloaded + err.code() == ErrorCode::ServerIsBusy.code() + || err.code() == ErrorCode::InternalError.code() + } + _ => false, + } } }