Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature flag updates #116

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of the test-dependencies feature is that by enabling it, the testing module is made available to downstream crates. So I don't think this is the right change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is nothing public in this module. In fact, there's an #[allow(dead_code)] on the strategy in this module. If that is made public at some point, then this can be reverted, but as-is this is an empty module.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that maybe it's better to make arb_bundle public, and remove the allow, but I guess this is fine.

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