mirror of https://github.com/zcash/halo2.git
Minor cleanups
This commit is contained in:
parent
965362c1f5
commit
503939db05
|
@ -213,14 +213,14 @@ fn test_proving() {
|
|||
Variable(self.config.c, index),
|
||||
))
|
||||
}
|
||||
fn copy(&mut self, a: Variable, b: Variable) -> Result<(), Error> {
|
||||
let left_wire = match a.0 {
|
||||
fn copy(&mut self, left: Variable, right: Variable) -> Result<(), Error> {
|
||||
let left_wire = match left.0 {
|
||||
x if x == self.config.a => 0,
|
||||
x if x == self.config.b => 1,
|
||||
x if x == self.config.c => 2,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let right_wire = match b.0 {
|
||||
let right_wire = match right.0 {
|
||||
x if x == self.config.a => 0,
|
||||
x if x == self.config.b => 1,
|
||||
x if x == self.config.c => 2,
|
||||
|
@ -228,7 +228,7 @@ fn test_proving() {
|
|||
};
|
||||
|
||||
self.cs
|
||||
.copy(self.config.perm, left_wire, a.1, right_wire, b.1)
|
||||
.copy(self.config.perm, left_wire, left.1, right_wire, right.1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,8 +156,8 @@ impl<C: CurveAffine> Proof<C> {
|
|||
.iter_mut()
|
||||
.zip(permuted_wire_values.iter())
|
||||
{
|
||||
*tmp_advice_value += &(x_0 * permuted_advice_value);
|
||||
*tmp_advice_value += &x_1;
|
||||
*tmp_advice_value += &(x_0 * permuted_advice_value); // p_j(\omega^i) + \beta s_j(\omega^i)
|
||||
*tmp_advice_value += &x_1; // p_j(\omega^i) + \beta s_j(\omega^i) + \gamma
|
||||
}
|
||||
modified_advice.push(tmp_advice_values);
|
||||
}
|
||||
|
@ -175,15 +175,13 @@ impl<C: CurveAffine> Proof<C> {
|
|||
// For each row i, we compute
|
||||
// p_j(\omega^i) + \delta^j \omega^i \beta + \gamma
|
||||
// for the jth wire of the permutation
|
||||
for (advice_value, modified_advice) in witness.advice[wire.0]
|
||||
for (tmp_advice_value, modified_advice) in witness.advice[wire.0]
|
||||
.iter_mut()
|
||||
.zip(modified_advice.iter_mut())
|
||||
{
|
||||
let mut tmp = deltaomega; // \delta^j \omega^i
|
||||
tmp *= &x_0; // \delta^j \omega^i \beta
|
||||
tmp += &x_1; // \delta^j \omega^i \beta + \gamma
|
||||
tmp += advice_value; // p_j(\omega^i) + \delta^j \omega^i \beta + \gamma
|
||||
*modified_advice *= &tmp;
|
||||
*tmp_advice_value += &(deltaomega * &x_0); // p_j(\omega^i) + \delta^j \omega^i \beta
|
||||
*tmp_advice_value += &x_1; // p_j(\omega^i) + \delta^j \omega^i \beta + \gamma
|
||||
*modified_advice *= tmp_advice_value;
|
||||
deltaomega *= &domain.get_omega();
|
||||
}
|
||||
deltaomega *= &C::Scalar::DELTA;
|
||||
|
|
|
@ -157,7 +157,7 @@ impl<C: CurveAffine> SRS<C> {
|
|||
// the permutation arguments.
|
||||
for permutation in &meta.permutations {
|
||||
let mut wires = vec![];
|
||||
for (i, _) in permutation.iter().enumerate() {
|
||||
for i in 0..permutation.len() {
|
||||
// Computes [(i, 0), (i, 1), ..., (i, n - 1)]
|
||||
wires.push((0..params.n).map(|j| (i, j as usize)).collect());
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ impl<C: CurveAffine> SRS<C> {
|
|||
let mut inner_permutations = vec![];
|
||||
let mut polys = vec![];
|
||||
let mut cosets = vec![];
|
||||
for (i, _) in permutation.iter().enumerate() {
|
||||
for i in 0..permutation.len() {
|
||||
// Computes the permutation polynomial based on the permutation
|
||||
// description in the assembly.
|
||||
let permutation_poly: Vec<_> = (0..params.n as usize)
|
||||
|
|
Loading…
Reference in New Issue