File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
wasm/src/programs/verifying_key Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,14 @@ impl VerifyingKey {
83
83
pub fn to_string ( & self ) -> String {
84
84
self . 0 . to_string ( )
85
85
}
86
+
87
+ /// Get the number of constraints associated with the circuit
88
+ ///
89
+ /// @returns {number} The number of constraints
90
+ #[ wasm_bindgen( js_name = "numConstraints" ) ]
91
+ pub fn num_constraints ( & self ) -> usize {
92
+ self . 0 . circuit_info . num_constraints
93
+ }
86
94
}
87
95
88
96
impl Deref for VerifyingKey {
@@ -238,4 +246,13 @@ mod tests {
238
246
239
247
assert_eq ! ( transfer_public_verifying_key_checksum, checksum) ;
240
248
}
249
+
250
+ #[ wasm_bindgen_test]
251
+ async fn test_num_constraints ( ) {
252
+ let transfer_public_verifier_bytes =
253
+ crate :: types:: native:: parameters:: TransferPublicVerifier :: load_bytes ( ) . unwrap ( ) ;
254
+ let transfer_public_verifier = VerifyingKey :: from_bytes ( & transfer_public_verifier_bytes) . unwrap ( ) ;
255
+ let num_constraints = transfer_public_verifier. num_constraints ( ) ;
256
+ assert_eq ! ( num_constraints, 12326 ) ;
257
+ }
241
258
}
You can’t perform that action at this time.
0 commit comments