Skip to content

Commit

Permalink
Support for stable Rust (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleganza authored May 1, 2020
1 parent 9c798f5 commit d287c7a
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 52 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/check-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Rust

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
check-stable:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install the stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Run tests
run: cargo test --features="yoloproofs" --verbose
- name: Build benchmarks
run: cargo bench --features="yoloproofs" --verbose DONTRUNBENCHMARKS

check-nightly:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install the nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Run tests
run: cargo test --features="std,nightly,yoloproofs" --verbose
- name: Build benchmarks
run: cargo bench --features="std,nightly,yoloproofs" --verbose DONTRUNBENCHMARKS
43 changes: 43 additions & 0 deletions .github/workflows/check-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Rust

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
check-stable:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install the stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Run tests
run: cargo test --verbose
- name: Build benchmarks
run: cargo bench --verbose DONTRUNBENCHMARKS

check-nightly:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install the nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Run tests
run: cargo test --features="std,nightly" --verbose
- name: Build benchmarks
run: cargo bench --features="std,nightly" --verbose DONTRUNBENCHMARKS
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ description = "A pure-Rust implementation of Bulletproofs using Ristretto"
edition = "2018"

[dependencies]
curve25519-dalek = { version = "2", default-features = false, features = ["u64_backend", "nightly", "serde", "alloc"] }
curve25519-dalek = { version = "2", default-features = false, features = ["u64_backend", "serde"] }
subtle = { version = "2", default-features = false }
sha3 = { version = "0.8", default-features = false }
digest = { version = "0.8", default-features = false }
Expand All @@ -29,7 +29,7 @@ serde = { version = "1", default-features = false, features = ["alloc"] }
serde_derive = { version = "1", default-features = false }
thiserror = { version = "1", optional = true }
merlin = { version = "2", default-features = false }
clear_on_drop = { version = "0.2", default-features = false, features = ["nightly"] }
clear_on_drop = { version = "0.2", default-features = false }

[dev-dependencies]
hex = "0.3"
Expand All @@ -38,10 +38,13 @@ bincode = "1"
rand_chacha = "0.2"

[features]
default = ["std", "avx2_backend"]
default = ["std"]
avx2_backend = ["curve25519-dalek/avx2_backend"]
yoloproofs = []
std = ["rand", "rand/std", "thiserror"]
std = ["rand", "rand/std", "thiserror", "curve25519-dalek/std"]
nightly = ["curve25519-dalek/nightly", "curve25519-dalek/alloc", "subtle/nightly", "clear_on_drop/nightly"]
docs = ["nightly"]


[[test]]
name = "range_proof"
Expand All @@ -53,6 +56,7 @@ required-features = ["yoloproofs"]
[[bench]]
name = "range_proof"
harness = false
required-features = ["avx2_backend"]

[[bench]]
name = "generators"
Expand All @@ -61,4 +65,4 @@ harness = false
[[bench]]
name = "r1cs"
harness = false
required-features = ["yoloproofs"]
required-features = ["yoloproofs", "avx2_backend"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FEATURES := yoloproofs

doc:
cargo rustdoc --features "$(FEATURES)" -- --html-in-header docs/assets/rustdoc-include-katex-header.html
cargo rustdoc --features "docs,$(FEATURES)" -- --html-in-header docs/assets/rustdoc-include-katex-header.html

doc-internal:
cargo rustdoc --features "$(FEATURES)" -- --html-in-header docs/assets/rustdoc-include-katex-header.html --document-private-items
cargo rustdoc --features "docs,$(FEATURES)" -- --html-in-header docs/assets/rustdoc-include-katex-header.html --document-private-items

2 changes: 0 additions & 2 deletions Testfile

This file was deleted.

2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2019-07-31
nightly
2 changes: 1 addition & 1 deletion src/inner_product_proof.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(non_snake_case)]
#![doc(include = "../docs/inner-product-protocol.md")]
#![cfg_attr(feature = "docs", doc(include = "../docs/inner-product-protocol.md"))]

extern crate alloc;

Expand Down
28 changes: 16 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![feature(nll)]
#![feature(external_doc)]
#![feature(try_trait)]
#![deny(missing_docs)]
#![doc(include = "../README.md")]
#![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")]
#![doc(html_root_url = "https://docs.rs/bulletproofs/2.0.0")]
#![cfg_attr(feature = "docs", feature(external_doc))]
#![cfg_attr(feature = "docs", deny(missing_docs))]
#![cfg_attr(feature = "docs", doc(include = "../README.md"))]
#![cfg_attr(
feature = "docs",
doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")
)]
#![cfg_attr(
feature = "docs",
doc(html_root_url = "https://docs.rs/bulletproofs/2.0.0")
)]

extern crate alloc;

Expand All @@ -14,13 +18,13 @@ extern crate serde_derive;

mod util;

#[doc(include = "../docs/notes-intro.md")]
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-intro.md"))]
mod notes {
#[doc(include = "../docs/notes-ipp.md")]
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-ipp.md"))]
mod inner_product_proof {}
#[doc(include = "../docs/notes-rp.md")]
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-rp.md"))]
mod range_proof {}
#[doc(include = "../docs/notes-r1cs.md")]
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-r1cs.md"))]
mod r1cs_proof {}
}

Expand All @@ -34,7 +38,7 @@ pub use crate::errors::ProofError;
pub use crate::generators::{BulletproofGens, BulletproofGensShare, PedersenGens};
pub use crate::range_proof::RangeProof;

#[doc(include = "../docs/aggregation-api.md")]
#[cfg_attr(feature = "docs", doc(include = "../docs/aggregation-api.md"))]
pub mod range_proof_mpc {
pub use crate::errors::MPCError;
pub use crate::range_proof::dealer;
Expand Down
4 changes: 2 additions & 2 deletions src/r1cs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![doc(include = "../../docs/r1cs-docs-example.md")]
#![cfg_attr(feature = "docs", doc(include = "../../docs/r1cs-docs-example.md"))]

#[doc(include = "../../docs/cs-proof.md")]
#[cfg_attr(feature = "docs", doc(include = "../../docs/cs-proof.md"))]
mod notes {}

mod constraint_system;
Expand Down
2 changes: 1 addition & 1 deletion src/range_proof/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(non_snake_case)]
#![doc(include = "../../docs/range-proof-protocol.md")]
#![cfg_attr(feature = "docs", doc(include = "../../docs/range-proof-protocol.md"))]

extern crate alloc;
#[cfg(feature = "std")]
Expand Down

0 comments on commit d287c7a

Please sign in to comment.