Skip to content

Commit

Permalink
fix(rln): tests (#212)
Browse files Browse the repository at this point in the history
* most changes

* fix

* fix protocol tests

* fmt

* ffi tests fix
  • Loading branch information
tyshko-rostyslav authored Sep 4, 2023
1 parent b87f7c8 commit 99a5e73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rln/src/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ mod test {

// Note: we only test Groth16 proof generation, so we ignore setting the tree in the RLN object
let rln_witness = random_rln_witness(tree_height);
let proof_values = proof_values_from_witness(&rln_witness);
let proof_values = proof_values_from_witness(&rln_witness).unwrap();

// We compute a Groth16 proof
let mut input_buffer = Cursor::new(serialize_witness(&rln_witness).unwrap());
Expand Down
2 changes: 1 addition & 1 deletion rln/tests/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ mod test {
for _ in 0..sample_size {
// We generate random witness instances and relative proof values
let rln_witness = random_rln_witness(tree_height);
let proof_values = proof_values_from_witness(&rln_witness);
let proof_values = proof_values_from_witness(&rln_witness).unwrap();

// We prepare id_commitment and we set the leaf at provided index
let rln_witness_ser = serialize_witness(&rln_witness).unwrap();
Expand Down
9 changes: 5 additions & 4 deletions rln/tests/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ mod test {
// Let's generate a zkSNARK proof
let proof = generate_proof(builder, &proving_key, &rln_witness_unwrapped).unwrap();

let proof_values = proof_values_from_witness(&rln_witness_unwrapped);
let proof_values = proof_values_from_witness(&rln_witness_unwrapped).unwrap();

// Let's verify the proof
let verified = verify_proof(&verification_key, &proof, &proof_values);
Expand Down Expand Up @@ -423,7 +423,8 @@ mod test {
rln_identifier,
user_message_limit,
Fr::from(1),
);
)
.unwrap();

// We generate all relevant keys
let proving_key = zkey_from_folder(TEST_RESOURCES_FOLDER).unwrap();
Expand All @@ -433,7 +434,7 @@ mod test {
// Let's generate a zkSNARK proof
let proof = generate_proof(builder, &proving_key, &rln_witness).unwrap();

let proof_values = proof_values_from_witness(&rln_witness);
let proof_values = proof_values_from_witness(&rln_witness).unwrap();

// Let's verify the proof
let success = verify_proof(&verification_key, &proof, &proof_values).unwrap();
Expand Down Expand Up @@ -461,7 +462,7 @@ mod test {
assert_eq!(rln_witness, deser);

// We test Proof values serialization
let proof_values = proof_values_from_witness(&rln_witness);
let proof_values = proof_values_from_witness(&rln_witness).unwrap();
let ser = serialize_proof_values(&proof_values);
let (deser, _) = deserialize_proof_values(&ser);
assert_eq!(proof_values, deser);
Expand Down

0 comments on commit 99a5e73

Please sign in to comment.