From a9cea5762e80da4cd1b1571ed72f98351b6f644d Mon Sep 17 00:00:00 2001 From: Soham Zemse <22412996+zemse@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:31:57 +0530 Subject: [PATCH 1/2] prevent duplicate WitIn --- ceno_zkvm/src/expression.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ceno_zkvm/src/expression.rs b/ceno_zkvm/src/expression.rs index 90f2bba97..a85415207 100644 --- a/ceno_zkvm/src/expression.rs +++ b/ceno_zkvm/src/expression.rs @@ -757,7 +757,9 @@ pub mod fmt { ) -> String { match expression { Expression::WitIn(wit_in) => { - wtns.push(*wit_in); + if !wtns.contains(wit_in) { + wtns.push(*wit_in); + } format!("WitIn({})", wit_in) } Expression::Challenge(id, pow, scaler, offset) => { From 2f1f1295294f93d0d215ff4e3c58c2a915e1052a Mon Sep 17 00:00:00 2001 From: Soham Zemse <22412996+zemse@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:32:29 +0530 Subject: [PATCH 2/2] improve parsing of require_equal errors in mock prover --- ceno_zkvm/src/chip_handler/general.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ceno_zkvm/src/chip_handler/general.rs b/ceno_zkvm/src/chip_handler/general.rs index 255ae20d3..85aafab0f 100644 --- a/ceno_zkvm/src/chip_handler/general.rs +++ b/ceno_zkvm/src/chip_handler/general.rs @@ -168,7 +168,13 @@ impl<'a, E: ExtensionField> CircuitBuilder<'a, E> { NR: Into, N: FnOnce() -> NR, { - self.namespace(|| "require_equal", |cb| cb.cs.require_zero(name_fn, a - b)) + self.namespace( + || "require_equal", + |cb| { + cb.cs + .require_zero(name_fn, a.to_monomial_form() - b.to_monomial_form()) + }, + ) } pub fn require_one(&mut self, name_fn: N, expr: Expression) -> Result<(), ZKVMError>