Skip to content

Commit

Permalink
feat(circom): trying out AllocatedPtr and Var
Browse files Browse the repository at this point in the history
  • Loading branch information
tchataigner committed Feb 8, 2024
1 parent ae84e5e commit cc59ac1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/circom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ impl<F: LurkField> CircomGadget<F> for CircomSha256<F> {

fn into_circom_input(self, input: &[AllocatedPtr<F>]) -> Vec<CircomInput<F>> {
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]);
Expand Down Expand Up @@ -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::<Fr, Sha256Coproc<Fr>, MultiFrame<'_, _, _>>::new(
Expand Down
1 change: 1 addition & 0 deletions src/lem/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ fn synthesize_block<F: LurkField, CS: ConstraintSystem<F>, C: Coprocessor<F>>(
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}")),
Expand Down

0 comments on commit cc59ac1

Please sign in to comment.