From eaf330d950868917645ee1e3742d1e8b1441e8af Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 23 Sep 2024 16:06:13 +0000 Subject: [PATCH 1/5] Fix `cargo test -p zcash_address` Closes zcash/librustzcash#1538. --- components/zcash_address/Cargo.toml | 1 + components/zcash_address/src/kind/unified/address.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/zcash_address/Cargo.toml b/components/zcash_address/Cargo.toml index a2be0995c..a58f80f21 100644 --- a/components/zcash_address/Cargo.toml +++ b/components/zcash_address/Cargo.toml @@ -28,6 +28,7 @@ proptest = { workspace = true, optional = true } [dev-dependencies] assert_matches.workspace = true +proptest.workspace = true [features] test-dependencies = ["dep:proptest"] diff --git a/components/zcash_address/src/kind/unified/address.rs b/components/zcash_address/src/kind/unified/address.rs index 8942b4972..6a51d44d9 100644 --- a/components/zcash_address/src/kind/unified/address.rs +++ b/components/zcash_address/src/kind/unified/address.rs @@ -159,7 +159,7 @@ impl super::Container for Address { } } -#[cfg(feature = "test-dependencies")] +#[cfg(any(test, feature = "test-dependencies"))] pub mod testing { use proptest::{ array::{uniform11, uniform20, uniform32}, From ae4a968a86cae1a8924b301d4918fb4e98acb727 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 23 Sep 2024 16:12:43 +0000 Subject: [PATCH 2/5] Fix `cargo test -p zcash_primitives` --- zcash_primitives/Cargo.toml | 1 + zcash_primitives/src/transaction/components.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zcash_primitives/Cargo.toml b/zcash_primitives/Cargo.toml index c59f186b4..4ab0b2ee0 100644 --- a/zcash_primitives/Cargo.toml +++ b/zcash_primitives/Cargo.toml @@ -96,6 +96,7 @@ assert_matches.workspace = true rand_xorshift.workspace = true sapling = { workspace = true, features = ["test-dependencies"] } orchard = { workspace = true, features = ["test-dependencies"] } +zcash_protocol = { workspace = true, features = ["test-dependencies"] } # MSRV pins for transitive dev-dependencies: clap = ">=4, <4.5" # clap 4.5 has MSRV 1.74 diff --git a/zcash_primitives/src/transaction/components.rs b/zcash_primitives/src/transaction/components.rs index f239b0ba0..bf310bcb1 100644 --- a/zcash_primitives/src/transaction/components.rs +++ b/zcash_primitives/src/transaction/components.rs @@ -4,7 +4,7 @@ pub mod amount { BalanceError, ZatBalance as Amount, Zatoshis as NonNegativeAmount, COIN, }; - #[cfg(feature = "test-dependencies")] + #[cfg(any(test, feature = "test-dependencies"))] pub mod testing { pub use zcash_protocol::value::testing::{ arb_positive_zat_balance as arb_positive_amount, arb_zat_balance as arb_amount, From 8b8efe9bb46c606ae13e79d75b68045795ae42a3 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 23 Sep 2024 16:14:44 +0000 Subject: [PATCH 3/5] Fix clippy lint for `cargo test -p zcash_keys` --- zcash_keys/src/encoding.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zcash_keys/src/encoding.rs b/zcash_keys/src/encoding.rs index 894103a04..cb31b625a 100644 --- a/zcash_keys/src/encoding.rs +++ b/zcash_keys/src/encoding.rs @@ -6,7 +6,7 @@ use crate::address::UnifiedAddress; use bs58::{self, decode::Error as Bs58Error}; use std::fmt; -use zcash_primitives::consensus::{NetworkConstants, NetworkType}; +use zcash_primitives::consensus::NetworkConstants; use zcash_address::unified::{self, Encoding}; use zcash_primitives::{consensus, legacy::TransparentAddress}; @@ -16,6 +16,7 @@ use { bech32::{self, Error, FromBase32, ToBase32, Variant}, sapling::zip32::{ExtendedFullViewingKey, ExtendedSpendingKey}, std::io::{self, Write}, + zcash_primitives::consensus::NetworkType, }; #[cfg(feature = "sapling")] From ebd849f3e1a323a96caebd95582234ba685ac596 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 23 Sep 2024 16:15:36 +0000 Subject: [PATCH 4/5] Fix `cargo test -p zcash_client_backend` --- zcash_client_backend/src/data_api.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zcash_client_backend/src/data_api.rs b/zcash_client_backend/src/data_api.rs index 3e2870849..72dd062a3 100644 --- a/zcash_client_backend/src/data_api.rs +++ b/zcash_client_backend/src/data_api.rs @@ -1211,7 +1211,7 @@ pub trait WalletRead { /// These methods expose internal details or unstable interfaces, primarily to enable use /// of the [`testing`] framework. They should not be used in production software. #[cfg(any(test, feature = "test-dependencies"))] -#[delegatable_trait] +#[cfg_attr(feature = "test-dependencies", delegatable_trait)] pub trait WalletTest: InputSource + WalletRead { /// Returns a vector of transaction summaries. /// From 6bd2f1f7ab4d0f6c569cbc333d65024004fe8547 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 23 Sep 2024 16:17:10 +0000 Subject: [PATCH 5/5] Fix clippy lint for `cargo test -p zcash_client_sqlite` --- zcash_client_sqlite/src/testing/pool.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zcash_client_sqlite/src/testing/pool.rs b/zcash_client_sqlite/src/testing/pool.rs index ef5408bad..a82eef350 100644 --- a/zcash_client_sqlite/src/testing/pool.rs +++ b/zcash_client_sqlite/src/testing/pool.rs @@ -3,7 +3,6 @@ //! Generalised for sharing across the Sapling and Orchard implementations. use crate::{ - error::SqliteClientError, testing::{db::TestDbFactory, BlockCache}, SAPLING_TABLES_PREFIX, }; @@ -17,6 +16,9 @@ use { zcash_client_backend::data_api::testing::orchard::OrchardPoolTester, }; +#[cfg(feature = "transparent-inputs")] +use crate::error::SqliteClientError; + pub(crate) trait ShieldedPoolPersistence { const TABLES_PREFIX: &'static str; }