Merge pull request #237 from zcash/dev-permutation-any-cols

Minor fixes to dev tools
This commit is contained in:
ebfull 2021-04-09 09:54:52 -06:00 committed by GitHub
commit 78c394645d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -382,7 +382,11 @@ impl<F: FieldExt> MockProver<F> {
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::<Vec<_>>();
// Iterate over each column of the permutation

View File

@ -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));