Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(rln): use unchecked for Projective instantiation [dont merge] #257

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rln/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn json_to_g1(json: &Value, key: &str) -> Result<G1Affine> {
.map(|x| x.map(|v| v.to_owned()))
.collect::<Result<Vec<String>>>()?;

Ok(G1Affine::from(G1Projective::new(
Ok(G1Affine::from(G1Projective::new_unchecked(
fq_from_str(&els[0])?,
fq_from_str(&els[1])?,
fq_from_str(&els[2])?,
Expand Down Expand Up @@ -210,7 +210,7 @@ fn json_to_g1_vec(json: &Value, key: &str) -> Result<Vec<G1Affine>> {

let mut res = vec![];
for coords in els {
res.push(G1Affine::from(G1Projective::new(
res.push(G1Affine::from(G1Projective::new_unchecked(
fq_from_str(&coords[0])?,
fq_from_str(&coords[1])?,
fq_from_str(&coords[2])?,
Expand Down Expand Up @@ -244,7 +244,7 @@ fn json_to_g2(json: &Value, key: &str) -> Result<G2Affine> {
let x = Fq2::new(fq_from_str(&els[0][0])?, fq_from_str(&els[0][1])?);
let y = Fq2::new(fq_from_str(&els[1][0])?, fq_from_str(&els[1][1])?);
let z = Fq2::new(fq_from_str(&els[2][0])?, fq_from_str(&els[2][1])?);
Ok(G2Affine::from(G2Projective::new(x, y, z)))
Ok(G2Affine::from(G2Projective::new_unchecked(x, y, z)))
}

// Converts JSON to a VerifyingKey
Expand Down
4 changes: 2 additions & 2 deletions rln/src/public_api_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ fn g1_from_str(g1: &[String]) -> ark_bn254::G1Affine {
let x = fq_from_str(g1[0].clone());
let y = fq_from_str(g1[1].clone());
let z = fq_from_str(g1[2].clone());
ark_bn254::G1Affine::from(ark_bn254::G1Projective::new(x, y, z))
ark_bn254::G1Affine::from(ark_bn254::G1Projective::new_unchecked(x, y, z))
}

fn g2_from_str(g2: &[Vec<String>]) -> ark_bn254::G2Affine {
Expand All @@ -385,7 +385,7 @@ fn g2_from_str(g2: &[Vec<String>]) -> ark_bn254::G2Affine {
let c1 = fq_from_str(g2[2][1].clone());
let z = ark_bn254::Fq2::new(c0, c1);

ark_bn254::G2Affine::from(ark_bn254::G2Projective::new(x, y, z))
ark_bn254::G2Affine::from(ark_bn254::G2Projective::new_unchecked(x, y, z))
}

fn value_to_string_vec(value: &Value) -> Vec<String> {
Expand Down
Loading