@@ -6,20 +6,25 @@ use crate::{AcirField, BlackBoxFunc};
6
6
use serde:: { Deserialize , Deserializer , Serialize , Serializer } ;
7
7
use thiserror:: Error ;
8
8
9
- // Note: Some functions will not use all of the witness
10
- // So we need to supply how many bits of the witness is needed
11
-
9
+ /// Enumeration for black box function inputs
12
10
#[ derive( Clone , Copy , Debug , PartialEq , Eq , Serialize , Deserialize , Hash ) ]
13
11
#[ cfg_attr( feature = "arb" , derive( proptest_derive:: Arbitrary ) ) ]
14
12
pub enum ConstantOrWitnessEnum < F > {
13
+ /// A constant field element
15
14
Constant ( F ) ,
15
+ /// A witness element, representing dynamic inputs
16
16
Witness ( Witness ) ,
17
17
}
18
18
19
+ /// Input to a black box call
19
20
#[ derive( Clone , Copy , Debug , PartialEq , Eq , Serialize , Deserialize , Hash ) ]
20
21
#[ cfg_attr( feature = "arb" , derive( proptest_derive:: Arbitrary ) ) ]
21
22
pub struct FunctionInput < F > {
23
+ /// The actual input value
22
24
input : ConstantOrWitnessEnum < F > ,
25
+ /// A constant representing the bit size of the input value
26
+ /// Some functions will not use all of the witness
27
+ /// So we need to supply how many bits of the witness is needed
23
28
num_bits : u32 ,
24
29
}
25
30
@@ -81,6 +86,11 @@ impl<F: std::fmt::Display> std::fmt::Display for FunctionInput<F> {
81
86
}
82
87
}
83
88
89
+ /// These opcodes represent a specialized computation.
90
+ /// Even if any computation can be done using only assert-zero opcodes,
91
+ /// it is not always efficient.
92
+ /// Some proving systems, can implement several computations more efficiently using
93
+ /// techniques such as custom gates and lookup tables.
84
94
#[ derive( Clone , PartialEq , Eq , Serialize , Deserialize , Hash ) ]
85
95
pub enum BlackBoxFuncCall < F > {
86
96
/// Ciphers (encrypts) the provided plaintext using AES128 in CBC mode,
0 commit comments