@@ -82,7 +82,7 @@ impl<F: std::fmt::Display> std::fmt::Display for FunctionInput<F> {
82
82
}
83
83
84
84
#[ derive( Clone , PartialEq , Eq , Serialize , Deserialize , Hash ) ]
85
- pub enum BlackBoxFuncCall < F : AcirField > {
85
+ pub enum BlackBoxFuncCall < F > {
86
86
AES128Encrypt {
87
87
inputs : Vec < FunctionInput < F > > ,
88
88
iv : Box < [ FunctionInput < F > ; 16 ] > ,
@@ -216,7 +216,7 @@ pub enum BlackBoxFuncCall<F: AcirField> {
216
216
} ,
217
217
}
218
218
219
- impl < F : Copy + AcirField > BlackBoxFuncCall < F > {
219
+ impl < F > BlackBoxFuncCall < F > {
220
220
pub fn get_black_box_func ( & self ) -> BlackBoxFunc {
221
221
match self {
222
222
BlackBoxFuncCall :: AES128Encrypt { .. } => BlackBoxFunc :: AES128Encrypt ,
@@ -246,6 +246,41 @@ impl<F: Copy + AcirField> BlackBoxFuncCall<F> {
246
246
self . get_black_box_func ( ) . name ( )
247
247
}
248
248
249
+ pub fn get_outputs_vec ( & self ) -> Vec < Witness > {
250
+ match self {
251
+ BlackBoxFuncCall :: Blake2s { outputs, .. }
252
+ | BlackBoxFuncCall :: Blake3 { outputs, .. } => outputs. to_vec ( ) ,
253
+
254
+ BlackBoxFuncCall :: Keccakf1600 { outputs, .. } => outputs. to_vec ( ) ,
255
+
256
+ BlackBoxFuncCall :: Sha256Compression { outputs, .. } => outputs. to_vec ( ) ,
257
+
258
+ BlackBoxFuncCall :: AES128Encrypt { outputs, .. }
259
+ | BlackBoxFuncCall :: Poseidon2Permutation { outputs, .. } => outputs. to_vec ( ) ,
260
+
261
+ BlackBoxFuncCall :: AND { output, .. }
262
+ | BlackBoxFuncCall :: XOR { output, .. }
263
+ | BlackBoxFuncCall :: EcdsaSecp256k1 { output, .. }
264
+ | BlackBoxFuncCall :: EcdsaSecp256r1 { output, .. } => vec ! [ * output] ,
265
+ BlackBoxFuncCall :: MultiScalarMul { outputs, .. }
266
+ | BlackBoxFuncCall :: EmbeddedCurveAdd { outputs, .. } => {
267
+ vec ! [ outputs. 0 , outputs. 1 , outputs. 2 ]
268
+ }
269
+ BlackBoxFuncCall :: RANGE { .. }
270
+ | BlackBoxFuncCall :: RecursiveAggregation { .. }
271
+ | BlackBoxFuncCall :: BigIntFromLeBytes { .. }
272
+ | BlackBoxFuncCall :: BigIntAdd { .. }
273
+ | BlackBoxFuncCall :: BigIntSub { .. }
274
+ | BlackBoxFuncCall :: BigIntMul { .. }
275
+ | BlackBoxFuncCall :: BigIntDiv { .. } => {
276
+ vec ! [ ]
277
+ }
278
+ BlackBoxFuncCall :: BigIntToLeBytes { outputs, .. } => outputs. to_vec ( ) ,
279
+ }
280
+ }
281
+ }
282
+
283
+ impl < F : Copy > BlackBoxFuncCall < F > {
249
284
pub fn get_inputs_vec ( & self ) -> Vec < FunctionInput < F > > {
250
285
match self {
251
286
BlackBoxFuncCall :: AES128Encrypt { inputs, .. }
@@ -333,39 +368,6 @@ impl<F: Copy + AcirField> BlackBoxFuncCall<F> {
333
368
}
334
369
}
335
370
336
- pub fn get_outputs_vec ( & self ) -> Vec < Witness > {
337
- match self {
338
- BlackBoxFuncCall :: Blake2s { outputs, .. }
339
- | BlackBoxFuncCall :: Blake3 { outputs, .. } => outputs. to_vec ( ) ,
340
-
341
- BlackBoxFuncCall :: Keccakf1600 { outputs, .. } => outputs. to_vec ( ) ,
342
-
343
- BlackBoxFuncCall :: Sha256Compression { outputs, .. } => outputs. to_vec ( ) ,
344
-
345
- BlackBoxFuncCall :: AES128Encrypt { outputs, .. }
346
- | BlackBoxFuncCall :: Poseidon2Permutation { outputs, .. } => outputs. to_vec ( ) ,
347
-
348
- BlackBoxFuncCall :: AND { output, .. }
349
- | BlackBoxFuncCall :: XOR { output, .. }
350
- | BlackBoxFuncCall :: EcdsaSecp256k1 { output, .. }
351
- | BlackBoxFuncCall :: EcdsaSecp256r1 { output, .. } => vec ! [ * output] ,
352
- BlackBoxFuncCall :: MultiScalarMul { outputs, .. }
353
- | BlackBoxFuncCall :: EmbeddedCurveAdd { outputs, .. } => {
354
- vec ! [ outputs. 0 , outputs. 1 , outputs. 2 ]
355
- }
356
- BlackBoxFuncCall :: RANGE { .. }
357
- | BlackBoxFuncCall :: RecursiveAggregation { .. }
358
- | BlackBoxFuncCall :: BigIntFromLeBytes { .. }
359
- | BlackBoxFuncCall :: BigIntAdd { .. }
360
- | BlackBoxFuncCall :: BigIntSub { .. }
361
- | BlackBoxFuncCall :: BigIntMul { .. }
362
- | BlackBoxFuncCall :: BigIntDiv { .. } => {
363
- vec ! [ ]
364
- }
365
- BlackBoxFuncCall :: BigIntToLeBytes { outputs, .. } => outputs. to_vec ( ) ,
366
- }
367
- }
368
-
369
371
pub fn get_input_witnesses ( & self ) -> BTreeSet < Witness > {
370
372
let mut result = BTreeSet :: new ( ) ;
371
373
for input in self . get_inputs_vec ( ) {
@@ -429,7 +431,7 @@ fn get_outputs_string(outputs: &[Witness]) -> String {
429
431
}
430
432
}
431
433
432
- impl < F : std:: fmt:: Display + Copy + AcirField > std:: fmt:: Display for BlackBoxFuncCall < F > {
434
+ impl < F : std:: fmt:: Display + Copy > std:: fmt:: Display for BlackBoxFuncCall < F > {
433
435
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
434
436
let uppercase_name = self . name ( ) . to_uppercase ( ) ;
435
437
write ! ( f, "BLACKBOX::{uppercase_name} " ) ?;
@@ -454,7 +456,7 @@ impl<F: std::fmt::Display + Copy + AcirField> std::fmt::Display for BlackBoxFunc
454
456
}
455
457
}
456
458
457
- impl < F : std:: fmt:: Display + Copy + AcirField > std:: fmt:: Debug for BlackBoxFuncCall < F > {
459
+ impl < F : std:: fmt:: Display + Copy > std:: fmt:: Debug for BlackBoxFuncCall < F > {
458
460
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
459
461
std:: fmt:: Display :: fmt ( self , f)
460
462
}
0 commit comments