Skip to content

Commit

Permalink
remove alloc feature and just use alloc everywhere, now building with…
Browse files Browse the repository at this point in the history
…out default features just works
  • Loading branch information
xoloki committed Aug 12, 2019
1 parent b935b5b commit dc1238b
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 32 deletions.
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ keywords = ["cryptography", "crypto", "ristretto", "zero-knowledge", "bulletproo
description = "A pure-Rust implementation of Bulletproofs using Ristretto"

[dependencies]
curve25519-dalek = { version = "1.2", default-features = false, features = ["u64_backend", "nightly", "serde"] }
curve25519-dalek = { version = "1.2", default-features = false, features = ["u64_backend", "nightly", "serde", "alloc"] }
subtle = { version = "2", default-features = false }
sha3 = { version = "0.8", default-features = false }
digest = { version = "0.8", default-features = false }
rand_core = { version = "0.4", default-features = false }
rand_core = { version = "0.4", default-features = false, features = ["alloc"] }
rand = { version = "0.6", default-features = false }
byteorder = { version = "1", default-features = false }
serde = { version = "1", default-features = false }
serde = { version = "1", default-features = false, features = ["alloc"] }
serde_derive = { version = "1", default-features = false }
failure = { version = "0.1", default-features = false, features = ["derive"] }
merlin = { version = "1.2", default-features = false }
Expand All @@ -35,8 +35,7 @@ rand_chacha = "0.1"
default = ["std", "avx2_backend"]
avx2_backend = ["curve25519-dalek/avx2_backend"]
yoloproofs = []
std = ["rand/std", "serde/std", "merlin/std", "curve25519-dalek/std"]
alloc = ["rand_core/alloc", "serde/alloc", "curve25519-dalek/alloc"]
std = ["rand/std"]

[[test]]
name = "range_proof"
Expand Down
2 changes: 0 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! Errors related to proving and verifying proofs.
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "alloc")]
use alloc::vec::Vec;

/// Represents an error in proof creation, verification, or parsing.
Expand Down
4 changes: 0 additions & 4 deletions src/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
#![allow(non_snake_case)]
#![deny(missing_docs)]

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

#[cfg(feature = "alloc")]
use alloc::vec::Vec;

use curve25519_dalek::constants::RISTRETTO_BASEPOINT_COMPRESSED;
use curve25519_dalek::constants::RISTRETTO_BASEPOINT_POINT;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
use curve25519_dalek::traits::MultiscalarMul;

use digest::{ExtendableOutput, Input, XofReader};
use sha3::{Sha3XofReader, Sha3_512, Shake256};

Expand Down
5 changes: 0 additions & 5 deletions src/inner_product_proof.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#![allow(non_snake_case)]
#![doc(include = "../docs/inner-product-protocol.md")]

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

#[cfg(feature = "alloc")]
use alloc::vec::Vec;
#[cfg(feature = "alloc")]
use alloc::borrow::Borrow;
#[cfg(feature = "std")]
use std::borrow::Borrow;

use core::iter;
use curve25519_dalek::ristretto::{CompressedRistretto, RistrettoPoint};
Expand Down
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "alloc", feature(alloc))]
#![feature(nll)]
#![feature(external_doc)]
#![feature(try_trait)]
Expand All @@ -9,7 +8,6 @@

extern crate byteorder;

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

#[cfg(feature = "std")]
Expand Down Expand Up @@ -54,9 +52,6 @@ mod inner_product_proof;
mod range_proof;
mod transcript;

#[cfg(feature = "alloc")]
use alloc::vec::Vec;

pub use errors::ProofError;
pub use generators::{BulletproofGens, BulletproofGensShare, PedersenGens};
pub use range_proof::RangeProof;
Expand Down
2 changes: 0 additions & 2 deletions src/range_proof/dealer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
use core::iter;

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

#[cfg(feature = "alloc")]
use alloc::vec::Vec;

use curve25519_dalek::ristretto::RistrettoPoint;
Expand Down
2 changes: 0 additions & 2 deletions src/range_proof/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
//! For more explanation of how the `dealer`, `party`, and `messages` modules orchestrate the protocol execution, see
//! [the API for the aggregated multiparty computation protocol](../aggregation/index.html#api-for-the-aggregated-multiparty-computation-protocol).
#[cfg(feature = "alloc")]
extern crate alloc;

#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use core::iter;
use curve25519_dalek::ristretto::{CompressedRistretto, RistrettoPoint};
Expand Down
2 changes: 0 additions & 2 deletions src/range_proof/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#![allow(non_snake_case)]
#![doc(include = "../../docs/range-proof-protocol.md")]

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

#[cfg(feature = "alloc")]
use alloc::vec::Vec;
#[cfg(feature = "std")]
use self::rand::thread_rng;
Expand Down
2 changes: 0 additions & 2 deletions src/range_proof/party.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
//! modules orchestrate the protocol execution, see the documentation
//! in the [`aggregation`](::range_proof_mpc) module.
#[cfg(feature = "alloc")]
extern crate alloc;

#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use core::iter;
use curve25519_dalek::ristretto::{CompressedRistretto, RistrettoPoint};
Expand Down
3 changes: 0 additions & 3 deletions src/util.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#![deny(missing_docs)]
#![allow(non_snake_case)]

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

#[cfg(feature = "alloc")]
use alloc::vec;
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use clear_on_drop::clear::Clear;
use curve25519_dalek::scalar::Scalar;
Expand Down

0 comments on commit dc1238b

Please sign in to comment.