diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9635bb9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,13 @@ +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/.travis.yml b/.travis.yml deleted file mode 100644 index 9f108b7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: rust -rust: -- stable - -cache: -- cargo - -script: -- RUST_BACKTRACE=1 cargo test --all diff --git a/Cargo.toml b/Cargo.toml index 145532c..093f4ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "babyjubjub-rs" -version = "0.0.3" +version = "0.0.4" authors = ["arnaucube "] edition = "2018" license = "GPL-3.0" @@ -19,8 +19,7 @@ blake2 = "0.8" generic-array = "0.13.2" tiny-keccak = "1.5" rustc-hex = "1.0.0" -mimc-rs = "0.0.2" -poseidon-rs = "0.0.4" +poseidon-rs = "0.0.5" arrayref = "0.3.5" lazy_static = "1.4.0" diff --git a/README.md b/README.md index 2d29bbf..3917dde 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# babyjubjub-rs [![Crates.io](https://img.shields.io/crates/v/babyjubjub-rs.svg)](https://crates.io/crates/babyjubjub-rs) [![Build Status](https://travis-ci.org/arnaucube/babyjubjub-rs.svg?branch=master)](https://travis-ci.org/arnaucube/babyjubjub-rs) +# babyjubjub-rs [![Crates.io](https://img.shields.io/crates/v/babyjubjub-rs.svg)](https://crates.io/crates/babyjubjub-rs) [![Test](https://github.com/arnaucube/babyjubjub-rs/workflows/Test/badge.svg)](https://github.com/arnaucube/babyjubjub-rs/actions?query=workflow%3ATest) + BabyJubJub elliptic curve implementation in Rust. A twisted edwards curve embedded in the curve of BN128/BN256. BabyJubJub curve explanation: https://medium.com/zokrates/efficient-ecc-in-zksnarks-using-zokrates-bd9ae37b8186 @@ -11,17 +12,7 @@ Compatible with the BabyJubJub implementations in: - circom & javascript, from https://github.com/iden3/circomlib ## Warning -Doing this in my free time to get familiar with Rust, **do not use in production**. - -- [x] point addition -- [x] point scalar multiplication -- [x] eddsa keys generation -- [x] eddsa signature -- [x] eddsa signature verification -- [x] {point, pk, signature} compress&decompress parsers - - - +Doing this in my free time, **do not use in production**. ### References - BabyJubJub curve explanation: https://medium.com/zokrates/efficient-ecc-in-zksnarks-using-zokrates-bd9ae37b8186 diff --git a/src/lib.rs b/src/lib.rs index c19e39f..5e13470 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,6 @@ pub type Fr = poseidon_rs::Fr; // alias #[macro_use] extern crate arrayref; extern crate generic_array; -extern crate mimc_rs; extern crate num; extern crate num_bigint; extern crate num_traits; @@ -20,7 +19,6 @@ extern crate rand6; use rand6::Rng; use blake2::{Blake2b, Digest}; -use mimc_rs::Mimc7; use std::cmp::min; use num_bigint::{BigInt, RandBigInt, RandomBits, Sign, ToBigInt}; @@ -554,26 +552,6 @@ mod tests { ); } - // #[test] - // fn test_new_key_sign_verify_mimc_0() { - // let sk = new_key(); - // let pk = sk.public().unwrap(); - // let msg = 5.to_bigint().unwrap(); - // let sig = sk.sign_mimc(msg.clone()).unwrap(); - // let v = verify_mimc(pk, sig, msg); - // assert_eq!(v, true); - // } - // - // #[test] - // fn test_new_key_sign_verify_mimc_1() { - // let sk = new_key(); - // let pk = sk.public().unwrap(); - // let msg = BigInt::parse_bytes(b"123456789012345678901234567890", 10).unwrap(); - // let sig = sk.sign_mimc(msg.clone()).unwrap(); - // let v = verify_mimc(pk, sig, msg); - // assert_eq!(v, true); - // } - #[test] fn test_new_key_sign_verify_0() { let sk = new_key();