Skip to content

Commit

Permalink
fix: intermittent verification errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chancehudson committed Jan 16, 2025
1 parent 38d3c65 commit 19072ad
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
Binary file modified mopro-ffi/rapidsnark/aarch64/libfq.a
Binary file not shown.
Binary file modified mopro-ffi/rapidsnark/aarch64/libfr.a
Binary file not shown.
Binary file modified mopro-ffi/rapidsnark/aarch64/librapidsnark-fr-fq.a
Binary file not shown.
Binary file modified mopro-ffi/rapidsnark/aarch64/librapidsnark.a
Binary file not shown.
7 changes: 4 additions & 3 deletions mopro-ffi/src/circom/rapidsnark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use serde::Serialize;
use super::WtnsFn;

// match what rapidsnark expects
#[derive(Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
struct VerificationKey {
protocol: String,
curve: String,
Expand Down Expand Up @@ -57,7 +57,7 @@ pub fn verify_proof(zkey_path: &str, proof: String, public_signals: String) -> R
let vkey = VerificationKey {
protocol: "groth16".to_string(),
curve: "bn128".to_string(),
nPublic: 2,
nPublic: 0, // this is unused in the rapidsnark verifier
vk_alpha_1: [
vk.alpha_g1.x.to_string(),
vk.alpha_g1.y.to_string(),
Expand Down Expand Up @@ -85,13 +85,14 @@ pub fn verify_proof(zkey_path: &str, proof: String, public_signals: String) -> R
.collect(),
};
let vkey_json = serde_json::to_string(&vkey)?;
let vkey_json_cstr = CString::new(vkey_json)?;
unsafe {
let result = groth16_api_verify(
&mut ProofResult {
proof: CString::new(proof).unwrap().into_raw(),
public_signals: CString::new(public_signals).unwrap().into_raw(),
},
vkey_json.as_ptr() as *const c_char,
vkey_json_cstr.as_ptr(),
);
Ok(result)
}
Expand Down

0 comments on commit 19072ad

Please sign in to comment.