When trying to use a zkey read from a .zkey file (imported using ark_circom::read_zkey), and passing it to a prove function, then using proving_key.vk (from the zkey import also) in a verifier function, the proof will not verify correctly.
It does however verify correctly when using generate_random_parameters.
^ but it won't verify with snarkjs afterwards (with the pre-generated verifying key)
Summary of Bug
When trying to use a zkey read from a .zkey file (imported
using ark_circom::read_zkey
), and passing it to a prove function, then using proving_key.vk (from the zkey import also) in a verifier function, the proof will not verify correctly.It does however verify correctly when using
generate_random_parameters
. ^ but it won't verify with snarkjs afterwards (with the pre-generated verifying key)Version
0.5.0-alpha (https://github.com/arkworks-rs/groth16/tree/release-0.5.0)
Steps to Reproduce
let zkey_cursor = Cursor::new(std::fs::read(circuit.zkey))
let (proving_key, constraint_matrices) = ark_circom::read_zkey(&mut zkey_cursor)
should constraint_matrices be used for something?let cfg = CircomConfig::<ark_bn254::Fr>::new("circuit.wasm","circuit.r1cs")
let mut builder = CircomBuilder::new(cfg)
for (k, v) in inputs { builder.push_input(&k, v) }
inputs areVec<(String, Vec<BigInt>)>
let circom = builder.build()
let pub_inputs = circom.get_public_inputs()
input amount matches the amount specified in verifying keylet proof = Groth16::<Bn254>::prove(&proving_key, circom, &mut rng)
rng isrand::thread_rng
let verified = Groth16::<Bn254>::verify(&proving_key.vk, &pub_inputs, &proof)
== false!