From ac73296d639553c3f87f60ff363c2c695dc829b4 Mon Sep 17 00:00:00 2001 From: Ammar Arif Date: Fri, 17 Apr 2026 15:56:31 -0500 Subject: [PATCH 1/3] feat(sozo): warn instead of error on RPC spec version mismatch When the node reports a starknet_specVersion that does not match the one sozo was built against, emit a warning via SozoUi and continue instead of aborting the command. A genuinely incompatible RPC will still surface the real failure at the call that actually breaks, with a much more specific error than the blanket version gate. Parse failures on the version string are also downgraded to a warning. Co-Authored-By: Claude Opus 4.7 (1M context) --- bin/sozo/src/utils.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/sozo/src/utils.rs b/bin/sozo/src/utils.rs index 6daede5306..64962487f9 100644 --- a/bin/sozo/src/utils.rs +++ b/bin/sozo/src/utils.rs @@ -123,10 +123,16 @@ pub async fn get_world_diff_and_provider( let spec_version = provider.spec_version().await?; trace!(spec_version); - if !is_compatible_version(&spec_version, RPC_SPEC_VERSION)? { - return Err(anyhow!( - "Unsupported Starknet RPC version: {spec_version}, expected {RPC_SPEC_VERSION}.", - )); + match is_compatible_version(&spec_version, RPC_SPEC_VERSION) { + Ok(true) => {} + Ok(false) => ui.warn(format!( + "Starknet RPC version mismatch: node reports {spec_version}, sozo was built \ + against {RPC_SPEC_VERSION}. Continuing anyway; operations may fail if RPC \ + methods differ." + )), + Err(e) => ui.warn(format!( + "Could not parse Starknet RPC version '{spec_version}': {e}. Continuing." + )), } let chain_id = provider.chain_id().await?; From f50ec7734e97730cf1bd33accb6731f788ca08ff Mon Sep 17 00:00:00 2001 From: Ammar Arif Date: Fri, 17 Apr 2026 16:07:42 -0500 Subject: [PATCH 2/3] style(sozo): apply nightly rustfmt to mismatch warning string Co-Authored-By: Claude Opus 4.7 (1M context) --- bin/sozo/src/utils.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/sozo/src/utils.rs b/bin/sozo/src/utils.rs index 64962487f9..602a4ebe7b 100644 --- a/bin/sozo/src/utils.rs +++ b/bin/sozo/src/utils.rs @@ -126,9 +126,8 @@ pub async fn get_world_diff_and_provider( match is_compatible_version(&spec_version, RPC_SPEC_VERSION) { Ok(true) => {} Ok(false) => ui.warn(format!( - "Starknet RPC version mismatch: node reports {spec_version}, sozo was built \ - against {RPC_SPEC_VERSION}. Continuing anyway; operations may fail if RPC \ - methods differ." + "Starknet RPC version mismatch: node reports {spec_version}, sozo was built against \ + {RPC_SPEC_VERSION}. Continuing anyway; operations may fail if RPC methods differ." )), Err(e) => ui.warn(format!( "Could not parse Starknet RPC version '{spec_version}': {e}. Continuing." From 92ac691228911a76752fd9dcc4d99928c34ceb53 Mon Sep 17 00:00:00 2001 From: Ammar Arif Date: Sun, 19 Apr 2026 00:08:29 -0500 Subject: [PATCH 3/3] feat(sozo): warn instead of error on spec_version RPC call failure Extend the soften-on-version-stuff treatment to cover the case where the starknet_specVersion RPC call itself fails (method not exposed, transient network issue). Same rationale as the mismatch case: if the node is genuinely incompatible, the real error surfaces at the specific RPC call that breaks. Co-Authored-By: Claude Opus 4.7 (1M context) --- bin/sozo/src/utils.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/bin/sozo/src/utils.rs b/bin/sozo/src/utils.rs index 602a4ebe7b..afba56f406 100644 --- a/bin/sozo/src/utils.rs +++ b/bin/sozo/src/utils.rs @@ -120,17 +120,24 @@ pub async fn get_world_diff_and_provider( let provider = Arc::try_unwrap(provider).map_err(|_| anyhow!("Failed to unwrap Arc"))?; trace!(?provider, "Provider initialized."); - let spec_version = provider.spec_version().await?; - trace!(spec_version); - - match is_compatible_version(&spec_version, RPC_SPEC_VERSION) { - Ok(true) => {} - Ok(false) => ui.warn(format!( - "Starknet RPC version mismatch: node reports {spec_version}, sozo was built against \ - {RPC_SPEC_VERSION}. Continuing anyway; operations may fail if RPC methods differ." - )), + match provider.spec_version().await { + Ok(spec_version) => { + trace!(spec_version); + match is_compatible_version(&spec_version, RPC_SPEC_VERSION) { + Ok(true) => {} + Ok(false) => ui.warn(format!( + "Starknet RPC version mismatch: node reports {spec_version}, sozo was built \ + against {RPC_SPEC_VERSION}. Continuing anyway; operations may fail if RPC \ + methods differ." + )), + Err(e) => ui.warn(format!( + "Could not parse Starknet RPC version '{spec_version}': {e}. Continuing." + )), + } + } Err(e) => ui.warn(format!( - "Could not parse Starknet RPC version '{spec_version}': {e}. Continuing." + "Could not query Starknet RPC version: {e}. Continuing; operations may fail if RPC \ + methods differ." )), }