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

zip321: Add missing test-dependencies feature configuration. #1528

Merged
merged 3 commits into from
Sep 16, 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
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,6 @@ zip32 = "0.1.1"
lto = true
panic = 'abort'
codegen-units = 1

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("zfuture"))'] }
7 changes: 7 additions & 0 deletions components/zip321/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ nom = "7"
base64.workspace = true
percent-encoding.workspace = true

# - Test dependencies
proptest = { workspace = true, optional = true }

[dev-dependencies]
zcash_address = { workspace = true, features = ["test-dependencies"] }
zcash_protocol = { workspace = true, features = ["test-dependencies"] }
proptest.workspace = true

[features]
## Exposes APIs that are useful for testing, such as `proptest` strategies.
test-dependencies = ["dep:proptest"]
2 changes: 2 additions & 0 deletions zcash_client_backend/src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub(crate) trait Decryptor<D: BatchDomain, Output> {
}

/// A decryptor of outputs as encoded in transactions.
#[allow(dead_code)]
pub(crate) struct FullDecryptor;

impl<D: BatchDomain, Output: ShieldedOutput<D, ENC_CIPHERTEXT_SIZE>> Decryptor<D, Output>
Expand Down Expand Up @@ -200,6 +201,7 @@ impl<Item: Task> Tasks<Item> for () {
///
/// This struct implements `DynamicUsage` without any item bounds, but that works because
/// it only implements `Tasks` for items that implement `DynamicUsage`.
#[allow(dead_code)]
pub(crate) struct WithUsage {
// The current heap usage for all running tasks.
running_usage: Arc<AtomicUsize>,
Expand Down
23 changes: 1 addition & 22 deletions zcash_client_sqlite/src/wallet/scanning.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use incrementalmerkletree::{Address, Position};
use rusqlite::{self, named_params, types::Value, OptionalExtension};
use shardtree::error::ShardTreeError;
use std::cmp::{max, min};
use std::collections::BTreeSet;
use std::ops::Range;
Expand All @@ -18,7 +17,7 @@ use zcash_primitives::consensus::{self, BlockHeight, NetworkUpgrade};

use crate::{
error::SqliteClientError,
wallet::{block_height_extrema, commitment_tree, init::WalletMigrationError},
wallet::{block_height_extrema, init::WalletMigrationError},
PRUNING_DEPTH, SAPLING_TABLES_PREFIX, VERIFY_LOOKAHEAD,
};

Expand Down Expand Up @@ -119,8 +118,6 @@ pub(crate) fn insert_queue_entries<'a>(
pub(crate) trait WalletError {
fn db_error(err: rusqlite::Error) -> Self;
fn corrupt(message: String) -> Self;
fn chain_height_unknown() -> Self;
fn commitment_tree(err: ShardTreeError<commitment_tree::Error>) -> Self;
}

impl WalletError for SqliteClientError {
Expand All @@ -131,14 +128,6 @@ impl WalletError for SqliteClientError {
fn corrupt(message: String) -> Self {
SqliteClientError::CorruptedData(message)
}

fn chain_height_unknown() -> Self {
SqliteClientError::ChainHeightUnknown
}

fn commitment_tree(err: ShardTreeError<commitment_tree::Error>) -> Self {
SqliteClientError::CommitmentTree(err)
}
}

impl WalletError for WalletMigrationError {
Expand All @@ -149,16 +138,6 @@ impl WalletError for WalletMigrationError {
fn corrupt(message: String) -> Self {
WalletMigrationError::CorruptedData(message)
}

fn chain_height_unknown() -> Self {
WalletMigrationError::CorruptedData(
"Wallet migration requires a valid account birthday.".to_owned(),
)
}

fn commitment_tree(err: ShardTreeError<commitment_tree::Error>) -> Self {
WalletMigrationError::CommitmentTree(err)
}
}

pub(crate) fn replace_queue_entries<E: WalletError>(
Expand Down
Loading