Преглед изворни кода

Return VerificationFailure rather than assert!()ing if the witness doesn't satisfy the statements

Ian Goldberg пре 3 месеци
родитељ
комит
76c318c74f
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      sigma_compiler_core/src/transform.rs

+ 6 - 1
sigma_compiler_core/src/transform.rs

@@ -261,7 +261,12 @@ pub fn apply_substitutions(
                         return Err(Error::new(id.span(), "variable substituted multiple times"));
                     }
                     codegen.prove_append(quote! {
-                        assert!(#id == #right_tokens);
+                        // It's OK to have a test that observably fails
+                        // for illegal inputs (but is constant time for
+                        // valid inputs)
+                        if #id != #right_tokens {
+                            return Err(SigmaError::VerificationFailure);
+                        }
                     });
                     let right = paren_if_needed(*right);
                     subs.push_back((id, right, used_priv_scalars));