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 12, 2024
1 parent 529e742 commit e0e4db4
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 @@ -79,7 +79,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 @@ -119,7 +122,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::<Bn, Sha256Coproc<Bn>>::new(REDUCTION_COUNT, lang_rc.clone());
Expand Down
1 change: 1 addition & 0 deletions src/lem/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,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 e0e4db4

Please sign in to comment.