Refactor to handle changes to ConstraintSystem API (no more Variable associated type, one is now static method).

This commit is contained in:
Sean Bowe
2018-02-16 08:45:18 -07:00
parent 814cfef769
commit 2f95a9094a
9 changed files with 199 additions and 171 deletions
+6 -6
View File
@@ -10,12 +10,12 @@ use bellman::{
};
use super::lookup::*;
pub fn pedersen_hash<E: JubjubEngine, CS, Var: Copy>(
pub fn pedersen_hash<E: JubjubEngine, CS>(
mut cs: CS,
bits: &[Boolean<Var>],
bits: &[Boolean],
params: &E::Params
) -> Result<EdwardsPoint<E, Var>, SynthesisError>
where CS: ConstraintSystem<E, Variable=Var>
) -> Result<EdwardsPoint<E>, SynthesisError>
where CS: ConstraintSystem<E>
{
// Unnecessary if forced personalization is introduced
assert!(bits.len() > 0);
@@ -116,7 +116,7 @@ mod test {
let input: Vec<bool> = (0..(Fr::NUM_BITS * 2)).map(|_| rng.gen()).collect();
let input_bools: Vec<Boolean<_>> = input.iter().enumerate().map(|(i, b)| {
let input_bools: Vec<Boolean> = input.iter().enumerate().map(|(i, b)| {
Boolean::from(
AllocatedBit::alloc(cs.namespace(|| format!("input {}", i)), Some(*b)).unwrap()
)
@@ -143,7 +143,7 @@ mod test {
let mut cs = TestConstraintSystem::<Bls12>::new();
let input_bools: Vec<Boolean<_>> = input.iter().enumerate().map(|(i, b)| {
let input_bools: Vec<Boolean> = input.iter().enumerate().map(|(i, b)| {
Boolean::from(
AllocatedBit::alloc(cs.namespace(|| format!("input {}", i)), Some(*b)).unwrap()
)