mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
Index into q_evals consistently between prover and verifier.
This commit is contained in:
parent
869aba389a
commit
d7132404ba
3 changed files with 10 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use core::cmp::max;
|
||||
use core::ops::{Add, Mul};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use super::Error;
|
||||
use crate::arithmetic::Field;
|
||||
|
|
@ -160,7 +160,7 @@ pub struct MetaCircuit<F> {
|
|||
pub(crate) fixed_queries: Vec<(FixedWire, Rotation)>,
|
||||
|
||||
// Mapping from a witness vector rotation to the index in the point vector.
|
||||
pub(crate) rotations: HashMap<Rotation, PointIndex>,
|
||||
pub(crate) rotations: BTreeMap<Rotation, PointIndex>,
|
||||
|
||||
// Vector of permutation arguments, where each corresponds to a set of wires
|
||||
// that are involved in a permutation argument. As an example, we could have
|
||||
|
|
@ -174,7 +174,7 @@ pub struct MetaCircuit<F> {
|
|||
|
||||
impl<F: Field> Default for MetaCircuit<F> {
|
||||
fn default() -> MetaCircuit<F> {
|
||||
let mut rotations = HashMap::new();
|
||||
let mut rotations = BTreeMap::new();
|
||||
rotations.insert(Rotation::default(), PointIndex(0));
|
||||
|
||||
MetaCircuit {
|
||||
|
|
@ -195,9 +195,9 @@ impl<F: Field> MetaCircuit<F> {
|
|||
pub fn permutation(&mut self, wires: &[AdviceWire]) -> usize {
|
||||
let index = self.permutations.len();
|
||||
if index == 0 {
|
||||
// no permutations
|
||||
let point_idx = self.rotations.len();
|
||||
self.rotations.insert(Rotation(-1), PointIndex(point_idx));
|
||||
let at = Rotation(-1);
|
||||
let len = self.rotations.len();
|
||||
self.rotations.entry(at).or_insert(PointIndex(len));
|
||||
}
|
||||
self.permutations.push(wires.to_vec());
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::arithmetic::{best_fft, parallelize, Field, Group};
|
|||
|
||||
/// Describes a relative location in the evaluation domain; applying a rotation
|
||||
/// by i will rotate the vector in the evaluation domain by i.
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct Rotation(pub i32);
|
||||
|
||||
impl Default for Rotation {
|
||||
|
|
|
|||
|
|
@ -562,13 +562,11 @@ impl<C: CurveAffine> Proof<C> {
|
|||
|
||||
let x_6: C::Scalar = get_challenge_scalar(Challenge(transcript.squeeze().get_lower_128()));
|
||||
|
||||
let mut q_evals = vec![];
|
||||
let mut q_evals = vec![C::Scalar::zero(); meta.rotations.len()];
|
||||
|
||||
for (_, &point_index) in meta.rotations.iter() {
|
||||
q_evals.push(eval_polynomial(
|
||||
&q_polys[point_index.0].as_ref().unwrap(),
|
||||
x_6,
|
||||
));
|
||||
q_evals[point_index.0] =
|
||||
eval_polynomial(&q_polys[point_index.0].as_ref().unwrap(), x_6);
|
||||
}
|
||||
|
||||
for eval in q_evals.iter() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue