Skip to content

Commit

Permalink
Merge pull request #18 from noir-lang/tf/update-to-le-bytes
Browse files Browse the repository at this point in the history
chore: update to noir 0.34.0
  • Loading branch information
TomAFrench authored Sep 13, 2024
2 parents 79cd220 + 06d20cf commit 625cca6
Show file tree
Hide file tree
Showing 41 changed files with 142 additions and 135 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toolchain: [nightly, 0.32.0]
toolchain: [nightly, 0.34.0]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Install Nargo
uses: noir-lang/noirup@v0.1.3
with:
toolchain: 0.32.0
toolchain: 0.34.0

- name: Run formatter
run: nargo fmt --check
4 changes: 2 additions & 2 deletions Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name = "bignum"
type = "lib"
authors = [""]
compiler_version = ">=0.32.0"
compiler_version = ">=0.34.0"

[dependencies]
[dependencies]
123 changes: 61 additions & 62 deletions src/bignum_test.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::utils::arrayX::ArrayX;
use crate::BigNum;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::BigNumParamsTrait as BigNumParamsTrait;
Expand All @@ -18,67 +17,67 @@ impl RuntimeBigNumParamsTrait<18> for Test2048Params {
}
impl BigNumParamsTrait<18> for Test2048Params {
fn get_instance() -> BigNumInstance<18, Self> {
let modulus: [Field; 18] = [
0x0000000000000000000000000000000000c0a197a5ae0fcdceb052c9732614fe,
0x0000000000000000000000000000000000656ae034423283422243918ab83be3,
0x00000000000000000000000000000000006bf590da48a7c1070b7d5aabaac678,
0x00000000000000000000000000000000000cce39f530238b606f24b296e2bda9,
0x000000000000000000000000000000000001e1fef9bb9c1c3ead98f226f1bfa0,
0x0000000000000000000000000000000000ad8c1c816e12e0ed1379055e373abf,
0x0000000000000000000000000000000000cebe80e474f753aa9d1461c435123d,
0x0000000000000000000000000000000000aee5a18ceedef88d115a8b93c167ad,
0x0000000000000000000000000000000000268ba83c4a65c4307427fc495d9e44,
0x0000000000000000000000000000000000dd2777926848667b7df79f342639d4,
0x0000000000000000000000000000000000f455074c96855ca0068668efe7da3d,
0x00000000000000000000000000000000005ddba6b30bbc168bfb3a1225f27d65,
0x0000000000000000000000000000000000591fec484f36707524133bcd6f4258,
0x000000000000000000000000000000000059641b756766aeebe66781dd01d062,
0x000000000000000000000000000000000058bc5eaff4b165e142bf9e2480eebb,
0x0000000000000000000000000000000000667a3964f08e06df772ce64b229a72,
0x00000000000000000000000000000000009c1fdb18907711bfe3e3c1cf918395,
0x00000000000000000000000000000000000000000000000000000000000000b8
];
// fn double_modulus() -> [Field; 18] {[
// 0x000000000000000000000000000000000181432f4b5c1f9b9d60a592e64c29fc,
// 0x0000000000000000000000000000000001cad5c06884650684448723157077c6,
// 0x0000000000000000000000000000000001d7eb21b4914f820e16fab557558cef,
// 0x0000000000000000000000000000000001199c73ea604716c0de49652dc57b51,
// 0x000000000000000000000000000000000103c3fdf37738387d5b31e44de37f3f,
// 0x00000000000000000000000000000000015b183902dc25c1da26f20abc6e757d,
// 0x00000000000000000000000000000000019d7d01c8e9eea7553a28c3886a247a,
// 0x00000000000000000000000000000000015dcb4319ddbdf11a22b5172782cf5a,
// 0x00000000000000000000000000000000014d17507894cb8860e84ff892bb3c88,
// 0x0000000000000000000000000000000001ba4eef24d090ccf6fbef3e684c73a7,
// 0x0000000000000000000000000000000001e8aa0e992d0ab9400d0cd1dfcfb47a,
// 0x0000000000000000000000000000000001bbb74d6617782d17f674244be4faca,
// 0x0000000000000000000000000000000001b23fd8909e6ce0ea4826779ade84af,
// 0x0000000000000000000000000000000001b2c836eacecd5dd7cccf03ba03a0c3,
// 0x0000000000000000000000000000000001b178bd5fe962cbc2857f3c4901dd75,
// 0x0000000000000000000000000000000001ccf472c9e11c0dbeee59cc964534e3,
// 0x0000000000000000000000000000000001383fb63120ee237fc7c7839f230729,
// 0x0000000000000000000000000000000000000000000000000000000000000170
// ]}
let redc_param: [Field; 18] = [
0x000000000000000000000000000000000091697def7100cd5cf8d890b4ef2ec3,
0x00000000000000000000000000000000006765ba8304214dac764d3f4adc3185,
0x000000000000000000000000000000000048404bd14d927ea230e60d4bebf940,
0x00000000000000000000000000000000007c4d53a23bacc251ecbfc4b7ba5a0b,
0x000000000000000000000000000000000093eaf3499474a6f5b2fff83f1259c8,
0x00000000000000000000000000000000005bff4c737b97281f1a5f2384a8c16d,
0x000000000000000000000000000000000061b4cf2f55358476b5323782999055,
0x00000000000000000000000000000000001e7a804e8eacfe3a2a5673bc3885b8,
0x0000000000000000000000000000000000eabadeae4282906c817adf70eab4ae,
0x0000000000000000000000000000000000166f7df257fe2bf27f0809aceed9b0,
0x00000000000000000000000000000000007d90fb7428901b8bed11f6b81e36bf,
0x0000000000000000000000000000000000f36e6ba885c60b7024c563605df7e0,
0x000000000000000000000000000000000052b7c58d2fb5d2c8478963ae6d4a44,
0x000000000000000000000000000000000036ee761de26635f114ccc3f7d74f85,
0x0000000000000000000000000000000000e3fb726a10cf2220897513f05243de,
0x0000000000000000000000000000000000f43a26bbd732496eb4d828591b8056,
0x0000000000000000000000000000000000ff4e42304e60fb3a54fca735499f2c,
0x0000000000000000000000000000000000000000000000000000000000000162
];
BigNumInstance::new(modulus, redc_param)
let modulus: [Field; 18] = [
0x0000000000000000000000000000000000c0a197a5ae0fcdceb052c9732614fe,
0x0000000000000000000000000000000000656ae034423283422243918ab83be3,
0x00000000000000000000000000000000006bf590da48a7c1070b7d5aabaac678,
0x00000000000000000000000000000000000cce39f530238b606f24b296e2bda9,
0x000000000000000000000000000000000001e1fef9bb9c1c3ead98f226f1bfa0,
0x0000000000000000000000000000000000ad8c1c816e12e0ed1379055e373abf,
0x0000000000000000000000000000000000cebe80e474f753aa9d1461c435123d,
0x0000000000000000000000000000000000aee5a18ceedef88d115a8b93c167ad,
0x0000000000000000000000000000000000268ba83c4a65c4307427fc495d9e44,
0x0000000000000000000000000000000000dd2777926848667b7df79f342639d4,
0x0000000000000000000000000000000000f455074c96855ca0068668efe7da3d,
0x00000000000000000000000000000000005ddba6b30bbc168bfb3a1225f27d65,
0x0000000000000000000000000000000000591fec484f36707524133bcd6f4258,
0x000000000000000000000000000000000059641b756766aeebe66781dd01d062,
0x000000000000000000000000000000000058bc5eaff4b165e142bf9e2480eebb,
0x0000000000000000000000000000000000667a3964f08e06df772ce64b229a72,
0x00000000000000000000000000000000009c1fdb18907711bfe3e3c1cf918395,
0x00000000000000000000000000000000000000000000000000000000000000b8
];
// fn double_modulus() -> [Field; 18] {[
// 0x000000000000000000000000000000000181432f4b5c1f9b9d60a592e64c29fc,
// 0x0000000000000000000000000000000001cad5c06884650684448723157077c6,
// 0x0000000000000000000000000000000001d7eb21b4914f820e16fab557558cef,
// 0x0000000000000000000000000000000001199c73ea604716c0de49652dc57b51,
// 0x000000000000000000000000000000000103c3fdf37738387d5b31e44de37f3f,
// 0x00000000000000000000000000000000015b183902dc25c1da26f20abc6e757d,
// 0x00000000000000000000000000000000019d7d01c8e9eea7553a28c3886a247a,
// 0x00000000000000000000000000000000015dcb4319ddbdf11a22b5172782cf5a,
// 0x00000000000000000000000000000000014d17507894cb8860e84ff892bb3c88,
// 0x0000000000000000000000000000000001ba4eef24d090ccf6fbef3e684c73a7,
// 0x0000000000000000000000000000000001e8aa0e992d0ab9400d0cd1dfcfb47a,
// 0x0000000000000000000000000000000001bbb74d6617782d17f674244be4faca,
// 0x0000000000000000000000000000000001b23fd8909e6ce0ea4826779ade84af,
// 0x0000000000000000000000000000000001b2c836eacecd5dd7cccf03ba03a0c3,
// 0x0000000000000000000000000000000001b178bd5fe962cbc2857f3c4901dd75,
// 0x0000000000000000000000000000000001ccf472c9e11c0dbeee59cc964534e3,
// 0x0000000000000000000000000000000001383fb63120ee237fc7c7839f230729,
// 0x0000000000000000000000000000000000000000000000000000000000000170
// ]}
let redc_param: [Field; 18] = [
0x000000000000000000000000000000000091697def7100cd5cf8d890b4ef2ec3,
0x00000000000000000000000000000000006765ba8304214dac764d3f4adc3185,
0x000000000000000000000000000000000048404bd14d927ea230e60d4bebf940,
0x00000000000000000000000000000000007c4d53a23bacc251ecbfc4b7ba5a0b,
0x000000000000000000000000000000000093eaf3499474a6f5b2fff83f1259c8,
0x00000000000000000000000000000000005bff4c737b97281f1a5f2384a8c16d,
0x000000000000000000000000000000000061b4cf2f55358476b5323782999055,
0x00000000000000000000000000000000001e7a804e8eacfe3a2a5673bc3885b8,
0x0000000000000000000000000000000000eabadeae4282906c817adf70eab4ae,
0x0000000000000000000000000000000000166f7df257fe2bf27f0809aceed9b0,
0x00000000000000000000000000000000007d90fb7428901b8bed11f6b81e36bf,
0x0000000000000000000000000000000000f36e6ba885c60b7024c563605df7e0,
0x000000000000000000000000000000000052b7c58d2fb5d2c8478963ae6d4a44,
0x000000000000000000000000000000000036ee761de26635f114ccc3f7d74f85,
0x0000000000000000000000000000000000e3fb726a10cf2220897513f05243de,
0x0000000000000000000000000000000000f43a26bbd732496eb4d828591b8056,
0x0000000000000000000000000000000000ff4e42304e60fb3a54fca735499f2c,
0x0000000000000000000000000000000000000000000000000000000000000162
];
BigNumInstance::new(modulus, redc_param)
}
fn modulus_bits() -> u32 {
2048
Expand Down
2 changes: 1 addition & 1 deletion src/fields.nr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod U4096;
mod U8192;

use crate::BigNum;
use crate::runtime_bignum::BigNumInstance;
pub use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::fields::bn254Fq::BNParams;

Expand Down
9 changes: 6 additions & 3 deletions src/fields/U1024.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -10,7 +9,9 @@ impl RuntimeBigNumParamsTrait<9> for U1024Params {
fn modulus_bits() -> u32 {
1025
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<9> for U1024Params {
fn get_instance() -> BigNumInstance<9, Self> {
Expand All @@ -19,7 +20,9 @@ impl BigNumParamsTrait<9> for U1024Params {
fn modulus_bits() -> u32 {
1025
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U1024_Instance: BigNumInstance<9, U1024Params> = BigNumInstance {
modulus: [
Expand Down
9 changes: 6 additions & 3 deletions src/fields/U2048.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -10,7 +9,9 @@ impl RuntimeBigNumParamsTrait<18> for U2048Params {
fn modulus_bits() -> u32 {
2049
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<18> for U2048Params {
fn get_instance() -> BigNumInstance<18, Self> {
Expand All @@ -19,7 +20,9 @@ impl BigNumParamsTrait<18> for U2048Params {
fn modulus_bits() -> u32 {
2049
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U2048_Instance: BigNumInstance<18, U2048Params> = BigNumInstance {
modulus: [
Expand Down
9 changes: 6 additions & 3 deletions src/fields/U256.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -10,7 +9,9 @@ impl RuntimeBigNumParamsTrait<3> for U256Params {
fn modulus_bits() -> u32 {
257
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<3> for U256Params {
fn get_instance() -> BigNumInstance<3, Self> {
Expand All @@ -19,7 +20,9 @@ impl BigNumParamsTrait<3> for U256Params {
fn modulus_bits() -> u32 {
257
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U256_Instance: BigNumInstance<3, U256Params> = BigNumInstance {
modulus: [
Expand Down
9 changes: 6 additions & 3 deletions src/fields/U384.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -10,7 +9,9 @@ impl RuntimeBigNumParamsTrait<4> for U384_Params {
fn modulus_bits() -> u32 {
385
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<4> for U384_Params {
fn get_instance() -> BigNumInstance<4, Self> {
Expand All @@ -19,7 +20,9 @@ impl BigNumParamsTrait<4> for U384_Params {
fn modulus_bits() -> u32 {
385
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U384_Instance: BigNumInstance<4, U384_Params> = BigNumInstance {
modulus: [
Expand Down
9 changes: 6 additions & 3 deletions src/fields/U4096.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -10,7 +9,9 @@ impl RuntimeBigNumParamsTrait<35> for U4096Params {
fn modulus_bits() -> u32 {
4097
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<35> for U4096Params {
fn get_instance() -> BigNumInstance<35, Self> {
Expand All @@ -19,7 +20,9 @@ impl BigNumParamsTrait<35> for U4096Params {
fn modulus_bits() -> u32 {
4097
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U4096_Instance: BigNumInstance<35, U4096Params> = BigNumInstance {
modulus: [
Expand Down
9 changes: 6 additions & 3 deletions src/fields/U512.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -13,7 +12,9 @@ impl RuntimeBigNumParamsTrait<5> for U512Params {
fn modulus_bits() -> u32 {
513
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<5> for U512Params {
fn get_instance() -> BigNumInstance<5, Self> {
Expand All @@ -22,7 +23,9 @@ impl BigNumParamsTrait<5> for U512Params {
fn modulus_bits() -> u32 {
513
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U512_Instance: BigNumInstance<5, U512Params> = BigNumInstance {
modulus: [
Expand Down
9 changes: 6 additions & 3 deletions src/fields/U768.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -10,7 +9,9 @@ impl RuntimeBigNumParamsTrait<13> for U768Params {
fn modulus_bits() -> u32 {
1537
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<13> for U768Params {
fn get_instance() -> BigNumInstance<13, Self> {
Expand All @@ -19,7 +20,9 @@ impl BigNumParamsTrait<13> for U768Params {
fn modulus_bits() -> u32 {
1537
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U768_Instance: BigNumInstance<13, U768Params> = BigNumInstance {
modulus: [
Expand Down
9 changes: 6 additions & 3 deletions src/fields/U8192.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::BigNum;
use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand All @@ -10,7 +9,9 @@ impl RuntimeBigNumParamsTrait<69> for U8192Params {
fn modulus_bits() -> u32 {
8193
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
impl BigNumParamsTrait<69> for U8192Params {
fn get_instance() -> BigNumInstance<69, Self> {
Expand All @@ -19,7 +20,9 @@ impl BigNumParamsTrait<69> for U8192Params {
fn modulus_bits() -> u32 {
8193
}
fn has_multiplicative_inverse() -> bool { false }
fn has_multiplicative_inverse() -> bool {
false
}
}
global U8192_Instance: BigNumInstance<69, U8192Params> = BigNumInstance {
modulus: [
Expand Down
2 changes: 1 addition & 1 deletion src/fields/bls12_377Fq.nr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! * G1 curve equation: y^2 = x^3 + 1
//! * G2 curve equation: y^2 = x^3 + B, where
//! * B = Fq2(0, 155198655607781456406391640216936120121836107652948796323930557600032281009004493664981332883744016074664192874906)
use crate::BigNum;

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
Expand Down
Loading

0 comments on commit 625cca6

Please sign in to comment.