@@ -8,14 +8,21 @@ const BACKEND_IDENTIFIER: &str = "acvm-backend-barretenberg";
8
8
9
9
pub fn preprocess_program < B : ProofSystemCompiler > (
10
10
backend : & B ,
11
+ include_keys : bool ,
11
12
common_reference_string : & [ u8 ] ,
12
13
compiled_program : CompiledProgram ,
13
14
) -> Result < PreprocessedProgram , B :: Error > {
14
15
// TODO: currently `compiled_program`'s bytecode is already optimized for the backend.
15
16
// In future we'll need to apply those optimizations here.
16
17
let optimized_bytecode = compiled_program. circuit ;
17
- let ( proving_key, verification_key) =
18
- backend. preprocess ( common_reference_string, & optimized_bytecode) ?;
18
+
19
+ let ( proving_key, verification_key) = if include_keys {
20
+ let ( proving_key, verification_key) =
21
+ backend. preprocess ( common_reference_string, & optimized_bytecode) ?;
22
+ ( Some ( proving_key) , Some ( verification_key) )
23
+ } else {
24
+ ( None , None )
25
+ } ;
19
26
20
27
Ok ( PreprocessedProgram {
21
28
backend : String :: from ( BACKEND_IDENTIFIER ) ,
@@ -28,14 +35,20 @@ pub fn preprocess_program<B: ProofSystemCompiler>(
28
35
29
36
pub fn preprocess_contract_function < B : ProofSystemCompiler > (
30
37
backend : & B ,
38
+ include_keys : bool ,
31
39
common_reference_string : & [ u8 ] ,
32
40
func : ContractFunction ,
33
41
) -> Result < PreprocessedContractFunction , B :: Error > {
34
42
// TODO: currently `func`'s bytecode is already optimized for the backend.
35
43
// In future we'll need to apply those optimizations here.
36
44
let optimized_bytecode = func. bytecode ;
37
- let ( proving_key, verification_key) =
38
- backend. preprocess ( common_reference_string, & optimized_bytecode) ?;
45
+ let ( proving_key, verification_key) = if include_keys {
46
+ let ( proving_key, verification_key) =
47
+ backend. preprocess ( common_reference_string, & optimized_bytecode) ?;
48
+ ( Some ( proving_key) , Some ( verification_key) )
49
+ } else {
50
+ ( None , None )
51
+ } ;
39
52
40
53
Ok ( PreprocessedContractFunction {
41
54
name : func. name ,
0 commit comments