Skip to content

Commit d287c7a

Browse files
authored
Support for stable Rust (dalek-cryptography#318)
1 parent 9c798f5 commit d287c7a

File tree

11 files changed

+118
-52
lines changed

11 files changed

+118
-52
lines changed

.github/workflows/check-develop.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
pull_request:
7+
branches: [ develop ]
8+
9+
jobs:
10+
check-stable:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install the stable
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
override: true
21+
components: rustfmt
22+
- name: Cargo fmt
23+
run: cargo fmt --all -- --check
24+
- name: Run tests
25+
run: cargo test --features="yoloproofs" --verbose
26+
- name: Build benchmarks
27+
run: cargo bench --features="yoloproofs" --verbose DONTRUNBENCHMARKS
28+
29+
check-nightly:
30+
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Install the nightly
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
toolchain: nightly
39+
override: true
40+
- name: Run tests
41+
run: cargo test --features="std,nightly,yoloproofs" --verbose
42+
- name: Build benchmarks
43+
run: cargo bench --features="std,nightly,yoloproofs" --verbose DONTRUNBENCHMARKS

.github/workflows/check-main.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
check-stable:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install the stable
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
override: true
21+
components: rustfmt
22+
- name: Cargo fmt
23+
run: cargo fmt --all -- --check
24+
- name: Run tests
25+
run: cargo test --verbose
26+
- name: Build benchmarks
27+
run: cargo bench --verbose DONTRUNBENCHMARKS
28+
29+
check-nightly:
30+
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Install the nightly
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
toolchain: nightly
39+
override: true
40+
- name: Run tests
41+
run: cargo test --features="std,nightly" --verbose
42+
- name: Build benchmarks
43+
run: cargo bench --features="std,nightly" --verbose DONTRUNBENCHMARKS

.travis.yml

-26
This file was deleted.

Cargo.toml

+9-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ description = "A pure-Rust implementation of Bulletproofs using Ristretto"
1818
edition = "2018"
1919

2020
[dependencies]
21-
curve25519-dalek = { version = "2", default-features = false, features = ["u64_backend", "nightly", "serde", "alloc"] }
21+
curve25519-dalek = { version = "2", default-features = false, features = ["u64_backend", "serde"] }
2222
subtle = { version = "2", default-features = false }
2323
sha3 = { version = "0.8", default-features = false }
2424
digest = { version = "0.8", default-features = false }
@@ -29,7 +29,7 @@ serde = { version = "1", default-features = false, features = ["alloc"] }
2929
serde_derive = { version = "1", default-features = false }
3030
thiserror = { version = "1", optional = true }
3131
merlin = { version = "2", default-features = false }
32-
clear_on_drop = { version = "0.2", default-features = false, features = ["nightly"] }
32+
clear_on_drop = { version = "0.2", default-features = false }
3333

3434
[dev-dependencies]
3535
hex = "0.3"
@@ -38,10 +38,13 @@ bincode = "1"
3838
rand_chacha = "0.2"
3939

4040
[features]
41-
default = ["std", "avx2_backend"]
41+
default = ["std"]
4242
avx2_backend = ["curve25519-dalek/avx2_backend"]
4343
yoloproofs = []
44-
std = ["rand", "rand/std", "thiserror"]
44+
std = ["rand", "rand/std", "thiserror", "curve25519-dalek/std"]
45+
nightly = ["curve25519-dalek/nightly", "curve25519-dalek/alloc", "subtle/nightly", "clear_on_drop/nightly"]
46+
docs = ["nightly"]
47+
4548

4649
[[test]]
4750
name = "range_proof"
@@ -53,6 +56,7 @@ required-features = ["yoloproofs"]
5356
[[bench]]
5457
name = "range_proof"
5558
harness = false
59+
required-features = ["avx2_backend"]
5660

5761
[[bench]]
5862
name = "generators"
@@ -61,4 +65,4 @@ harness = false
6165
[[bench]]
6266
name = "r1cs"
6367
harness = false
64-
required-features = ["yoloproofs"]
68+
required-features = ["yoloproofs", "avx2_backend"]

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
FEATURES := yoloproofs
22

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

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

Testfile

-2
This file was deleted.

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2019-07-31
1+
nightly

src/inner_product_proof.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(non_snake_case)]
2-
#![doc(include = "../docs/inner-product-protocol.md")]
2+
#![cfg_attr(feature = "docs", doc(include = "../docs/inner-product-protocol.md"))]
33

44
extern crate alloc;
55

src/lib.rs

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#![cfg_attr(not(feature = "std"), no_std)]
2-
#![feature(nll)]
3-
#![feature(external_doc)]
4-
#![feature(try_trait)]
5-
#![deny(missing_docs)]
6-
#![doc(include = "../README.md")]
7-
#![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")]
8-
#![doc(html_root_url = "https://docs.rs/bulletproofs/2.0.0")]
2+
#![cfg_attr(feature = "docs", feature(external_doc))]
3+
#![cfg_attr(feature = "docs", deny(missing_docs))]
4+
#![cfg_attr(feature = "docs", doc(include = "../README.md"))]
5+
#![cfg_attr(
6+
feature = "docs",
7+
doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")
8+
)]
9+
#![cfg_attr(
10+
feature = "docs",
11+
doc(html_root_url = "https://docs.rs/bulletproofs/2.0.0")
12+
)]
913

1014
extern crate alloc;
1115

@@ -14,13 +18,13 @@ extern crate serde_derive;
1418

1519
mod util;
1620

17-
#[doc(include = "../docs/notes-intro.md")]
21+
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-intro.md"))]
1822
mod notes {
19-
#[doc(include = "../docs/notes-ipp.md")]
23+
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-ipp.md"))]
2024
mod inner_product_proof {}
21-
#[doc(include = "../docs/notes-rp.md")]
25+
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-rp.md"))]
2226
mod range_proof {}
23-
#[doc(include = "../docs/notes-r1cs.md")]
27+
#[cfg_attr(feature = "docs", doc(include = "../docs/notes-r1cs.md"))]
2428
mod r1cs_proof {}
2529
}
2630

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

37-
#[doc(include = "../docs/aggregation-api.md")]
41+
#[cfg_attr(feature = "docs", doc(include = "../docs/aggregation-api.md"))]
3842
pub mod range_proof_mpc {
3943
pub use crate::errors::MPCError;
4044
pub use crate::range_proof::dealer;

src/r1cs/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#![doc(include = "../../docs/r1cs-docs-example.md")]
1+
#![cfg_attr(feature = "docs", doc(include = "../../docs/r1cs-docs-example.md"))]
22

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

66
mod constraint_system;

src/range_proof/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(non_snake_case)]
2-
#![doc(include = "../../docs/range-proof-protocol.md")]
2+
#![cfg_attr(feature = "docs", doc(include = "../../docs/range-proof-protocol.md"))]
33

44
extern crate alloc;
55
#[cfg(feature = "std")]

0 commit comments

Comments
 (0)