From b361559d5047e0799680b7afa811ac8f5bf93b2e Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Wed, 12 May 2021 22:21:36 +0800 Subject: [PATCH 1/2] [MockProver] Handle query rotations in lookups --- src/dev.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/dev.rs b/src/dev.rs index a2cd62d6..cd1aad9f 100644 --- a/src/dev.rs +++ b/src/dev.rs @@ -337,16 +337,25 @@ impl MockProver { expression.evaluate( &|scalar| scalar, &|index| { - let column_index = self.cs.fixed_queries[index].0.index(); - self.fixed[column_index][row as usize] + let query = self.cs.fixed_queries[index]; + let column_index = query.0.index(); + let rotation = query.1 .0; + self.fixed[column_index] + [(row as i32 + n + rotation) as usize % n as usize] }, &|index| { - let column_index = self.cs.advice_queries[index].0.index(); - self.advice[column_index][row as usize] + let query = self.cs.advice_queries[index]; + let column_index = query.0.index(); + let rotation = query.1 .0; + self.advice[column_index] + [(row as i32 + n + rotation) as usize % n as usize] }, &|index| { - let column_index = self.cs.instance_queries[index].0.index(); - self.instance[column_index][row as usize] + let query = self.cs.instance_queries[index]; + let column_index = query.0.index(); + let rotation = query.1 .0; + self.instance[column_index] + [(row as i32 + n + rotation) as usize % n as usize] }, &|a, b| a + b, &|a, b| a * b, From de883a4b8b5ae9620af208676f66a9352e263c56 Mon Sep 17 00:00:00 2001 From: str4d Date: Tue, 18 May 2021 15:26:23 +0100 Subject: [PATCH 2/2] Formatting fixes --- src/dev.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dev.rs b/src/dev.rs index cd1aad9f..6631c9d7 100644 --- a/src/dev.rs +++ b/src/dev.rs @@ -339,21 +339,21 @@ impl MockProver { &|index| { let query = self.cs.fixed_queries[index]; let column_index = query.0.index(); - let rotation = query.1 .0; + let rotation = query.1.0; self.fixed[column_index] [(row as i32 + n + rotation) as usize % n as usize] }, &|index| { let query = self.cs.advice_queries[index]; let column_index = query.0.index(); - let rotation = query.1 .0; + let rotation = query.1.0; self.advice[column_index] [(row as i32 + n + rotation) as usize % n as usize] }, &|index| { let query = self.cs.instance_queries[index]; let column_index = query.0.index(); - let rotation = query.1 .0; + let rotation = query.1.0; self.instance[column_index] [(row as i32 + n + rotation) as usize % n as usize] },