diff --git a/src/plonk/lookup/prover.rs b/src/plonk/lookup/prover.rs index e707a02..634845f 100644 --- a/src/plonk/lookup/prover.rs +++ b/src/plonk/lookup/prover.rs @@ -97,16 +97,22 @@ impl Argument { .map(|expression| { expression.evaluate( &|index| { - let column_index = pk.vk.cs.fixed_queries[index].0.index(); - fixed_values[column_index].clone() + let query = pk.vk.cs.fixed_queries[index]; + let column_index = query.0.index(); + let rotation = query.1; + fixed_values[column_index].clone().rotate(rotation) }, &|index| { - let column_index = pk.vk.cs.advice_queries[index].0.index(); - advice_values[column_index].clone() + let query = pk.vk.cs.advice_queries[index]; + let column_index = query.0.index(); + let rotation = query.1; + advice_values[column_index].clone().rotate(rotation) }, &|index| { - let column_index = pk.vk.cs.instance_queries[index].0.index(); - instance_values[column_index].clone() + let query = pk.vk.cs.instance_queries[index]; + let column_index = query.0.index(); + let rotation = query.1; + instance_values[column_index].clone().rotate(rotation) }, &|a, b| a + &b, &|a, b| { diff --git a/src/poly.rs b/src/poly.rs index 5ac1462..e39ba9d 100644 --- a/src/poly.rs +++ b/src/poly.rs @@ -187,6 +187,22 @@ impl<'a, F: Field> Mul<&'a Polynomial> } } +impl<'a, F: Field> Polynomial { + /// Rotates the values in a Lagrange basis polynomial by `Rotation` + pub fn rotate(&self, rotation: Rotation) -> Polynomial { + let mut values = self.values.clone(); + if rotation.0 < 0 { + values.rotate_right((-rotation.0) as usize); + } else { + values.rotate_left(rotation.0 as usize); + } + Polynomial { + values, + _marker: PhantomData, + } + } +} + impl<'a, F: Field, B: Basis> Mul for Polynomial { type Output = Polynomial;