Skip to content

Commit

Permalink
fix!: update to support Noir 0.37.0 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
kashbrti authored Nov 4, 2024
1 parent 3188ea7 commit a8156aa
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
27 changes: 25 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.36.0]
toolchain: [nightly, 0.37.0]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -38,7 +38,30 @@ jobs:
- name: Install Nargo
uses: noir-lang/[email protected]
with:
toolchain: 0.36.0
toolchain: 0.37.0

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

# This is a job which depends on all test jobs and reports the overall status.
# This allows us to add/remove test jobs without having to update the required workflows.
tests-end:
name: Noir End
runs-on: ubuntu-latest
# We want this job to always run (even if the dependant jobs fail) as we want this job to fail rather than skipping.
if: ${{ always() }}
needs:
- test
- format

steps:
- name: Report overall success
run: |
if [[ $FAIL == true ]]; then
exit 1
else
exit 0
fi
env:
# We treat any cancelled, skipped or failing jobs as a failure for the workflow as a whole.
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
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 = "edwards"
type = "lib"
authors = [""]
compiler_version = ">=0.36.0"
compiler_version = ">=0.37.0"

[dependencies]
2 changes: 1 addition & 1 deletion src/bjj.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::TECurveParameterTrait;
use crate::Curve;
use crate::TECurveParameterTrait;

pub struct BabyJubJubParams {}
impl TECurveParameterTrait for BabyJubJubParams {
Expand Down
20 changes: 4 additions & 16 deletions src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ trait TECurveParameterTrait {
}

/// Defines methods that a valid Curve implementation must satisfy
trait CurveTrait<Params>
where
CurveTrait<Params>: std::ops::Add + std::ops::Sub + std::ops::Eq + std::ops::Neg,
{
trait CurveTrait<Params>: std::ops::Add + std::ops::Sub + std::cmp::Eq + std::ops::Neg {
fn default() -> Self {
std::default::Default::default()
}
Expand Down Expand Up @@ -91,10 +88,7 @@ where
}
}

impl<Params> std::ops::Neg for Curve<Params>
where
Params: TECurveParameterTrait,
{
impl<Params> std::ops::Neg for Curve<Params> {
/// Negate a point
///
/// Cost: usually 0, will cost 1 gate if the `x` coordinate needs to be converted into a witness
Expand All @@ -115,10 +109,7 @@ where
}
}

impl<Params> std::cmp::Eq for Curve<Params>
where
Params: TECurveParameterTrait,
{
impl<Params> std::cmp::Eq for Curve<Params> {
/// Compute `self == other`
///
/// Cost: 6 gates
Expand All @@ -127,10 +118,7 @@ where
}
}

impl<Params> std::convert::From<(Field, Field)> for Curve<Params>
where
Params: TECurveParameterTrait,
{
impl<Params> std::convert::From<(Field, Field)> for Curve<Params> {
/// Construct from tuple of field elements
///
/// Use this method instead of `new` if you know x/y is on the curve
Expand Down
4 changes: 2 additions & 2 deletions src/test.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::scalar_field::ScalarField;
use crate::Curve;
use crate::bjj::BabyJubJubParams;
use crate::Curve;
use crate::scalar_field::ScalarField;
use std::ec::consts::te::baby_jubjub;
use std::ec::tecurve::affine::Point as TEPoint;

Expand Down

0 comments on commit a8156aa

Please sign in to comment.