From cc59ac1c86f5a7a961cab6f027fb7213cd568806 Mon Sep 17 00:00:00 2001 From: Thomas Chataigner Date: Thu, 8 Feb 2024 18:25:44 +0100 Subject: [PATCH] feat(circom): trying out AllocatedPtr and Var --- examples/circom.rs | 7 +++++-- src/lem/circuit.rs | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/circom.rs b/examples/circom.rs index 827495c8fd..5554c192bc 100644 --- a/examples/circom.rs +++ b/examples/circom.rs @@ -80,7 +80,10 @@ impl CircomGadget for CircomSha256 { fn into_circom_input(self, input: &[AllocatedPtr]) -> Vec> { dbg!(input.len()); - dbg!(input.get(0).unwrap()); + dbg!(input.get(0).unwrap().hash().get_value()); + dbg!(input.get(0).unwrap().hash().get_variable().get_unchecked()); + dbg!(input.get(1).unwrap().hash().get_value()); + dbg!(input.get(1).unwrap().hash().get_variable().get_unchecked()); // TODO: actually use the lurk inputs let a = CircomInput::new("a".into(), vec![F::ZERO]); let b = CircomInput::new("b".into(), vec![F::ZERO]); @@ -118,7 +121,7 @@ fn main() { lang.add_coprocessor(sym_str, CircomCoprocessor::new(circom_sha256)); let lang_rc = Arc::new(lang); - let expr = "(.circom_sha256_2 \"a\" \"b\")".to_string(); + let expr = "(.circom_sha256_2 \"b\" \"a\")".to_string(); let ptr = store.read_with_default_state(&expr).unwrap(); let nova_prover = NovaProver::, MultiFrame<'_, _, _>>::new( diff --git a/src/lem/circuit.rs b/src/lem/circuit.rs index 7b2534154a..8d5a2f03f7 100644 --- a/src/lem/circuit.rs +++ b/src/lem/circuit.rs @@ -593,6 +593,7 @@ fn synthesize_block, C: Coprocessor>( if cproc.has_circuit() { // call the coprocessor's synthesize and then make sure that // the output matches the data collected during interpretation + dbg!(&inp); let inp_ptrs = bound_allocations.get_many_ptr(inp)?; let synthesize_output = cproc.synthesize_internal( &mut cs.namespace(|| format!("Coprocessor {sym}")),