Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vivianjeng committed Jan 18, 2024
1 parent 2645e07 commit 33a5117
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions mopro-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,26 @@ pub fn convert_proof(proof: Vec<u8>) -> ProofCalldata {
let proof = circom::serialization::convert_proof(&deserialized_proof);
let a = G1 {
x: proof.a.x.to_string(),
y: proof.a.y.to_string()
y: proof.a.y.to_string(),
};
let b = G2 {
x: proof.b.x.iter().map(|x| x.to_string()).collect(),
y: proof.b.y.iter().map(|x| x.to_string()).collect(),
};
let c = G1 {
x: proof.c.x.to_string(),
y: proof.c.y.to_string()
y: proof.c.y.to_string(),
};
ProofCalldata { a, b, c }
}

pub fn convert_inputs(inputs: Vec<u8>) -> Vec<String> {
let deserialized_inputs = circom::serialization::deserialize_inputs(inputs);
let inputs = deserialized_inputs.0.iter().map(|x| x.to_string()).collect();
let inputs = deserialized_inputs
.0
.iter()
.map(|x| x.to_string())
.collect();
inputs
}

Expand Down Expand Up @@ -285,7 +289,8 @@ mod tests {
assert_eq!(serialized_inputs, serialized_outputs);

// Step 3: Verify Proof
let is_valid = mopro_circom.verify_proof(serialized_proof.clone(), serialized_inputs.clone())?;
let is_valid =
mopro_circom.verify_proof(serialized_proof.clone(), serialized_inputs.clone())?;
assert!(is_valid);

// Step 4: Convert Proof
Expand Down Expand Up @@ -336,7 +341,8 @@ mod tests {

// Step 3: Verify Proof

let is_valid = mopro_circom.verify_proof(serialized_proof.clone(), serialized_inputs.clone())?;
let is_valid =
mopro_circom.verify_proof(serialized_proof.clone(), serialized_inputs.clone())?;
assert!(is_valid);

// Step 4: Convert Proof
Expand Down

0 comments on commit 33a5117

Please sign in to comment.