From 40d9115cc51bdfe4f55c986c30216ce65e8410ea Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 1 Aug 2022 07:50:10 +1000 Subject: [PATCH] Fix up conditional compilation and imports --- zcash_proofs/src/hashreader.rs | 2 ++ zcash_proofs/src/lib.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/zcash_proofs/src/hashreader.rs b/zcash_proofs/src/hashreader.rs index 0590e0748d..47fbc648e2 100644 --- a/zcash_proofs/src/hashreader.rs +++ b/zcash_proofs/src/hashreader.rs @@ -1,3 +1,5 @@ +//! Abstraction over a reader which hashes the data being read. + use std::{ fmt::Write, io::{self, Read}, diff --git a/zcash_proofs/src/lib.rs b/zcash_proofs/src/lib.rs index c708bd24e6..1eb68af25b 100644 --- a/zcash_proofs/src/lib.rs +++ b/zcash_proofs/src/lib.rs @@ -9,11 +9,14 @@ // Temporary until we have addressed all Result cases. #![allow(clippy::result_unit_err)] +use std::{ + fs::File, + io::{self, BufReader}, + path::Path, +}; + use bellman::groth16::{prepare_verifying_key, Parameters, PreparedVerifyingKey, VerifyingKey}; use bls12_381::Bls12; -use std::fs::File; -use std::io::{self, BufReader}; -use std::path::Path; #[cfg(feature = "directories")] use directories::BaseDirs; @@ -22,7 +25,7 @@ use std::path::PathBuf; pub mod circuit; pub mod constants; -mod hashreader; +pub mod hashreader; pub mod sapling; pub mod sprout; @@ -40,15 +43,12 @@ mod downloadreader; // Circuit names /// The sapling spend parameters file name. -#[cfg(any(feature = "local-prover", feature = "download-params"))] pub const SAPLING_SPEND_NAME: &str = "sapling-spend.params"; /// The sapling output parameters file name. -#[cfg(any(feature = "local-prover", feature = "download-params"))] pub const SAPLING_OUTPUT_NAME: &str = "sapling-output.params"; /// The sprout parameters file name. -#[cfg(any(feature = "local-prover", feature = "download-params"))] pub const SPROUT_NAME: &str = "sprout-groth16.params"; // Circuit hashes @@ -66,6 +66,7 @@ const DOWNLOAD_URL: &str = "https://download.z.cash/downloads"; /// The paths to the Sapling parameter files. #[cfg(feature = "download-params")] +#[cfg_attr(docsrs, doc(cfg(feature = "download-params")))] #[derive(Clone, Debug, Eq, PartialEq)] pub struct SaplingParameterPaths { /// The path to the Sapling spend parameter file. @@ -289,7 +290,6 @@ pub struct ZcashParameters { /// Load the specified parameters, checking the sizes and hashes of the files. /// /// Returns the loaded parameters. -#[cfg(any(feature = "local-prover", feature = "download-params"))] pub fn load_parameters( spend_path: &Path, output_path: &Path,