Bläddra i källkod

Use sigma_compiler_prover or sigma_compiler_verifier as appropriate

If the Cli version of the macro is invoked (only output the client
code), use sigma_compiler_prover for the client proof and
sigma_compiler_verifier for the issuer proof.

If the Iss version of the macro is invoked (only output the issuer
code), use sigma_compiler_verifier for the client proof and
sigma_compiler_prover for the issuer proof.
Ian Goldberg 2 månader sedan
förälder
incheckning
5033b41669
1 ändrade filer med 18 tillägg och 2 borttagningar
  1. 18 2
      cmzcred_derive/src/lib.rs

+ 18 - 2
cmzcred_derive/src/lib.rs

@@ -1766,9 +1766,17 @@ fn protocol_macro(
         .for_each(|expr| statement_scoper.visit_expr_mut(expr));
 
     // The client's zero-knowledge proof
+    let cli_sigma_compiler_macro = if emit_client && emit_issuer {
+        quote! { sigma_compiler }
+    } else if emit_client {
+        quote! { sigma_compiler_prover }
+    } else {
+        quote! { sigma_compiler_verifier }
+    };
+
     let cli_proof = {
         quote! {
-            sigma_compiler! { client_proof<Point>,
+            #cli_sigma_compiler_macro! { client_proof<Point>,
                 (#(rand #cli_proof_rand_scalars,)*
                  #(#cli_proof_priv_scalars,)*
                  #(pub #cli_proof_pub_scalars,)*),
@@ -1783,9 +1791,17 @@ fn protocol_macro(
     println!("cli_proof = {cli_proof}");
 
     // The issuer's zero-knowledge proof
+    let iss_sigma_compiler_macro = if emit_client && emit_issuer {
+        quote! { sigma_compiler }
+    } else if emit_issuer {
+        quote! { sigma_compiler_prover }
+    } else {
+        quote! { sigma_compiler_verifier }
+    };
+
     let iss_proof = {
         quote! {
-            sigma_compiler! { issuer_proof<Point>,
+            #iss_sigma_compiler_macro! { issuer_proof<Point>,
                 (#(rand #iss_proof_rand_scalars,)*
                  #(#iss_proof_priv_scalars,)*
                  #(pub #iss_proof_pub_scalars,)*),