From 945c414283a69259e7eb2fb68b03e621841b3560 Mon Sep 17 00:00:00 2001 From: arnaucube Date: Wed, 19 Oct 2022 21:52:58 +0200 Subject: [PATCH] Add GHA test checks & clippy --- .github/workflows/clippy.yml | 11 +++++++++++ .github/workflows/test.yml | 14 ++++++++++++++ README.md | 5 +++-- src/constraints.rs | 2 ++ src/lib.rs | 3 ++- 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/clippy.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 0000000..5336688 --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,11 @@ +name: Clippy +on: [push, pull_request] +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: rustup component add clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fa79d12 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Test +on: [push, pull_request] +env: + CARGO_TERM_COLOR: always +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + - name: Run tests + run: | + cargo test --verbose diff --git a/README.md b/README.md index 1dad852..e357421 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -# ark-ec-blind-signatures -Blind signatures over elliptic curve implementation (native & r1cs gadgets) using arkworks. +# ark-ec-blind-signatures [![Test](https://github.com/aragonzkresearch/ark-ec-blind-signatures/workflows/Test/badge.svg)](https://github.com/aragonzkresearch/ark-ec-blind-signatures/actions?query=workflow%3ATest) [![Clippy](https://github.com/aragonzkresearch/ark-ec-blind-signatures/workflows/Clippy/badge.svg)](https://github.com/aragonzkresearch/ark-ec-blind-signatures/actions?query=workflow%3AClippy) + +Blind signatures over elliptic curve implementation (native & r1cs constraints) using arkworks. [Blind signature](https://en.wikipedia.org/wiki/Blind_signature) over elliptic curves, based on *"[New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem](https://sci-hub.st/10.1109/iccke.2013.6682844)"* paper by Hamid Mala & Nafiseh Nezhadansari. diff --git a/src/constraints.rs b/src/constraints.rs index 6fceb7a..3abac5e 100644 --- a/src/constraints.rs +++ b/src/constraints.rs @@ -89,6 +89,7 @@ where // let s = val.borrow().s; let mut s = Vec::>>::new(); let s_bytes = to_bytes![val.borrow().s].unwrap(); + #[allow(clippy::needless_range_loop)] for i in 0..s_bytes.len() { s.push(UInt8::>::new_variable( cs.clone(), @@ -236,6 +237,7 @@ where SignatureVar::::new_witness(ark_relations::ns!(cs, "signature"), || { self.signature.ok_or(SynthesisError::AssignmentMissing) })?; + #[allow(clippy::redundant_clone)] let poseidon_hash = PoseidonGadget::>::from_native( &mut cs.clone(), self.poseidon_hash_native, diff --git a/src/lib.rs b/src/lib.rs index c141b16..2fbc236 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,8 +136,9 @@ where ::ScalarField: From, { let u = Self::new_blind_params(parameters, rng, signer_r); + // get X coordinate, as in new_blind_params we already checked that R.x is inside Fr and - // will not give None + // will not overflow (giving None) let r = EdwardsAffine::from(u.r); // WIP let x_fr = C::ScalarField::from(r.x.into_repr());