1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

remove unreachable variant, add comments to snark verification tests

This commit is contained in:
dark64 2021-07-07 15:46:56 +02:00
parent 878faf2ba3
commit 6f0821f129
4 changed files with 23 additions and 5 deletions

View file

@ -1,5 +1,11 @@
from "EMBED" import snark_verify_bls12_377
// Verifies a proof with 1 public input (0 inputs + 1 output)
// Circuit used in this test:
//
// def main() -> field:
// return 1
def main(private field[1] inputs, private field[8] proof, private field[20] vk) -> bool:
bool result = snark_verify_bls12_377(inputs, proof, vk)
return result

View file

@ -1,5 +1,11 @@
from "EMBED" import snark_verify_bls12_377
// Verifies a proof with 2 public inputs (1 input + 1 output)
// Circuit used in this test:
//
// def main(field a) -> field:
// return a * a
def main(private field[2] inputs, private field[8] proof, private field[22] vk) -> bool:
bool result = snark_verify_bls12_377(inputs, proof, vk)
return result

View file

@ -1,5 +1,15 @@
from "EMBED" import snark_verify_bls12_377
// Verifies a proof with 5 public inputs (4 inputs + 1 output)
// Circuit used in this test:
//
// def main(field[4] a) -> field:
// field out = 0
// for u32 i in 0..4 do
// out = out + a[i]
// endfor
// return out
def main(private field[5] inputs, private field[8] proof, private field[28] vk) -> bool:
bool result = snark_verify_bls12_377(inputs, proof, vk)
return result

View file

@ -58,7 +58,7 @@ pub fn generate_verify_constraints(
let cs_sys = ConstraintSystem::<BW6Fr>::new();
let cs = ConstraintSystemRef::new(cs_sys);
let mut rng = test_rng();
let mut rng = test_rng(); // has a fixed seed
let circuit = DefaultCircuit { public_input_size };
let (pk, vk) = GM17Snark::circuit_specific_setup(circuit, &mut rng).unwrap();
@ -161,10 +161,6 @@ pub fn generate_verify_constraints(
.variable()
.get_index_unchecked(num_instance_variables)
.unwrap(),
Boolean::Not(x) => x
.variable()
.get_index_unchecked(num_instance_variables)
.unwrap(),
_ => unreachable!(),
};