Skip to content

Commit

Permalink
feat: add initial implementation (#1)
Browse files Browse the repository at this point in the history
Release-as: 0.1.0
  • Loading branch information
TomAFrench authored Nov 21, 2024
1 parent 1522d7b commit 113a06b
Show file tree
Hide file tree
Showing 10 changed files with 1,683 additions and 80 deletions.
96 changes: 48 additions & 48 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
name: Benchmarks

on:
push:
branches:
- master
pull_request:

jobs:
test:
name: Benchmark library
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Nargo
uses: noir-lang/[email protected]
with:
toolchain: 0.34.0

- name: Install bb
run: |
npm install -g bbup
bbup -nv 0.34.0
- name: Build Noir benchmark programs
run: nargo export

- name: Generate gates report
run: ./scripts/build-gates-report.sh
env:
BACKEND: /home/runner/.bb/bb

- name: Compare gates reports
id: gates_diff
uses: noir-lang/noir-gates-diff@1931aaaa848a1a009363d6115293f7b7fc72bb87
with:
report: gates_report.json
summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%)

- name: Add gates diff to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
# delete the comment in case changes no longer impact circuit sizes
delete: ${{ !steps.gates_diff.outputs.markdown }}
message: ${{ steps.gates_diff.outputs.markdown }}
# name: Benchmarks

# on:
# push:
# branches:
# - master
# pull_request:

# jobs:
# test:
# name: Benchmark library
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v4

# - name: Install Nargo
# uses: noir-lang/[email protected]
# with:
# toolchain: 0.36.0

# - name: Install bb
# run: |
# npm install -g bbup
# bbup -nv 0.36.0

# - name: Build Noir benchmark programs
# run: nargo export

# - name: Generate gates report
# run: ./scripts/build-gates-report.sh
# env:
# BACKEND: /home/runner/.bb/bb

# - name: Compare gates reports
# id: gates_diff
# uses: noir-lang/noir-gates-diff@1931aaaa848a1a009363d6115293f7b7fc72bb87
# with:
# report: gates_report.json
# summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%)

# - name: Add gates diff to sticky comment
# if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
# uses: marocchino/sticky-pull-request-comment@v2
# with:
# # delete the comment in case changes no longer impact circuit sizes
# delete: ${{ !steps.gates_diff.outputs.markdown }}
# message: ${{ steps.gates_diff.outputs.markdown }}
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.34.0]
toolchain: [nightly, 0.36.0]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Install Nargo
uses: noir-lang/[email protected]
with:
toolchain: 0.34.0
toolchain: 0.36.0

- name: Run formatter
run: nargo fmt --check
Expand Down
2 changes: 1 addition & 1 deletion Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name = "noir_library"
type = "lib"
authors = [""]
compiler_version = ">=0.34.0"
compiler_version = ">=0.36.0"

[dependencies]
22 changes: 4 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# noir-library-starter
# ec

This repository is a template used by the noir-lang org when creating internally maintained libraries.

This provides out of the box:

- A simple CI setup to test and format the library
- A canary flagging up compilation failures on nightly releases.
- A [release-please](https://github.com/googleapis/release-please) setup to ease creating releases for the library.

Feel free to use this template as a starting point to create your own Noir libraries.

---

# LIBRARY_NAME

Add a brief description of the library
A library which exports the ec module which formerly existed within the Noir stdlib.

## Benchmarks

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

```
[dependencies]
LIBRARY = { tag = "v0.1.0", git = "https://github.com/noir-lang/LIBRARY_NAME" }
ec = { tag = "v0.1.0", git = "https://github.com/noir-lang/ec" }
```

## `library`

### Usage

`PLACEHOLDER`
`PLACEHOLDER`
1 change: 1 addition & 0 deletions src/consts/mod.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod te;
33 changes: 33 additions & 0 deletions src/consts/te.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use std::ec::tecurve::affine::Curve as TECurve;
use std::ec::tecurve::affine::Point as TEPoint;

pub struct BabyJubjub {
pub curve: TECurve,
pub base8: TEPoint,
pub suborder: Field,
}

#[field(bn254)]
// Uncommenting this results in deprecated warnings in the stdlib
// #[deprecated]
pub fn baby_jubjub() -> BabyJubjub {
BabyJubjub {
// Baby Jubjub (ERC-2494) parameters in affine representation
curve: TECurve::new(
168700,
168696,
// G
TEPoint::new(
995203441582195749578291179787384436505546430278305826713579947235728471134,
5472060717959818805561601436314318772137091100104008585924551046643952123905,
),
),
// [8]G precalculated
base8: TEPoint::new(
5299619240641551281634865583518297030282874472190772894086521144482721001553,
16950150798460657717958625567821834550301663161624707787222815936182638968203,
),
// The size of the group formed from multiplying the base field by 8.
suborder: 2736030358979909402780800718157159386076813972158567259200215660948447373041,
}
}
Loading

0 comments on commit 113a06b

Please sign in to comment.