diff --git a/Cargo.toml b/Cargo.toml index 1976467..b4b95ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,10 @@ num-bigint = "0.4.3" # Sonobe's folding-schemes, but for a real-world usage it must be used without # this feature (but then the DeciderETH circuit is bigger and takes more time # to compute). -folding-schemes = { git = "https://github.com/privacy-scaling-explorations/sonobe", package = "folding-schemes", features=["light-test"]} +# folding-schemes = { git = "https://github.com/privacy-scaling-explorations/sonobe", package = "folding-schemes", features=["light-test"]} + +# note: this branch uses the 'reduce-memory-usage' branch from sonobe: +folding-schemes = { git = "https://github.com/privacy-scaling-explorations/sonobe", package = "folding-schemes", features=["light-test"], branch="reduce-memory-usage" } solidity-verifiers = { git = "https://github.com/privacy-scaling-explorations/sonobe", package = "solidity-verifiers"} serde = "1.0.198" serde_json = "1.0.116" diff --git a/src/keccak_chain.rs b/src/keccak_chain.rs index 7eb8f64..af1d53c 100644 --- a/src/keccak_chain.rs +++ b/src/keccak_chain.rs @@ -43,8 +43,8 @@ mod tests { use tiny_keccak::{Hasher, Keccak}; fn rust_native_step( _i: usize, - z_i: Vec, - _external_inputs: Vec, + z_i: &[F], + _external_inputs: &[F], ) -> Result, Error> { let b = f_vec_bits_to_bytes(z_i.to_vec()); let mut h = Keccak::v256(); @@ -84,10 +84,10 @@ mod tests { let cs = ConstraintSystem::::new_ref(); let z_0_var = Vec::>::new_witness(cs.clone(), || Ok(z_0.clone())).unwrap(); let z_1_var = f_circuit - .generate_step_constraints(cs.clone(), 1, z_0_var, vec![]) + .generate_step_constraints(cs.clone(), 1, &z_0_var, &[]) .unwrap(); // check z_1_var against the native z_1 - let z_1_native = f_circuit.step_native(1, z_0.clone(), vec![]).unwrap(); + let z_1_native = f_circuit.step_native(1, &z_0, &[]).unwrap(); assert_eq!(z_1_var.value().unwrap(), z_1_native); // check that the constraint system is satisfied assert!(cs.is_satisfied().unwrap()); @@ -141,7 +141,7 @@ mod tests { // perform the hash chain natively in rust (which uses a rust Keccak256 library) let mut z_i_native = z_0.clone(); for i in 0..n_steps { - z_i_native = rust_native_step(i, z_i_native, vec![]).unwrap(); + z_i_native = rust_native_step(i, &z_i_native, &[]).unwrap(); } // check that the value of the last folding state (nova.z_i) computed through folding, is // equal to the natively computed hash using the rust_native_step method diff --git a/src/sha_chain.rs b/src/sha_chain.rs index 3124abd..a04feb4 100644 --- a/src/sha_chain.rs +++ b/src/sha_chain.rs @@ -65,8 +65,8 @@ mod tests { fn step_native( &self, _i: usize, - z_i: Vec, - _external_inputs: Vec, + z_i: &[F], + _external_inputs: &[F], ) -> Result, Error> { let mut b = f_vec_to_bytes(z_i.to_vec()); @@ -82,8 +82,8 @@ mod tests { &self, _cs: ConstraintSystemRef, _i: usize, - z_i: Vec>, - _external_inputs: Vec>, + z_i: &[FpVar], + _external_inputs: &[FpVar], ) -> Result>, SynthesisError> { let mut b: Vec> = z_i .iter() @@ -132,10 +132,10 @@ mod tests { let cs = ConstraintSystem::::new_ref(); let z_0_var = Vec::>::new_witness(cs.clone(), || Ok(z_0.clone())).unwrap(); let z_1_var = f_circuit - .generate_step_constraints(cs.clone(), 1, z_0_var, vec![]) + .generate_step_constraints(cs.clone(), 1, &z_0_var, &[]) .unwrap(); // check z_1_var against the native z_1 - let z_1_native = f_circuit.step_native(1, z_0.clone(), vec![]).unwrap(); + let z_1_native = f_circuit.step_native(1, &z_0, &[]).unwrap(); assert_eq!(z_1_var.value().unwrap(), z_1_native); // check that the constraint system is satisfied assert!(cs.is_satisfied().unwrap());