@@ -7,6 +7,7 @@ use fhevm_engine_common::tfhe_ops::{current_ciphertext_version, extract_ct_list}
77use fhevm_engine_common:: types:: SupportedFheCiphertexts ;
88
99use fhevm_engine_common:: utils:: safe_deserialize_conformant;
10+ use fhevm_engine_common:: with_panic_guard;
1011use hex:: encode;
1112use lru:: LruCache ;
1213use sha3:: Digest ;
@@ -353,7 +354,7 @@ pub(crate) fn verify_proof(
353354 set_server_key ( keys. server_key . clone ( ) ) ;
354355
355356 let mut s = span. child_span ( "verify_and_expand" ) ;
356- let mut cts = match try_verify_and_expand_ciphertext_list ( request_id, raw_ct, keys, aux_data) {
357+ let mut cts = match verify_and_expand_with_guard ( request_id, raw_ct, keys, aux_data) {
357358 Ok ( cts) => {
358359 telemetry:: attribute ( & mut s, "count" , cts. len ( ) . to_string ( ) ) ;
359360 telemetry:: end_span ( s) ;
@@ -382,6 +383,24 @@ pub(crate) fn verify_proof(
382383 Ok ( ( cts, blob_hash) )
383384}
384385
386+ fn verify_and_expand_with_guard (
387+ request_id : i64 ,
388+ raw_ct : & [ u8 ] ,
389+ keys : & FetchTenantKeyResult ,
390+ aux_data : & auxiliary:: ZkData ,
391+ ) -> Result < Vec < SupportedFheCiphertexts > , ExecutionError > {
392+ with_panic_guard ! ( try_verify_and_expand_ciphertext_list(
393+ request_id, raw_ct, keys, aux_data
394+ ) )
395+ . map_err ( |err| {
396+ // Map panic to VerifyExpandPanic
397+ ExecutionError :: VerifyExpandPanic ( format ! (
398+ "Panic occurred while verifying and expanding: {}" ,
399+ err
400+ ) )
401+ } ) ?
402+ }
403+
385404fn try_verify_and_expand_ciphertext_list (
386405 request_id : i64 ,
387406 raw_ct : & [ u8 ] ,
0 commit comments