diff --git a/examples/sha256.rs b/examples/sha256.rs index 5c8fa6df36..94fd275a3d 100644 --- a/examples/sha256.rs +++ b/examples/sha256.rs @@ -12,8 +12,8 @@ use lurk::field::LurkField; use lurk::proof::{nova::NovaProver, Prover}; use lurk::ptr::Ptr; use lurk::public_parameters::public_params; +use lurk::state::user_sym; use lurk::store::Store; -use lurk::sym; use lurk_macros::Coproc; use bellperson::gadgets::boolean::{AllocatedBit, Boolean}; @@ -170,18 +170,15 @@ fn main() { u.reverse(); let store = &mut Store::::new(); - let sym_str = sym!("sha256", format!("{}-zero-bytes", input_size)); + let cproc_sym = user_sym(&format!("sha256-{input_size}-zero-bytes")); + let cproc_sym_ptr = store.intern_symbol(&cproc_sym); let lang = Lang::>::new_with_bindings( store, - vec![( - sym_str.clone(), - Sha256Coprocessor::new(input_size, u).into(), - )], + vec![(cproc_sym, Sha256Coprocessor::new(input_size, u).into())], ); - let coproc_expr = format!("({})", sym_str); - let ptr = store.read(&coproc_expr).unwrap(); + let cproc_call = store.list(&[cproc_sym_ptr]); let nova_prover = NovaProver::>::new(REDUCTION_COUNT, lang.clone()); let lang_rc = Arc::new(lang); @@ -202,7 +199,7 @@ fn main() { let proof_start = Instant::now(); let (proof, z0, zi, num_steps) = nova_prover - .evaluate_and_prove(&pp, ptr, empty_sym_env(store), store, 10000, lang_rc) + .evaluate_and_prove(&pp, cproc_call, empty_sym_env(store), store, 10000, lang_rc) .unwrap(); let proof_end = proof_start.elapsed(); diff --git a/src/proof/nova.rs b/src/proof/nova.rs index 39ba54acb3..5b165586e2 100644 --- a/src/proof/nova.rs +++ b/src/proof/nova.rs @@ -424,7 +424,7 @@ impl<'a: 'b, 'b, F: CurveCycleEquipped, C: Coprocessor> Proof<'a, F, C> { #[cfg(test)] pub mod tests { use crate::num::Num; - use crate::state::State; + use crate::state::{State, user_sym}; use super::*; use crate::eval::empty_sym_env; @@ -3675,26 +3675,25 @@ pub mod tests { fn test_dumb_lang() { use crate::coprocessor::test::DumbCoprocessor; use crate::eval::tests::coproc::DumbCoproc; - use crate::symbol::Symbol; let s = &mut Store::::new(); let mut lang = Lang::>::new(); - let name = Symbol::sym(&["cproc", "dumb"]); + let name = user_sym("cproc-dumb"); let dumb = DumbCoprocessor::new(); let coproc = DumbCoproc::DC(dumb); lang.add_coprocessor(name, coproc, s); // 9^2 + 8 = 89 - let expr = "(.cproc.dumb 9 8)"; + let expr = "(cproc-dumb 9 8)"; // The dumb coprocessor cannot be shadowed. - let expr2 = "(let ((.cproc.dumb (lambda (a b) (* a b)))) - (.cproc.dumb 9 8))"; + let expr2 = "(let ((cproc-dumb (lambda (a b) (* a b)))) + (cproc-dumb 9 8))"; - let expr3 = "(.cproc.dumb 9 8 123)"; - let expr4 = "(.cproc.dumb 9)"; + let expr3 = "(cproc-dumb 9 8 123)"; + let expr4 = "(cproc-dumb 9)"; let res = s.num(89); let error = s.get_cont_error();