From 4c9362c5045be801d56bc0062ae8bb699577cc72 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 9 Apr 2021 13:23:07 +1200 Subject: [PATCH 1/2] MockProver: Look up permutations from correct column types --- src/dev.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dev.rs b/src/dev.rs index f89a733b..a2cd62d6 100644 --- a/src/dev.rs +++ b/src/dev.rs @@ -382,7 +382,11 @@ impl MockProver { let original = self.cs.permutations[perm_index] .get_columns() .iter() - .map(|c| self.advice[c.index()].clone()) + .map(|c| match c.column_type() { + Any::Advice => self.advice[c.index()].clone(), + Any::Fixed => self.fixed[c.index()].clone(), + Any::Instance => self.instance[c.index()].clone(), + }) .collect::>(); // Iterate over each column of the permutation From 0df5bc4b4505dd01cfbf46e46d0860c5cd775a56 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 9 Apr 2021 14:30:53 +1200 Subject: [PATCH 2/2] dev: Track region offset correctly in halo2::dev::circuit_layout --- src/dev/graph/layout.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dev/graph/layout.rs b/src/dev/graph/layout.rs index 58832534..229c7341 100644 --- a/src/dev/graph/layout.rs +++ b/src/dev/graph/layout.rs @@ -187,9 +187,19 @@ impl Layout { if let Some(region) = self.current_region { let region = &mut self.regions[region]; region.columns.insert(column); - let offset = region.offset.unwrap_or(row); + + // The region offset is the earliest row assigned to. + let mut offset = region.offset.unwrap_or(row); + if row < offset { + // The first row assigned was not at offset 0 within the region. + region.rows += offset - row; + offset = row; + } + // The number of rows in this region is the gap between the earliest and + // latest rows assigned. region.rows = cmp::max(region.rows, row - offset + 1); region.offset = Some(offset); + region.cells.push((column, row)); } else { self.loose_cells.push((column, row));