diff --git a/halo2_proofs/src/circuit/floor_planner/single_pass.rs b/halo2_proofs/src/circuit/floor_planner/single_pass.rs index 824ad427f8..b27a7cf854 100644 --- a/halo2_proofs/src/circuit/floor_planner/single_pass.rs +++ b/halo2_proofs/src/circuit/floor_planner/single_pass.rs @@ -44,6 +44,8 @@ pub struct SingleChipLayouter<'a, F: Field, CS: Assignment + 'a> { // Stores the starting row for each region. // Edit: modify to just one region with RegionStart(0) // regions: Vec, + // `assign_region` must only be called once. + region_assigned: bool, /// Stores the first empty row for each column. columns: FxHashMap, /// Stores the table fixed columns. @@ -67,6 +69,7 @@ impl<'a, F: Field, CS: Assignment> SingleChipLayouter<'a, F, CS> { cs, constants, // regions: vec![], + region_assigned: false, columns: FxHashMap::default(), table_columns: vec![], _marker: PhantomData, @@ -86,6 +89,10 @@ impl<'a, F: Field, CS: Assignment + 'a + SyncDeps> Layouter N: Fn() -> NR, NR: Into, { + assert!( + !self.region_assigned, + "Only a single region can be assigned per layouter." + ); /* let region_index = self.regions.len(); @@ -148,6 +155,8 @@ impl<'a, F: Field, CS: Assignment + 'a + SyncDeps> Layouter } } + self.region_assigned = true; + Ok(result) }