Skip to content

Commit

Permalink
feat: add next_phase function to Layouter
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpwang committed Sep 4, 2023
1 parent 163fecb commit e1a04ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions halo2_proofs/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ pub trait Layouter<F: Field> {
/// absolute position.
fn constrain_instance(&mut self, cell: Cell, column: Column<Instance>, row: usize);

/// Commit advice columns in current phase and squeeze challenges.
/// This can be called DURING synthesize.
fn next_phase(&mut self);

/// Queries the value of the given challenge.
///
/// Returns `Value::unknown()` if the current synthesis phase is before the challenge can be queried.
Expand Down Expand Up @@ -513,6 +517,10 @@ impl<'a, F: Field, L: Layouter<F> + 'a> Layouter<F> for NamespacedLayouter<'a, F
self.0.get_challenge(challenge)
}

fn next_phase(&mut self) {
self.0.next_phase();
}

fn get_root(&mut self) -> &mut Self::Root {
self.0.get_root()
}
Expand Down
4 changes: 4 additions & 0 deletions halo2_proofs/src/circuit/floor_planner/single_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ impl<'a, F: Field, CS: Assignment<F> + 'a + SyncDeps> Layouter<F>
self.cs.get_challenge(challenge)
}

fn next_phase(&mut self) {
self.cs.next_phase();
}

fn get_root(&mut self) -> &mut Self::Root {
self
}
Expand Down
6 changes: 1 addition & 5 deletions halo2_proofs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,11 +1240,7 @@ impl<F: FromUniformBytes<64> + Ord> MockProver<F> {
advice
.iter()
.map(|rc| match *rc {
AdviceCellValue::Assigned(ref a) => CellValue::Assigned(match a.as_ref() {
Assigned::Trivial(a) => *a,
Assigned::Rational(a, b) => *a * b.invert().unwrap(),
_ => F::ZERO,
}),
AdviceCellValue::Assigned(ref a) => CellValue::Assigned(a.evaluate()),
AdviceCellValue::Poison(i) => CellValue::Poison(i),
})
.collect::<Vec<_>>()
Expand Down

0 comments on commit e1a04ce

Please sign in to comment.