From f56711ad4c669a02103548e444eaffa5be412239 Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Mon, 18 May 2026 16:08:48 +0800 Subject: [PATCH] fix(prover): replace .unwrap() with map_err in blob KZG verification The three .unwrap() calls on KzgRsBlob/Bytes48 slice conversions could panic the prover process if the upstream RPC returned malformed blob data, dropping all queued proofs. Convert to map_err(...)? so the current request fails while the process keeps serving other tasks. --- .../crates/executor/client/src/verifier/blob_verifier.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/prover/crates/executor/client/src/verifier/blob_verifier.rs b/prover/crates/executor/client/src/verifier/blob_verifier.rs index 729675c8d..4c83e7a00 100644 --- a/prover/crates/executor/client/src/verifier/blob_verifier.rs +++ b/prover/crates/executor/client/src/verifier/blob_verifier.rs @@ -45,9 +45,12 @@ impl BlobVerifier { /// KZG-verify a blob's commitment/proof and return its versioned hash. fn verify_kzg(blob_info: &BlobInfo) -> Result { let versioned_hash = kzg_to_versioned_hash(&blob_info.commitment); - let blob = KzgRsBlob::from_slice(&blob_info.blob_data).unwrap(); - let commitment = Bytes48::from_slice(&blob_info.commitment).unwrap(); - let proof = Bytes48::from_slice(&blob_info.proof).unwrap(); + let blob = KzgRsBlob::from_slice(&blob_info.blob_data) + .map_err(|e| anyhow!("invalid blob_data length: {e:?}"))?; + let commitment = Bytes48::from_slice(&blob_info.commitment) + .map_err(|e| anyhow!("invalid commitment length: {e:?}"))?; + let proof = Bytes48::from_slice(&blob_info.proof) + .map_err(|e| anyhow!("invalid proof length: {e:?}"))?; let verify_result = kzg_rs::KzgProof::verify_blob_kzg_proof(blob, &commitment, &proof, &get_kzg_settings())