test with circom2
This commit is contained in:
parent
8f5491de53
commit
a821455ec5
18
src/ffi.rs
18
src/ffi.rs
|
@ -351,16 +351,14 @@ pub unsafe extern "C" fn push_input_u256_array(
|
||||||
.map_err(|_| ERR_INPUT_NAME)
|
.map_err(|_| ERR_INPUT_NAME)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let input = {
|
let slice = std::slice::from_raw_parts(input_ptr, len);
|
||||||
let slice = std::slice::from_raw_parts(input_ptr, len);
|
let inputs = slice
|
||||||
slice
|
.chunks(U256::BYTES)
|
||||||
.chunks(U256::BYTES)
|
.map(|c| U256::try_from_le_slice(c).ok_or(ERR_INVALID_INPUT).unwrap())
|
||||||
.map(|c| U256::try_from_le_slice(c).ok_or(ERR_INVALID_INPUT).unwrap())
|
.collect::<Vec<U256>>();
|
||||||
.collect::<Vec<U256>>()
|
|
||||||
};
|
|
||||||
|
|
||||||
let circom = &mut *to_circom(ctx_ptr);
|
let circom = &mut *to_circom(ctx_ptr);
|
||||||
input
|
inputs
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|c| (*circom.builder).push_input(name, *c));
|
.for_each(|c| (*circom.builder).push_input(name, *c));
|
||||||
|
|
||||||
|
@ -410,8 +408,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn proof_verify() {
|
fn proof_verify() {
|
||||||
let r1cs_path = CString::new("./fixtures/mycircuit.r1cs".as_bytes()).unwrap();
|
let r1cs_path = CString::new("./fixtures/circom2_multiplier2.r1cs".as_bytes()).unwrap();
|
||||||
let wasm_path = CString::new("./fixtures/mycircuit.wasm".as_bytes()).unwrap();
|
let wasm_path = CString::new("./fixtures/circom2_multiplier2.wasm".as_bytes()).unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut cfg_ptr: *mut CircomBn254Cfg = std::ptr::null_mut();
|
let mut cfg_ptr: *mut CircomBn254Cfg = std::ptr::null_mut();
|
||||||
|
|
Loading…
Reference in New Issue