@@ -74,8 +74,6 @@ fn binary_op_to_event(
7474 #[ allow( non_snake_case) ]
7575 let scalarByte = s_byte ( op. is_scalar ) ;
7676 let lhs = * lhs;
77- let use_bytes_when_avail = op. is_scalar && op. bits > 256 ;
78- let rhs_bytes = to_bytes ( r_scalar) ;
7977 let rhs = if op. is_scalar && op. bits <= 256 {
8078 as_scalar_handle ( r_scalar)
8179 } else {
@@ -209,44 +207,20 @@ fn binary_op_to_event(
209207 scalarByte,
210208 result,
211209 } ) ,
212- S :: FheEq => {
213- if use_bytes_when_avail {
214- E :: FheEqBytes ( C :: FheEqBytes {
215- caller,
216- lhs,
217- rhs : rhs_bytes,
218- scalarByte,
219- result,
220- } )
221- } else {
222- E :: FheEq ( C :: FheEq {
223- caller,
224- lhs,
225- rhs,
226- scalarByte,
227- result,
228- } )
229- }
230- }
231- S :: FheNe => {
232- if use_bytes_when_avail {
233- E :: FheNeBytes ( C :: FheNeBytes {
234- caller,
235- lhs,
236- rhs : rhs_bytes,
237- scalarByte,
238- result,
239- } )
240- } else {
241- E :: FheNe ( C :: FheNe {
242- caller,
243- lhs,
244- rhs,
245- scalarByte,
246- result,
247- } )
248- }
249- }
210+ S :: FheEq => E :: FheEq ( C :: FheEq {
211+ caller,
212+ lhs,
213+ rhs,
214+ scalarByte,
215+ result,
216+ } ) ,
217+ S :: FheNe => E :: FheNe ( C :: FheNe {
218+ caller,
219+ lhs,
220+ rhs,
221+ scalarByte,
222+ result,
223+ } ) ,
250224 _ => panic ! ( "unknown operation: {:?}" , op. operator) ,
251225 }
252226}
@@ -287,8 +261,8 @@ async fn test_fhe_binary_operands_events() -> Result<(), Box<dyn std::error::Err
287261 let rhs_handle = next_handle ( ) ;
288262 let output_handle = next_handle ( ) ;
289263
290- let lhs_bytes = to_bytes ( & op. lhs ) ;
291- let rhs_bytes = to_bytes ( & op. rhs ) ;
264+ let lhs_bytes = as_scalar_uint ( & op. lhs ) ;
265+ let rhs_bytes = as_scalar_uint ( & op. rhs ) ;
292266
293267 println ! (
294268 "Operations for binary test bits:{} op:{} is_scalar:{} lhs:{} rhs:{}" ,
@@ -298,8 +272,8 @@ async fn test_fhe_binary_operands_events() -> Result<(), Box<dyn std::error::Err
298272 . parse ( )
299273 . unwrap ( ) ;
300274 listener_event_to_db
301- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
302- TfheContract :: TrivialEncryptBytes {
275+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
276+ TfheContract :: TrivialEncrypt {
303277 caller,
304278 pt : lhs_bytes,
305279 toType : to_ty ( op. input_types ) ,
@@ -309,8 +283,8 @@ async fn test_fhe_binary_operands_events() -> Result<(), Box<dyn std::error::Err
309283 . await ?;
310284 if !op. is_scalar {
311285 listener_event_to_db
312- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
313- TfheContract :: TrivialEncryptBytes {
286+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
287+ TfheContract :: TrivialEncrypt {
314288 caller,
315289 pt : rhs_bytes,
316290 toType : to_ty ( op. input_types ) ,
@@ -402,7 +376,7 @@ async fn test_fhe_unary_operands_events() -> Result<(), Box<dyn std::error::Erro
402376 let input_handle = next_handle ( ) ;
403377 let output_handle = next_handle ( ) ;
404378
405- let inp_bytes = to_bytes ( & op. inp ) ;
379+ let inp_bytes = as_scalar_uint ( & op. inp ) ;
406380
407381 println ! (
408382 "Operations for unary test bits:{} op:{} input:{}" ,
@@ -413,8 +387,8 @@ async fn test_fhe_unary_operands_events() -> Result<(), Box<dyn std::error::Erro
413387 . parse ( )
414388 . unwrap ( ) ;
415389 listener_event_to_db
416- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
417- TfheContract :: TrivialEncryptBytes {
390+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
391+ TfheContract :: TrivialEncrypt {
418392 caller,
419393 pt : inp_bytes,
420394 toType : to_ty ( op. operand_types ) ,
@@ -472,21 +446,21 @@ async fn test_fhe_if_then_else_events() -> Result<(), Box<dyn std::error::Error>
472446 . unwrap ( ) ;
473447
474448 listener_event_to_db
475- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
476- TfheContract :: TrivialEncryptBytes {
449+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
450+ TfheContract :: TrivialEncrypt {
477451 caller,
478- pt : to_bytes ( & BigInt :: from ( 0 ) ) ,
452+ pt : as_scalar_uint ( & BigInt :: from ( 0 ) ) ,
479453 toType : to_ty ( fhe_bool_type) ,
480454 result : false_handle,
481455 } ,
482456 ) ) )
483457 . await ?;
484458
485459 listener_event_to_db
486- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
487- TfheContract :: TrivialEncryptBytes {
460+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
461+ TfheContract :: TrivialEncrypt {
488462 caller,
489- pt : to_bytes ( & BigInt :: from ( 1 ) ) ,
463+ pt : as_scalar_uint ( & BigInt :: from ( 1 ) ) ,
490464 toType : to_ty ( fhe_bool_type) ,
491465 result : true_handle,
492466 } ,
@@ -504,21 +478,21 @@ async fn test_fhe_if_then_else_events() -> Result<(), Box<dyn std::error::Error>
504478 } ;
505479
506480 listener_event_to_db
507- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
508- TfheContract :: TrivialEncryptBytes {
481+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
482+ TfheContract :: TrivialEncrypt {
509483 caller,
510- pt : to_bytes ( & left_input) ,
484+ pt : as_scalar_uint ( & left_input) ,
511485 toType : to_ty ( * input_types) ,
512486 result : left_handle,
513487 } ,
514488 ) ) )
515489 . await ?;
516490
517491 listener_event_to_db
518- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
519- TfheContract :: TrivialEncryptBytes {
492+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
493+ TfheContract :: TrivialEncrypt {
520494 caller,
521- pt : to_bytes ( & right_input) ,
495+ pt : as_scalar_uint ( & right_input) ,
522496 toType : to_ty ( * input_types) ,
523497 result : right_handle,
524498 } ,
@@ -604,10 +578,10 @@ async fn test_fhe_cast_events() -> Result<(), Box<dyn std::error::Error>> {
604578 ) ;
605579
606580 listener_event_to_db
607- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
608- TfheContract :: TrivialEncryptBytes {
581+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
582+ TfheContract :: TrivialEncrypt {
609583 caller,
610- pt : to_bytes ( & BigInt :: from ( input) ) ,
584+ pt : as_scalar_uint ( & BigInt :: from ( input) ) ,
611585 toType : to_ty ( * type_from) ,
612586 result : input_handle,
613587 } ,
0 commit comments