From f609aa3ecbc6ec15e9fdf1bf12da4519206fa544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Mon, 28 Oct 2024 10:41:25 +0300 Subject: [PATCH] error-chain_prover: Add new ProveError type and use it. --- core/src/chain_prover.rs | 8 ++++---- core/src/errors.rs | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/chain_prover.rs b/core/src/chain_prover.rs index 28f9dd67..18522a1f 100644 --- a/core/src/chain_prover.rs +++ b/core/src/chain_prover.rs @@ -233,10 +233,10 @@ where let prover = risc0_zkvm::default_prover(); - let receipt = prover - .prove(env, verifier_circuit::GUEST_ELF) - .unwrap() - .receipt; + let receipt = match prover.prove(env, verifier_circuit::GUEST_ELF) { + Ok(proove_info) => proove_info.receipt, + Err(e) => return Err(BridgeError::ProveError(e.to_string())), + }; let output: ([u32; 8], [u8; 32], u32, [u8; 32], [u8; 32]) = receipt.journal.decode().unwrap(); diff --git a/core/src/errors.rs b/core/src/errors.rs index 1559c78f..e507a609 100644 --- a/core/src/errors.rs +++ b/core/src/errors.rs @@ -176,6 +176,9 @@ pub enum BridgeError { #[error("Musig2 error: {0}")] Musig2Error(#[from] musig2::secp256k1::Error), + + #[error("Proving error: {0}")] + ProveError(String), } impl From for ErrorObject<'static> {