diff --git a/Cargo.toml b/Cargo.toml index e0a37576..c2d12c0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ rand_core = { version = "0.6", default-features = false } rand_chacha = "0.3" subtle = "2.5" pasta_curves = { version = "0.5", features = ["repr-c", "serde"] } +halo2curves = { version = "0.6.0", features = ["bits", "derive_serde"] } neptune = { version = "13.0.0", default-features = false } generic-array = "0.14" num-bigint = { version = "0.4", features = ["serde", "rand"] } @@ -39,13 +40,9 @@ itertools = "0.12.0" [target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies] pasta-msm = { version = "0.1.4" } -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -halo2curves = { version = "0.5.0", features = ["bits", "derive_serde"] } - [target.'cfg(target_arch = "wasm32")'.dependencies] # see https://github.com/rust-random/rand/pull/948 getrandom = { version = "0.2.0", default-features = false, features = ["js"] } -halo2curves = { version = "0.5.0", default-features = false, features = ["bits", "derive_serde"] } [dev-dependencies] criterion = { version = "0.4", features = ["html_reports"] } @@ -56,6 +53,7 @@ cfg-if = "1.0.0" sha2 = "0.10.7" proptest = "1.2.0" rand = "0.8.5" +expect-test = "1.4.1" [[bench]] name = "recursive-snark" diff --git a/benches/compressed-snark.rs b/benches/compressed-snark.rs index 53d007f0..7d7482bc 100644 --- a/benches/compressed-snark.rs +++ b/benches/compressed-snark.rs @@ -51,7 +51,7 @@ cfg_if::cfg_if! { criterion_main!(compressed_snark); // This should match the value for the primary in test_recursive_circuit_pasta -const NUM_CONS_VERIFIER_CIRCUIT_PRIMARY: usize = 9825; +const NUM_CONS_VERIFIER_CIRCUIT_PRIMARY: usize = 9817; const NUM_SAMPLES: usize = 10; /// Benchmarks the compressed SNARK at a provided number of constraints diff --git a/benches/recursive-snark.rs b/benches/recursive-snark.rs index c49a12fa..5b16faa1 100644 --- a/benches/recursive-snark.rs +++ b/benches/recursive-snark.rs @@ -43,7 +43,7 @@ cfg_if::cfg_if! { criterion_main!(recursive_snark); // This should match the value for the primary in test_recursive_circuit_pasta -const NUM_CONS_VERIFIER_CIRCUIT_PRIMARY: usize = 9825; +const NUM_CONS_VERIFIER_CIRCUIT_PRIMARY: usize = 9817; const NUM_SAMPLES: usize = 10; fn bench_recursive_snark(c: &mut Criterion) { diff --git a/src/lib.rs b/src/lib.rs index 1bd590cd..0110ffdb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -849,12 +849,12 @@ mod tests { mlkzg::Bn256EngineKZG, pedersen::CommitmentKeyExtTrait, traits::DlogGroup, Bn256Engine, GrumpkinEngine, PallasEngine, Secp256k1Engine, Secq256k1Engine, VestaEngine, }, - traits::{evaluation::EvaluationEngineTrait, snark::default_ck_hint}, + traits::{circuit::TrivialCircuit, evaluation::EvaluationEngineTrait, snark::default_ck_hint}, }; use ::bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError}; use core::{fmt::Write, marker::PhantomData}; + use expect_test::{expect, Expect}; use ff::PrimeField; - use traits::circuit::TrivialCircuit; type EE = provider::ipa_pc::EvaluationEngine; type S = spartan::snark::RelaxedR1CSSNARK; @@ -908,7 +908,7 @@ mod tests { } } - fn test_pp_digest_with(circuit1: &T1, circuit2: &T2, expected: &str) + fn test_pp_digest_with(circuit1: &T1, circuit2: &T2, expected: &Expect) where E1: Engine::Scalar>, E2: Engine::Scalar>, @@ -934,7 +934,7 @@ mod tests { let _ = write!(output, "{b:02x}"); output }); - assert_eq!(digest_str, expected); + expected.assert_eq(&digest_str); } #[test] @@ -946,13 +946,13 @@ mod tests { test_pp_digest_with::( &trivial_circuit1, &trivial_circuit2, - "9bc7ad2ab3f2a12455fdd21527598e365a14619c7f1e09f5cc3c78caa2fdd602", + &expect!["9bc7ad2ab3f2a12455fdd21527598e365a14619c7f1e09f5cc3c78caa2fdd602"], ); test_pp_digest_with::( &cubic_circuit1, &trivial_circuit2, - "8dea023ed642fd2d1a7bedb536cd96d22c0d25ea40961a4fe4a865169bf6ee01", + &expect!["8dea023ed642fd2d1a7bedb536cd96d22c0d25ea40961a4fe4a865169bf6ee01"], ); let trivial_circuit1_grumpkin = TrivialCircuit::<::Scalar>::default(); @@ -962,13 +962,13 @@ mod tests { test_pp_digest_with::( &trivial_circuit1_grumpkin, &trivial_circuit2_grumpkin, - "89e746ed5055445a4aceb2b6fb0413fe0bf4d2efec387dee85613922a972a701", + &expect!["89e746ed5055445a4aceb2b6fb0413fe0bf4d2efec387dee85613922a972a701"], ); test_pp_digest_with::( &cubic_circuit1_grumpkin, &trivial_circuit2_grumpkin, - "941f55146ac21a3b4ff9863546bea95df48cb0069d2fa9e8249f8d0a00560401", + &expect!["941f55146ac21a3b4ff9863546bea95df48cb0069d2fa9e8249f8d0a00560401"], ); let trivial_circuit1_secp = TrivialCircuit::<::Scalar>::default(); @@ -978,12 +978,12 @@ mod tests { test_pp_digest_with::( &trivial_circuit1_secp, &trivial_circuit2_secp, - "4320b4f18ac17958f77db04e78c2d9d6064810f44441e0681f44e977d0fddf03", + &expect!["c70782c49d3de831b3822081655cf61c7d53533f0effcd5c4166cd4fbe651e00"], ); test_pp_digest_with::( &cubic_circuit1_secp, &trivial_circuit2_secp, - "ac86337a156c328c400a6c38ce4f65dc29dcca7317b1f5da45599e4031d1a302", + &expect!["148c5994c443174b67699cb6169aa4489babebb360ae5145bb4b09d77a3a9a01"], ); }