Skip to content

Commit

Permalink
feat: add GateThreadBuilder::from_stage for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpwang committed Aug 14, 2023
1 parent 929810d commit 9a93f73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions halo2-base/src/gates/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ impl<F: ScalarField> GateThreadBuilder<F> {
Self { threads, thread_count: 1, witness_gen_only, use_unknown: false }
}

/// Creates a new [GateThreadBuilder] depending on the stage of circuit building. If the stage is [CircuitBuilderStage::Prover], the [GateThreadBuilder] is used for witness generation only.
pub fn from_stage(stage: CircuitBuilderStage) -> Self {
Self::new(stage == CircuitBuilderStage::Prover)
}

/// Creates a new [GateThreadBuilder] with `witness_gen_only` set to false.
///
/// Performs the witness assignment computations and then checks using normal programming logic whether the gate constraints are all satisfied.
Expand Down

0 comments on commit 9a93f73

Please sign in to comment.