adds working phase2 for circom

This commit is contained in:
Kobi Gurkan 2019-09-22 15:35:29 +03:00
parent e234102ad7
commit 350ccc6ee9
2 changed files with 6 additions and 6 deletions

@ -118,13 +118,13 @@ impl<'a, E: Engine> Circuit<E> for CircomCircuit<'a> {
println!("num public inputs: {}", num_public_inputs); println!("num public inputs: {}", num_public_inputs);
for i in 1..circuit_json.num_variables { for i in 1..circuit_json.num_variables {
if i < num_public_inputs { if i < num_public_inputs {
println!("allocating public input {}", i); //println!("allocating public input {}", i);
cs.alloc_input(|| format!("variable {}", i), || { cs.alloc_input(|| format!("variable {}", i), || {
println!("variable {}: {}", i, &self.witness[i]); println!("variable {}: {}", i, &self.witness[i]);
Ok(E::Fr::from_str(&self.witness[i]).unwrap()) Ok(E::Fr::from_str(&self.witness[i]).unwrap())
}); });
} else { } else {
println!("allocating private input {}", i); //println!("allocating private input {}", i);
cs.alloc(|| format!("variable {}", i), || { cs.alloc(|| format!("variable {}", i), || {
println!("variable {}: {}", i, &self.witness[i]); println!("variable {}: {}", i, &self.witness[i]);
Ok(E::Fr::from_str(&self.witness[i]).unwrap()) Ok(E::Fr::from_str(&self.witness[i]).unwrap())
@ -137,7 +137,7 @@ impl<'a, E: Engine> Circuit<E> for CircomCircuit<'a> {
let mut lcs = vec![]; let mut lcs = vec![];
for lc_description in constraint { for lc_description in constraint {
let mut lc = LinearCombination::<E>::zero(); let mut lc = LinearCombination::<E>::zero();
println!("lc_description: {:?}, i: {}, len: {}", lc_description, i, constraint.len()); //println!("lc_description: {:?}, i: {}, len: {}", lc_description, i, constraint.len());
for (var_index_str, coefficient_str) in lc_description { for (var_index_str, coefficient_str) in lc_description {
//println!("var_index_str: {}, coefficient_str: {}", var_index_str, coefficient_str); //println!("var_index_str: {}, coefficient_str: {}", var_index_str, coefficient_str);
let var_index_num: usize = var_index_str.parse().unwrap(); let var_index_num: usize = var_index_str.parse().unwrap();
@ -183,7 +183,7 @@ fn main() {
println!("Creating parameters..."); println!("Creating parameters...");
let should_filter_points_at_infinity = true; let should_filter_points_at_infinity = false;
let file_name = "circuit.json"; let file_name = "circuit.json";

@ -511,8 +511,8 @@ impl MPCParameters {
let alpha_coeffs_g1 = Arc::new(alpha_coeffs_g1); let alpha_coeffs_g1 = Arc::new(alpha_coeffs_g1);
let beta_coeffs_g1 = Arc::new(beta_coeffs_g1); let beta_coeffs_g1 = Arc::new(beta_coeffs_g1);
let mut h = Vec::with_capacity(m-1); let mut h = Vec::with_capacity(m);
for i in 0..(m-1) { for i in 0..m {
h.push(read_g1(f)?); h.push(read_g1(f)?);
} }