mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
permutation: Clean up opening chains
This commit is contained in:
parent
dd3d1dd68b
commit
3d6afd7b8e
2 changed files with 30 additions and 37 deletions
|
|
@ -348,18 +348,28 @@ impl<C: CurveAffine> Evaluated<C> {
|
||||||
let x_inv = pk.vk.domain.rotate_omega(*x, Rotation(-1));
|
let x_inv = pk.vk.domain.rotate_omega(*x, Rotation(-1));
|
||||||
|
|
||||||
iter::empty()
|
iter::empty()
|
||||||
// Open permutation product commitments at x
|
// Open permutation product commitments at x and \omega^{-1} x
|
||||||
.chain(
|
.chain(
|
||||||
self.constructed
|
self.constructed
|
||||||
.permutation_product_polys
|
.permutation_product_polys
|
||||||
.iter()
|
.iter()
|
||||||
.zip(self.constructed.permutation_product_blinds.iter())
|
.zip(self.constructed.permutation_product_blinds.iter())
|
||||||
.zip(self.permutation_product_evals.iter())
|
.zip(self.permutation_product_evals.iter())
|
||||||
.map(move |((poly, blind), eval)| ProverQuery {
|
.zip(self.permutation_product_inv_evals.iter())
|
||||||
point: *x,
|
.flat_map(move |(((poly, blind), eval), inv_eval)| {
|
||||||
poly,
|
iter::empty()
|
||||||
blind: *blind,
|
.chain(Some(ProverQuery {
|
||||||
eval: *eval,
|
point: *x,
|
||||||
|
poly,
|
||||||
|
blind: *blind,
|
||||||
|
eval: *eval,
|
||||||
|
}))
|
||||||
|
.chain(Some(ProverQuery {
|
||||||
|
point: x_inv,
|
||||||
|
poly,
|
||||||
|
blind: *blind,
|
||||||
|
eval: *inv_eval,
|
||||||
|
}))
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
// Open permutation polynomial commitments at x
|
// Open permutation polynomial commitments at x
|
||||||
|
|
@ -369,20 +379,6 @@ impl<C: CurveAffine> Evaluated<C> {
|
||||||
.zip(self.permutation_evals.iter())
|
.zip(self.permutation_evals.iter())
|
||||||
.flat_map(move |(permutation, evals)| permutation.open(evals, x)),
|
.flat_map(move |(permutation, evals)| permutation.open(evals, x)),
|
||||||
)
|
)
|
||||||
// Open permutation product commitments at \omega^{-1} x
|
|
||||||
.chain(
|
|
||||||
self.constructed
|
|
||||||
.permutation_product_polys
|
|
||||||
.iter()
|
|
||||||
.zip(self.constructed.permutation_product_blinds.iter())
|
|
||||||
.zip(self.permutation_product_inv_evals.iter())
|
|
||||||
.map(move |((poly, blind), eval)| ProverQuery {
|
|
||||||
point: x_inv,
|
|
||||||
poly,
|
|
||||||
blind: *blind,
|
|
||||||
eval: *eval,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn build(self) -> Proof<C> {
|
pub(crate) fn build(self) -> Proof<C> {
|
||||||
|
|
|
||||||
|
|
@ -117,16 +117,25 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
let x_inv = vk.domain.rotate_omega(*x, Rotation(-1));
|
let x_inv = vk.domain.rotate_omega(*x, Rotation(-1));
|
||||||
|
|
||||||
iter::empty()
|
iter::empty()
|
||||||
// Open permutation product commitments at x
|
// Open permutation product commitments at x and \omega^{-1} x
|
||||||
.chain(
|
.chain(
|
||||||
self.permutation_product_commitments
|
self.permutation_product_commitments
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.zip(self.permutation_product_evals.iter())
|
.zip(self.permutation_product_evals.iter())
|
||||||
.map(move |((idx, _), &eval)| VerifierQuery {
|
.zip(self.permutation_product_inv_evals.iter())
|
||||||
point: *x,
|
.flat_map(move |(((idx, _), &eval), &inv_eval)| {
|
||||||
commitment: &self.permutation_product_commitments[idx],
|
iter::empty()
|
||||||
eval,
|
.chain(Some(VerifierQuery {
|
||||||
|
point: *x,
|
||||||
|
commitment: &self.permutation_product_commitments[idx],
|
||||||
|
eval,
|
||||||
|
}))
|
||||||
|
.chain(Some(VerifierQuery {
|
||||||
|
point: x_inv,
|
||||||
|
commitment: &self.permutation_product_commitments[idx],
|
||||||
|
eval: inv_eval,
|
||||||
|
}))
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
// Open permutation commitments for each permutation argument at x
|
// Open permutation commitments for each permutation argument at x
|
||||||
|
|
@ -142,17 +151,5 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
})
|
})
|
||||||
.flatten(),
|
.flatten(),
|
||||||
)
|
)
|
||||||
// Open permutation product commitments at \omega^{-1} x
|
|
||||||
.chain(
|
|
||||||
self.permutation_product_commitments
|
|
||||||
.iter()
|
|
||||||
.enumerate()
|
|
||||||
.zip(self.permutation_product_inv_evals.iter())
|
|
||||||
.map(move |((idx, _), &eval)| VerifierQuery {
|
|
||||||
point: x_inv,
|
|
||||||
commitment: &self.permutation_product_commitments[idx],
|
|
||||||
eval,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue