From 7100c2362eedcd872102b31ac6169d6f2fb6cfb2 Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Wed, 16 Aug 2023 22:00:40 -0600 Subject: [PATCH] chore: add back RangeCircuitBuilder::config (#111) --- halo2-base/src/gates/builder/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/halo2-base/src/gates/builder/mod.rs b/halo2-base/src/gates/builder/mod.rs index 7280967a..f70def08 100644 --- a/halo2-base/src/gates/builder/mod.rs +++ b/halo2-base/src/gates/builder/mod.rs @@ -623,6 +623,13 @@ impl RangeCircuitBuilder { ) -> Self { Self(GateCircuitBuilder::prover(builder, config_params, break_points)) } + + /// Auto-configures the circuit configuration parameters. Mutates the configuration parameters of the circuit + /// and also returns a copy of the new configuration. + pub fn config(&mut self, minimum_rows: Option) -> BaseConfigParams { + self.0.config_params = self.0.builder.borrow().config(self.0.config_params.k, minimum_rows); + self.0.config_params.clone() + } } impl Circuit for RangeCircuitBuilder { @@ -754,6 +761,12 @@ impl RangeWithInstanceCircuitBuilder { pub fn instance(&self) -> Vec { self.assigned_instances.iter().map(|v| *v.value()).collect() } + + /// Auto-configures the circuit configuration parameters. Mutates the configuration parameters of the circuit + /// and also returns a copy of the new configuration. + pub fn config(&mut self, minimum_rows: Option) -> BaseConfigParams { + self.circuit.config(minimum_rows) + } } impl Circuit for RangeWithInstanceCircuitBuilder {