@@ -17,7 +17,6 @@ pub fn supported_types() -> &'static [i32] {
1717 & [
1818 0 , // bool
1919 8 , // 256 bit
20- 9 , // ebytes 64
2120 ]
2221}
2322
@@ -74,8 +73,6 @@ fn binary_op_to_event(
7473 #[ allow( non_snake_case) ]
7574 let scalarByte = s_byte ( op. is_scalar ) ;
7675 let lhs = * lhs;
77- let use_bytes_when_avail = op. is_scalar && op. bits > 256 ;
78- let rhs_bytes = to_bytes ( r_scalar) ;
7976 let rhs = if op. is_scalar && op. bits <= 256 {
8077 as_scalar_handle ( r_scalar)
8178 } else {
@@ -209,44 +206,20 @@ fn binary_op_to_event(
209206 scalarByte,
210207 result,
211208 } ) ,
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- }
209+ S :: FheEq => E :: FheEq ( C :: FheEq {
210+ caller,
211+ lhs,
212+ rhs,
213+ scalarByte,
214+ result,
215+ } ) ,
216+ S :: FheNe => E :: FheNe ( C :: FheNe {
217+ caller,
218+ lhs,
219+ rhs,
220+ scalarByte,
221+ result,
222+ } ) ,
250223 _ => panic ! ( "unknown operation: {:?}" , op. operator) ,
251224 }
252225}
@@ -287,8 +260,8 @@ async fn test_fhe_binary_operands_events() -> Result<(), Box<dyn std::error::Err
287260 let rhs_handle = next_handle ( ) ;
288261 let output_handle = next_handle ( ) ;
289262
290- let lhs_bytes = to_bytes ( & op. lhs ) ;
291- let rhs_bytes = to_bytes ( & op. rhs ) ;
263+ let lhs_bytes = as_scalar_uint ( & op. lhs ) ;
264+ let rhs_bytes = as_scalar_uint ( & op. rhs ) ;
292265
293266 println ! (
294267 "Operations for binary test bits:{} op:{} is_scalar:{} lhs:{} rhs:{}" ,
@@ -298,8 +271,8 @@ async fn test_fhe_binary_operands_events() -> Result<(), Box<dyn std::error::Err
298271 . parse ( )
299272 . unwrap ( ) ;
300273 listener_event_to_db
301- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
302- TfheContract :: TrivialEncryptBytes {
274+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
275+ TfheContract :: TrivialEncrypt {
303276 caller,
304277 pt : lhs_bytes,
305278 toType : to_ty ( op. input_types ) ,
@@ -309,8 +282,8 @@ async fn test_fhe_binary_operands_events() -> Result<(), Box<dyn std::error::Err
309282 . await ?;
310283 if !op. is_scalar {
311284 listener_event_to_db
312- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
313- TfheContract :: TrivialEncryptBytes {
285+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
286+ TfheContract :: TrivialEncrypt {
314287 caller,
315288 pt : rhs_bytes,
316289 toType : to_ty ( op. input_types ) ,
@@ -402,7 +375,7 @@ async fn test_fhe_unary_operands_events() -> Result<(), Box<dyn std::error::Erro
402375 let input_handle = next_handle ( ) ;
403376 let output_handle = next_handle ( ) ;
404377
405- let inp_bytes = to_bytes ( & op. inp ) ;
378+ let inp_bytes = as_scalar_uint ( & op. inp ) ;
406379
407380 println ! (
408381 "Operations for unary test bits:{} op:{} input:{}" ,
@@ -413,8 +386,8 @@ async fn test_fhe_unary_operands_events() -> Result<(), Box<dyn std::error::Erro
413386 . parse ( )
414387 . unwrap ( ) ;
415388 listener_event_to_db
416- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
417- TfheContract :: TrivialEncryptBytes {
389+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
390+ TfheContract :: TrivialEncrypt {
418391 caller,
419392 pt : inp_bytes,
420393 toType : to_ty ( op. operand_types ) ,
@@ -472,21 +445,21 @@ async fn test_fhe_if_then_else_events() -> Result<(), Box<dyn std::error::Error>
472445 . unwrap ( ) ;
473446
474447 listener_event_to_db
475- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
476- TfheContract :: TrivialEncryptBytes {
448+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
449+ TfheContract :: TrivialEncrypt {
477450 caller,
478- pt : to_bytes ( & BigInt :: from ( 0 ) ) ,
451+ pt : as_scalar_uint ( & BigInt :: from ( 0 ) ) ,
479452 toType : to_ty ( fhe_bool_type) ,
480453 result : false_handle,
481454 } ,
482455 ) ) )
483456 . await ?;
484457
485458 listener_event_to_db
486- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
487- TfheContract :: TrivialEncryptBytes {
459+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
460+ TfheContract :: TrivialEncrypt {
488461 caller,
489- pt : to_bytes ( & BigInt :: from ( 1 ) ) ,
462+ pt : as_scalar_uint ( & BigInt :: from ( 1 ) ) ,
490463 toType : to_ty ( fhe_bool_type) ,
491464 result : true_handle,
492465 } ,
@@ -504,21 +477,21 @@ async fn test_fhe_if_then_else_events() -> Result<(), Box<dyn std::error::Error>
504477 } ;
505478
506479 listener_event_to_db
507- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
508- TfheContract :: TrivialEncryptBytes {
480+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
481+ TfheContract :: TrivialEncrypt {
509482 caller,
510- pt : to_bytes ( & left_input) ,
483+ pt : as_scalar_uint ( & left_input) ,
511484 toType : to_ty ( * input_types) ,
512485 result : left_handle,
513486 } ,
514487 ) ) )
515488 . await ?;
516489
517490 listener_event_to_db
518- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
519- TfheContract :: TrivialEncryptBytes {
491+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
492+ TfheContract :: TrivialEncrypt {
520493 caller,
521- pt : to_bytes ( & right_input) ,
494+ pt : as_scalar_uint ( & right_input) ,
522495 toType : to_ty ( * input_types) ,
523496 result : right_handle,
524497 } ,
@@ -604,10 +577,10 @@ async fn test_fhe_cast_events() -> Result<(), Box<dyn std::error::Error>> {
604577 ) ;
605578
606579 listener_event_to_db
607- . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncryptBytes (
608- TfheContract :: TrivialEncryptBytes {
580+ . insert_tfhe_event ( & tfhe_event ( TfheContractEvents :: TrivialEncrypt (
581+ TfheContract :: TrivialEncrypt {
609582 caller,
610- pt : to_bytes ( & BigInt :: from ( input) ) ,
583+ pt : as_scalar_uint ( & BigInt :: from ( input) ) ,
611584 toType : to_ty ( * type_from) ,
612585 result : input_handle,
613586 } ,
0 commit comments