Skip to content

Conversation

@goshawk-3
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds panic handling to the verify_and_expand_ciphertext_list operation in the zkproof-worker by wrapping it with a panic guard macro. This follows the same defensive programming pattern already established in the sns-worker for similar cryptographic operations.

  • Introduced VerifyExpandPanic error variant to handle panics during verification/expansion
  • Added verify_and_expand_with_guard wrapper function that catches panics using the with_panic_guard macro
  • Refactored the call to use panic-safe wrapper instead of direct invocation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
coprocessor/fhevm-engine/zkproof-worker/src/lib.rs Added new VerifyExpandPanic error variant to the ExecutionError enum
coprocessor/fhevm-engine/zkproof-worker/src/verifier.rs Added panic guard wrapper function and updated verify_proof to use the safer guarded version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"Panic occurred while verifying and expanding: {}",
err
))
})?
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The with_panic_guard! macro returns Result<T, String> on success (wrapping the inner result), so this code performs double error handling. The ? operator at line 401 will propagate the outer Result<Vec<SupportedFheCiphertexts>, ExecutionError> from map_err, but the inner Result<Vec<SupportedFheCiphertexts>, ExecutionError> from try_verify_and_expand_ciphertext_list is still wrapped. This should be .map_err(...)? followed by another ? to unwrap both layers, or the entire expression should use ??. Compare with the sns-worker implementation at lines 766-776 which correctly uses ?? to handle both the panic result and the inner result.

Suggested change
})?
})??

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants