Bladeren bron

enforce field with constants and params

ada 5 jaren geleden
bovenliggende
commit
88270e6b58
2 gewijzigde bestanden met toevoegingen van 8 en 2 verwijderingen
  1. 1 1
      lisp/lisp.rs
  2. 7 1
      lisp/types.rs

+ 1 - 1
lisp/lisp.rs

@@ -549,7 +549,7 @@ pub fn prove(_ast: MalVal, env: Env) -> MalRet {
     let allocs_const = get_allocations(&env, "AllocationsConst");
     let allocs_const = get_allocations(&env, "AllocationsConst");
 
 
     let circuit = LispCircuit {
     let circuit = LispCircuit {
-        params:  allocs.as_ref().clone(),
+        params:  allocs_const.as_ref().clone(),
         allocs: allocs.as_ref().clone(),
         allocs: allocs.as_ref().clone(),
         alloc_inputs: allocs_input.as_ref().clone(),
         alloc_inputs: allocs_input.as_ref().clone(),
         constraints: enforce_allocs,
         constraints: enforce_allocs,

+ 7 - 1
lisp/types.rs

@@ -86,7 +86,13 @@ impl Circuit<bls12_381::Scalar> for LispCircuit {
                     left = left + (coeff, val_b);
                     left = left + (coeff, val_b);
                 } else if a == "scalar::one::neg" {
                 } else if a == "scalar::one::neg" {
                     left = left + (coeff.neg(), val_b);
                     left = left + (coeff.neg(), val_b);
-                } 
+                } else {
+                  if let Some(value) = self.params.get(a) {
+                    if let MalVal::ZKScalar(val) = value {
+                      left = left + (*val, val_b);
+                    }
+                  }
+                }
             }
             }
 
 
             for values in alloc_value.right.iter() {
             for values in alloc_value.right.iter() {