Skip to content

Commit

Permalink
Merge pull request #116 from zcash/feature-flag-updates
Browse files Browse the repository at this point in the history
Feature flag updates
  • Loading branch information
str4d authored Jan 3, 2024
2 parents 71711b9 + 49dfc22 commit 4ec6a48
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 2 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ homepage = "https://github.com/zcash/sapling-crypto"
repository = "https://github.com/zcash/sapling-crypto"
license = "MIT OR Apache-2.0"

[package.metadata.docs.rs]
features = ["test-dependencies"]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
ff = "0.13"
group = { version = "0.13", features = ["wnaf-memuse"] }
Expand All @@ -33,6 +37,9 @@ rand_core = "0.6"
blake2b_simd = "1"
blake2s_simd = "1"

# Documentation
document-features = "0.2"

# Encodings
byteorder = "1"
hex = "0.4"
Expand Down Expand Up @@ -73,11 +80,19 @@ rand_xorshift = "0.3"
pprof = { version = "0.11", features = ["criterion", "flamegraph"] } # MSRV 1.56

[features]
default = ["multicore"]

## Enables multithreading support for creating proofs.
multicore = ["bellman/multicore"]

### A temporary feature flag that exposes granular APIs needed by `zcashd`. These APIs
### should not be relied upon and will be removed in a future release.
temporary-zcashd = []

## Exposes APIs that are useful for testing, such as `proptest` strategies.
test-dependencies = [
"incrementalmerkletree/test-dependencies",
"proptest",
"dep:proptest",
]

[[bench]]
Expand Down
2 changes: 1 addition & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ impl<V> Bundle<InProgress<Proven, PartiallyAuthorized>, V> {
}

#[cfg(any(test, feature = "test-dependencies"))]
pub mod testing {
pub(crate) mod testing {
use std::fmt;

use proptest::collection::vec;
Expand Down
1 change: 1 addition & 0 deletions src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ impl<A> From<OutputDescription<A>> for CompactOutputDescription {
}

#[cfg(any(test, feature = "test-dependencies"))]
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
pub mod testing {
use std::fmt;

Expand Down
1 change: 1 addition & 0 deletions src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ impl SharedSecret {
}

#[cfg(any(test, feature = "test-dependencies"))]
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
pub mod testing {
use proptest::collection::vec;
use proptest::prelude::*;
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
//! Sapling-specific types. For example, [`PaymentAddress`] is documented as being a
//! shielded payment address; we implicitly mean it is an Sapling payment address (as
//! opposed to e.g. an Orchard payment address, which is also shielded).
//!
//! ## Feature flags
#![doc = document_features::document_features!()]
//!

#![cfg_attr(docsrs, feature(doc_cfg))]
// Catch documentation errors caused by code changes.
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(unsafe_code)]
Expand Down Expand Up @@ -40,6 +45,7 @@ pub use tree::{
pub use verifier::{BatchValidator, SaplingVerificationContext};

#[cfg(any(test, feature = "test-dependencies"))]
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
pub mod testing {
pub use super::{
address::testing::arb_payment_address, keys::testing::arb_incoming_viewing_key,
Expand Down
1 change: 1 addition & 0 deletions src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ impl OutputProver for OutputParameters {
}

#[cfg(any(test, feature = "test-dependencies"))]
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
pub mod mock {
use ff::Field;

Expand Down
1 change: 1 addition & 0 deletions src/zip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,7 @@ mod tests {
}

#[cfg(any(test, feature = "test-dependencies"))]
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
pub mod testing {
use proptest::collection::vec;
use proptest::prelude::{any, prop_compose};
Expand Down

0 comments on commit 4ec6a48

Please sign in to comment.