From 6a027c66c7e70f4e89b690783163b53e2cc32d03 Mon Sep 17 00:00:00 2001 From: Mathieu Dutour Sikiric Date: Mon, 13 Oct 2025 13:37:56 +0200 Subject: [PATCH 1/2] Correction of the BlobsNotFound for follow-chain when a chain does not exist. --- linera-service/src/cli/main.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/linera-service/src/cli/main.rs b/linera-service/src/cli/main.rs index 9e8c5b5fdeb6..1e3705484cea 100644 --- a/linera-service/src/cli/main.rs +++ b/linera-service/src/cli/main.rs @@ -40,7 +40,7 @@ use futures::{lock::Mutex, FutureExt as _, StreamExt}; use linera_base::{ crypto::{InMemorySigner, Signer}, data_types::{ApplicationPermissions, Timestamp}, - identifiers::{AccountOwner, ChainId}, + identifiers::{AccountOwner, BlobId, BlobType, ChainId}, listen_for_shutdown_signals, ownership::ChainOwnership, time::{Duration, Instant}, @@ -56,7 +56,7 @@ use linera_client::{ use linera_core::{ client::{ChainClientError, ListeningMode}, data_types::ClientOutcome, - node::ValidatorNodeProvider, + node::{NodeError, ValidatorNodeProvider}, worker::Reason, JoinSetExt as _, LocalNodeError, }; @@ -1627,11 +1627,21 @@ impl Runnable for Job { let start_time = Instant::now(); context.client.track_chain(chain_id); let chain_client = context.make_chain_client(chain_id); - if sync { - chain_client.synchronize_chain_state(chain_id).await?; + + let result = if sync { + chain_client.synchronize_chain_state(chain_id).await } else { - chain_client.fetch_chain_info().await?; + chain_client.fetch_chain_info().await + }; + match result { + Err(ChainClientError::RemoteNodeError(NodeError::BlobsNotFound(blob_ids))) + if blob_ids == vec![BlobId { blob_type: BlobType::ChainDescription, hash: chain_id.0 }] => { + bail!("Error following chain {chain_id}: It does not exist"); + } + Err(e) => return Err(e.into()), + Ok(_) => {} } + context.update_wallet_from_client(&chain_client).await?; info!( "Chain followed and added in {} ms", From 4c4f48e0e74bbcf269a183137f43434d64a7014e Mon Sep 17 00:00:00 2001 From: Mathieu Dutour Sikiric Date: Mon, 13 Oct 2025 13:58:27 +0200 Subject: [PATCH 2/2] Reformatting. --- linera-service/src/cli/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/linera-service/src/cli/main.rs b/linera-service/src/cli/main.rs index 1e3705484cea..29284f916f7d 100644 --- a/linera-service/src/cli/main.rs +++ b/linera-service/src/cli/main.rs @@ -1635,9 +1635,14 @@ impl Runnable for Job { }; match result { Err(ChainClientError::RemoteNodeError(NodeError::BlobsNotFound(blob_ids))) - if blob_ids == vec![BlobId { blob_type: BlobType::ChainDescription, hash: chain_id.0 }] => { - bail!("Error following chain {chain_id}: It does not exist"); - } + if blob_ids + == vec![BlobId { + blob_type: BlobType::ChainDescription, + hash: chain_id.0, + }] => + { + bail!("Error following chain {chain_id}: It does not exist"); + } Err(e) => return Err(e.into()), Ok(_) => {} }