Skip to content

Commit

Permalink
Merge pull request zcash#1528 from nuttycom/fix/zip321-test-dependencies
Browse files Browse the repository at this point in the history
zip321: Add missing `test-dependencies` feature configuration.
  • Loading branch information
str4d authored Sep 16, 2024
2 parents 0777cbc + 2ce78be commit f7228a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,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

0 comments on commit f7228a5

Please sign in to comment.