Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 113a06b

Browse files
authored
feat: add initial implementation (#1)
Release-as: 0.1.0
1 parent 1522d7b commit 113a06b

File tree

10 files changed

+1683
-80
lines changed

10 files changed

+1683
-80
lines changed

.github/workflows/benchmark.yml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
name: Benchmarks
2-
3-
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
8-
9-
jobs:
10-
test:
11-
name: Benchmark library
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout sources
15-
uses: actions/checkout@v4
16-
17-
- name: Install Nargo
18-
uses: noir-lang/[email protected]
19-
with:
20-
toolchain: 0.34.0
21-
22-
- name: Install bb
23-
run: |
24-
npm install -g bbup
25-
bbup -nv 0.34.0
26-
27-
- name: Build Noir benchmark programs
28-
run: nargo export
29-
30-
- name: Generate gates report
31-
run: ./scripts/build-gates-report.sh
32-
env:
33-
BACKEND: /home/runner/.bb/bb
34-
35-
- name: Compare gates reports
36-
id: gates_diff
37-
uses: noir-lang/noir-gates-diff@1931aaaa848a1a009363d6115293f7b7fc72bb87
38-
with:
39-
report: gates_report.json
40-
summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%)
41-
42-
- name: Add gates diff to sticky comment
43-
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
44-
uses: marocchino/sticky-pull-request-comment@v2
45-
with:
46-
# delete the comment in case changes no longer impact circuit sizes
47-
delete: ${{ !steps.gates_diff.outputs.markdown }}
48-
message: ${{ steps.gates_diff.outputs.markdown }}
1+
# name: Benchmarks
2+
3+
# on:
4+
# push:
5+
# branches:
6+
# - master
7+
# pull_request:
8+
9+
# jobs:
10+
# test:
11+
# name: Benchmark library
12+
# runs-on: ubuntu-latest
13+
# steps:
14+
# - name: Checkout sources
15+
# uses: actions/checkout@v4
16+
17+
# - name: Install Nargo
18+
# uses: noir-lang/[email protected]
19+
# with:
20+
# toolchain: 0.36.0
21+
22+
# - name: Install bb
23+
# run: |
24+
# npm install -g bbup
25+
# bbup -nv 0.36.0
26+
27+
# - name: Build Noir benchmark programs
28+
# run: nargo export
29+
30+
# - name: Generate gates report
31+
# run: ./scripts/build-gates-report.sh
32+
# env:
33+
# BACKEND: /home/runner/.bb/bb
34+
35+
# - name: Compare gates reports
36+
# id: gates_diff
37+
# uses: noir-lang/noir-gates-diff@1931aaaa848a1a009363d6115293f7b7fc72bb87
38+
# with:
39+
# report: gates_report.json
40+
# summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%)
41+
42+
# - name: Add gates diff to sticky comment
43+
# if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
44+
# uses: marocchino/sticky-pull-request-comment@v2
45+
# with:
46+
# # delete the comment in case changes no longer impact circuit sizes
47+
# delete: ${{ !steps.gates_diff.outputs.markdown }}
48+
# message: ${{ steps.gates_diff.outputs.markdown }}

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
toolchain: [nightly, 0.34.0]
19+
toolchain: [nightly, 0.36.0]
2020
steps:
2121
- name: Checkout sources
2222
uses: actions/checkout@v4
@@ -38,7 +38,7 @@ jobs:
3838
- name: Install Nargo
3939
uses: noir-lang/[email protected]
4040
with:
41-
toolchain: 0.34.0
41+
toolchain: 0.36.0
4242

4343
- name: Run formatter
4444
run: nargo fmt --check

Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
name = "noir_library"
33
type = "lib"
44
authors = [""]
5-
compiler_version = ">=0.34.0"
5+
compiler_version = ">=0.36.0"
66

77
[dependencies]

README.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
# noir-library-starter
1+
# ec
22

3-
This repository is a template used by the noir-lang org when creating internally maintained libraries.
4-
5-
This provides out of the box:
6-
7-
- A simple CI setup to test and format the library
8-
- A canary flagging up compilation failures on nightly releases.
9-
- A [release-please](https://github.com/googleapis/release-please) setup to ease creating releases for the library.
10-
11-
Feel free to use this template as a starting point to create your own Noir libraries.
12-
13-
---
14-
15-
# LIBRARY_NAME
16-
17-
Add a brief description of the library
3+
A library which exports the ec module which formerly existed within the Noir stdlib.
184

195
## Benchmarks
206

@@ -27,11 +13,11 @@ In your _Nargo.toml_ file, add the version of this library you would like to ins
2713

2814
```
2915
[dependencies]
30-
LIBRARY = { tag = "v0.1.0", git = "https://github.com/noir-lang/LIBRARY_NAME" }
16+
ec = { tag = "v0.1.0", git = "https://github.com/noir-lang/ec" }
3117
```
3218

3319
## `library`
3420

3521
### Usage
3622

37-
`PLACEHOLDER`
23+
`PLACEHOLDER`

src/consts/mod.nr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod te;

src/consts/te.nr

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use std::ec::tecurve::affine::Curve as TECurve;
2+
use std::ec::tecurve::affine::Point as TEPoint;
3+
4+
pub struct BabyJubjub {
5+
pub curve: TECurve,
6+
pub base8: TEPoint,
7+
pub suborder: Field,
8+
}
9+
10+
#[field(bn254)]
11+
// Uncommenting this results in deprecated warnings in the stdlib
12+
// #[deprecated]
13+
pub fn baby_jubjub() -> BabyJubjub {
14+
BabyJubjub {
15+
// Baby Jubjub (ERC-2494) parameters in affine representation
16+
curve: TECurve::new(
17+
168700,
18+
168696,
19+
// G
20+
TEPoint::new(
21+
995203441582195749578291179787384436505546430278305826713579947235728471134,
22+
5472060717959818805561601436314318772137091100104008585924551046643952123905,
23+
),
24+
),
25+
// [8]G precalculated
26+
base8: TEPoint::new(
27+
5299619240641551281634865583518297030282874472190772894086521144482721001553,
28+
16950150798460657717958625567821834550301663161624707787222815936182638968203,
29+
),
30+
// The size of the group formed from multiplying the base field by 8.
31+
suborder: 2736030358979909402780800718157159386076813972158567259200215660948447373041,
32+
}
33+
}

0 commit comments

Comments
 (0)