Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid testing equality between unit values in acir_gen test #849

Merged
merged 3 commits into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions crates/noirc_evaluator/src/ssa/acir_gen/operations/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn evaluate_permutation(
evaluator: &mut Evaluator,
) -> Vec<Witness> {
let (w, b) = permutation_layer(in_expr, evaluator);
// we contrain the network output to out_expr
// we constrain the network output to out_expr
for (b, o) in b.iter().zip(out_expr) {
evaluator.opcodes.push(AcirOpcode::Arithmetic(subtract(b, FieldElement::one(), o)));
}
Expand All @@ -45,7 +45,7 @@ pub fn permutation_layer(
conf.push(evaluator.add_witness_to_cs());
}
// compute expressions after the input switches
// If inputs are a1,a2, and the switch value is c, then we compute expresions b1,b2 where
// If inputs are a1,a2, and the switch value is c, then we compute expressions b1,b2 where
// b1 = a1+q, b2 = a2-q, q = c(a2-a1)
let mut in_sub1 = Vec::new();
let mut in_sub2 = Vec::new();
Expand All @@ -68,7 +68,7 @@ pub fn permutation_layer(
// compute results for the sub networks
let (w1, b1) = permutation_layer(&in_sub1, evaluator);
let (w2, b2) = permutation_layer(&in_sub2, evaluator);
// apply the output swithces
// apply the output switches
for i in 0..(n - 1) / 2 {
let c = evaluator.add_witness_to_cs();
conf.push(c);
Expand Down Expand Up @@ -152,7 +152,7 @@ mod test {
for _i in 0..w.len() {
c.push(rng.next_u32() % 2 != 0);
}
// intialise bits
// initialize bits
for i in 0..w.len() {
solved_witness.insert(w[i], FieldElement::from(c[i] as i128));
}
Expand All @@ -166,7 +166,9 @@ mod test {
b_val.push(solved_witness[&b_wit[i]]);
}
// ensure the outputs are a permutation of the inputs
assert_eq!(a_val.sort(), b_val.sort());
a_val.sort();
b_val.sort();
assert_eq!(a_val, b_val);
}
}
}