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

chore: fix some warnings #24

Merged
merged 2 commits into from
Dec 21, 2024
Merged
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
30 changes: 15 additions & 15 deletions src/bigcurve_test.nr
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fn test_transcript() {
unsafe {
let P: BN254J = CurveJ::one();

let P2 = unsafe { P.dbl() };
let P2 = P.dbl();

let Z_inverse = P2.1.z3.__invmod();

Expand All @@ -214,7 +214,7 @@ fn test_transcript() {
let y2 = Y2.__mul(ZZZ);

// ### test add transcript
let P3 = unsafe { P.incomplete_add(P2.0) };
let P3 = P.incomplete_add(P2.0);
let Z_inverse = P3.1.z3.__invmod();

let lambda = P3.1.lambda_numerator.__mul(Z_inverse);
Expand All @@ -234,7 +234,7 @@ fn test_double_with_hint() {
unsafe {
let P: BN254J = CurveJ::one();

let P2 = unsafe { P.dbl() };
let P2 = P.dbl();

let P_affine: BN254 = BigCurve::one();

Expand Down Expand Up @@ -274,7 +274,7 @@ fn test_incomplete_add_with_hint() {
is_infinity: false,
};
let Q = CurveJ::from(Q_affine);
let R = unsafe { P.incomplete_add(Q) };
let R = P.incomplete_add(Q);

let P_affine: BN254 = BigCurve::one();

Expand All @@ -298,8 +298,8 @@ fn test_incomplete_add_with_hint() {

let P: BN254J = CurveJ::one();

let lhs = unsafe { P.dbl().0.dbl().0 };
let rhs = unsafe { P.dbl().0.incomplete_add(P).0.incomplete_add(P).0 };
let lhs = P.dbl().0.dbl().0;
let rhs = P.dbl().0.incomplete_add(P).0.incomplete_add(P).0;
assert(lhs == rhs);
}
}
Expand All @@ -324,21 +324,21 @@ fn test_add() {

let P_j = CurveJ::from(P);
let Q_j = CurveJ::from(Q);
let expected = unsafe { P_j.add(Q_j).0 };
let expected = P_j.add(Q_j).0;

assert(result.eq(expected));

// doubling
let Q: BN254 = BigCurve::one();

let result = CurveJ::from(P.add(Q));
let expected = unsafe { P_j.dbl().0 };
let expected = P_j.dbl().0;
assert(result.eq(expected));

// infinity
let Q = P.neg();
let result = CurveJ::from(P.add(Q));
let expected = unsafe { CurveJ::point_at_infinity() };
let expected = CurveJ::point_at_infinity();
assert(result.eq(expected));

// lhs infinity
Expand All @@ -354,7 +354,7 @@ fn test_add() {
// both infinity
let Q: BN254 = BigCurve::point_at_infinity();
let result = CurveJ::from(Q.add(P));
let expected = unsafe { CurveJ::point_at_infinity() };
let expected = CurveJ::point_at_infinity();
assert(result.eq(expected));
}
}
Expand All @@ -379,20 +379,20 @@ fn test_sub() {

let P_j = CurveJ::from(P);
let Q_j = CurveJ::from(Q);
let expected = unsafe { P_j.sub(Q_j).0 };
let expected = P_j.sub(Q_j).0;

assert(result.eq(expected));

// doubling
let Q: BN254 = BigCurve::one();

let result = CurveJ::from(P.sub(Q.neg()));
let expected = unsafe { P_j.dbl().0 };
let expected = P_j.dbl().0;
assert(result.eq(expected));

// infinity
let result = CurveJ::from(P.sub(Q));
let expected = unsafe { CurveJ::point_at_infinity() };
let expected = CurveJ::point_at_infinity();
assert(result.eq(expected));

// lhs infinity
Expand All @@ -409,7 +409,7 @@ fn test_sub() {
// both infinity
let Q: BN254 = BigCurve::point_at_infinity();
let result = CurveJ::from(Q.sub(P));
let expected = unsafe { CurveJ::point_at_infinity() };
let expected = CurveJ::point_at_infinity();
assert(result.eq(expected));
}
}
Expand All @@ -420,7 +420,7 @@ fn test_make_table() {
let P: BN254J = CurveJ::one();

let mut transcript: [JTranscript<Fq>] = &[];
let T: curve_jac::PointTable<Fq> = unsafe { curve_jac::PointTable::new(P) };
let T: curve_jac::PointTable<Fq> = curve_jac::PointTable::new(P);
for i in 0..8 {
transcript = transcript.push_back(T.transcript[i]);
}
Expand Down
Loading