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: update to use noir bignum 0.4.2 #15

Closed
wants to merge 2 commits 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
4 changes: 2 additions & 2 deletions Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors = [""]
compiler_version = ">=0.36.0"

[dependencies]
bignum = {tag = "v0.4.1", git = "https://github.com/noir-lang/noir-bignum"}
sort = {tag = "v0.2.0", git = "https://github.com/noir-lang/noir_sort"}
bignum = { tag = "v0.4.2", git = "https://github.com/noir-lang/noir-bignum" }
sort = { tag = "v0.2.0", git = "https://github.com/noir-lang/noir_sort" }
35 changes: 7 additions & 28 deletions src/bigcurve_test.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use dep::bignum::BigNum;
use crate::BigCurve;

use crate::curve_jac;
use crate::curve_jac::JTranscript;
use crate::curve_jac::AffineTranscript;
use crate::curve_jac::CurveJ;
use crate::scalar_field::ScalarField;
use crate::curve_jac::JTranscript;
use crate::curves::bn254::{BN254, BN254Params, BN254Scalar};
use crate::PointTable;
use crate::curves::bn254::{BN254, BN254Scalar, BN254Params};
use crate::scalar_field::ScalarField;
type Fq = BigNum<3, 254, BN254_Fq_Params>;

type BN254J = CurveJ<Fq, BN254Params>;
Expand Down Expand Up @@ -448,15 +448,15 @@ fn test_make_table() {

use dep::bignum::fields::bn254Fq::BN254_Fq_Params;

use crate::curves::vesta::{Vesta, VestaFr, VestaScalar};
use crate::curves::pallas::{Pallas, PallasFr, PallasScalar};
use crate::curves::bls12_377::{BLS12_377, BLS12_377Fr, BLS12_377Scalar};
use crate::curves::bls12_381::{BLS12_381, BLS12_381Fr, BLS12_381Scalar};
use crate::curves::mnt4_753::{MNT4_753, MNT4_753Fr, MNT4_753Scalar};
use crate::curves::mnt6_753::{MNT6_753, MNT6_753Fr, MNT6_753Scalar};
use crate::curves::pallas::{Pallas, PallasFr, PallasScalar};
use crate::curves::secp256k1::{Secp256k1, Secp256k1Fr, Secp256k1Scalar};
use crate::curves::secp256r1::{Secp256r1, Secp256r1Fr, Secp256r1Scalar};
use crate::curves::secp384r1::{Secp384r1, Secp384r1Fr, Secp384r1Scalar};
use crate::curves::mnt4_753::{MNT4_753, MNT4_753Fr, MNT4_753Scalar};
use crate::curves::mnt6_753::{MNT6_753, MNT6_753Fr, MNT6_753Scalar};
use crate::curves::vesta::{Vesta, VestaFr, VestaScalar};

//comptime fn
comptime fn make_test(
Expand Down Expand Up @@ -535,24 +535,3 @@ fn test_msm() {
}
}
}

#[make_test(quote{BN254}, quote{BigNum<3, 254, BN254_Fq_Params>}, quote{BN254Scalar})]
pub struct BN254GenTests {}
#[make_test(quote{Vesta}, quote{VestaFr}, quote{VestaScalar})]
pub struct VestaGenTests {}
#[make_test(quote{Pallas}, quote{PallasFr}, quote{PallasScalar})]
pub struct PallasGenTests {}
#[make_test(quote{BLS12_377}, quote{BLS12_377Fr}, quote{BLS12_377Scalar})]
pub struct BLS377GenTests {}
#[make_test(quote{BLS12_381}, quote{BLS12_381Fr}, quote{BLS12_381Scalar})]
pub struct BLS381GenTests {}
#[make_test(quote{Secp256k1}, quote{Secp256k1Fr}, quote{Secp256k1Scalar})]
pub struct Secp256k1GenTests {}
#[make_test(quote{Secp256r1}, quote{Secp256r1Fr}, quote{Secp256r1Scalar})]
pub struct Secp256r1GenTests {}
#[make_test(quote{Secp384r1}, quote{Secp384r1Fr}, quote{Secp384r1Scalar})]
pub struct Secp384r1GenTests {}
#[make_test(quote{MNT4_753}, quote{MNT4_753Fr}, quote{MNT4_753Scalar})]
pub struct MNT4GenTests {}
#[make_test(quote{MNT6_753}, quote{MNT6_753Fr}, quote{MNT6_753Scalar})]
pub struct MNT6GenTests {}
Comment on lines -539 to -558
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just deleting all the tests. Instead can you change them to work on modules such as in the bignum library?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry I deleted the tests by mistake, should’ve double checked the PR. Thanks!

2 changes: 1 addition & 1 deletion src/curves/bls12_377.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::CurveParamsTrait;
use crate::BigCurve;
use crate::scalar_field::ScalarField;

global BLS12_377_SCALAR_SLICES = 64;
global BLS12_377_SCALAR_SLICES: u32 = 64;
pub struct BLS12_377_Params {}
impl CurveParamsTrait<BigNum<4, 377, BLS12_377_Fq_Params>> for BLS12_377_Params {
fn a() -> BigNum<4, 377, BLS12_377_Fq_Params> {
Expand Down
2 changes: 1 addition & 1 deletion src/curves/bls12_381.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::CurveParamsTrait;
use crate::BigCurve;
use crate::scalar_field::ScalarField;

global BLS12_381_SCALAR_SLICES = 64;
global BLS12_381_SCALAR_SLICES: u32 = 64;
pub struct BLS12_381_Params {}
impl CurveParamsTrait<BigNum<4, 381, BLS12_381_Fq_Params>> for BLS12_381_Params {
fn a() -> BigNum<4, 381, BLS12_381_Fq_Params> {
Expand Down
2 changes: 1 addition & 1 deletion src/curves/bn254.nr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl CurveParamsTrait<BigNum<3, 254, BN254_Fq_Params>> for BN254Params {
}
}

global BN254_SCALAR_SLICES = 64;
global BN254_SCALAR_SLICES: u32 = 64;
pub type BN254 = BigCurve<BigNum<3, 254, BN254_Fq_Params>, BN254Params>;
pub type BN254Scalar = ScalarField<BN254_SCALAR_SLICES>;
pub type BN254Fq = BigNum<3, 254, BN254_Fq_Params>;
Expand Down
2 changes: 1 addition & 1 deletion src/curves/mnt4_753.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::CurveParamsTrait;
use crate::BigCurve;
use crate::scalar_field::ScalarField;

global MNT4_753_SCALAR_SLICES = 189;
global MNT4_753_SCALAR_SLICES: u32 = 189;
pub struct MNT4_753_Params {}
impl CurveParamsTrait<BigNum<7, 753, MNT4_753_Fq_Params>> for MNT4_753_Params {
fn a() -> BigNum<7, 753, MNT4_753_Fq_Params> {
Expand Down
2 changes: 1 addition & 1 deletion src/curves/mnt6_753.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::CurveParamsTrait;
use crate::BigCurve;
use crate::scalar_field::ScalarField;

global MNT6_753_SCALAR_SLICES = 189;
global MNT6_753_SCALAR_SLICES: u32 = 189;
pub struct MNT6_753_Params {}
impl CurveParamsTrait<BigNum<7, 753, MNT6_753_Fq_Params>> for MNT6_753_Params {
fn a() -> BigNum<7, 753, MNT6_753_Fq_Params> {
Expand Down
2 changes: 1 addition & 1 deletion src/curves/pallas.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::BigCurve;
use crate::scalar_field::ScalarField;
use crate::CurveParamsTrait;

global PALLAS_SCALAR_SLICES = 64;
global PALLAS_SCALAR_SLICES: u32 = 64;

pub struct Pallas_Params {}
impl CurveParamsTrait<BigNum<3, 255, Pallas_Fq_Params>> for Pallas_Params {
Expand Down
2 changes: 1 addition & 1 deletion src/curves/secp256k1.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::CurveParamsTrait;
use crate::BigCurve;
use crate::scalar_field::ScalarField;

global SECP256k1_SCALAR_SLICES = 65;
global SECP256k1_SCALAR_SLICES: u32 = 65;
pub struct Secp256k1_Params {}
impl CurveParamsTrait<BigNum<3, 256, Secp256k1_Fq_Params>> for Secp256k1_Params {
fn a() -> BigNum<3, 256, Secp256k1_Fq_Params> {
Expand Down
2 changes: 1 addition & 1 deletion src/curves/secp384r1.nr
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl CurveParamsTrait<BigNum<4, 384, Secp384r1_Fq_Params>> for Secp384r1_Params
}
}

pub global SECP384r1_SCALAR_SLICES = 97;
pub global SECP384r1_SCALAR_SLICES: u32 = 97;
pub type Secp384r1 = BigCurve<BigNum<4, 384, Secp384r1_Fq_Params>, Secp384r1_Params>;
pub type Secp384r1Scalar = ScalarField<SECP384r1_SCALAR_SLICES>;
pub type Secp384r1Fq = BigNum<4, 384, Secp384r1_Fq_Params>;
Expand Down
2 changes: 1 addition & 1 deletion src/curves/vesta.nr
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl CurveParamsTrait<BigNum<3, 255, Vesta_Fq_Params>> for Vesta_Params {
}
}

pub global VESTA_SCALAR_SLICES = 64;
pub global VESTA_SCALAR_SLICES: u32 = 64;
pub type Vesta = BigCurve<BigNum<3, 255, Vesta_Fq_Params>, Vesta_Params>;
pub type VestaScalar = ScalarField<VESTA_SCALAR_SLICES>;
pub type VestaFq = BigNum<3, 255, Vesta_Fq_Params>;
Expand Down