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

Update to latest patch revision of librustzcash crates. #82

Merged
merged 1 commit into from
Mar 5, 2025
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
42 changes: 16 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,17 @@ tui = [
"dep:tokio-util",
"dep:tui-logger",
]

[patch.crates-io]
equihash = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
pczt = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
transparent = { package = "zcash_transparent", git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_client_backend = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_client_sqlite = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_encoding = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_keys = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zcash_protocol = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
zip321 = { git = "https://github.com/zcash/librustzcash.git", rev = "f615a73a673aec8acbcdebea668aff9f4bf4a154" }
6 changes: 4 additions & 2 deletions src/commands/inspect/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use zcash_address::{
unified::{self, Encoding},
ToAddress, ZcashAddress,
};
use zcash_keys::keys::UnifiedFullViewingKey;
use zcash_keys::keys::{UnifiedAddressRequest, UnifiedFullViewingKey};
use zcash_protocol::{
consensus::{Network, NetworkConstants, NetworkType},
local_consensus::LocalNetwork,
Expand Down Expand Up @@ -201,7 +201,9 @@ pub(crate) fn inspect_sapling_extsk(data: Vec<u8>, network: NetworkType) {
};
eprintln!("- UFVK: {encoded_ufvk}");

let (default_ua, _) = ufvk.default_address(None).expect("should exist");
let (default_ua, _) = ufvk
.default_address(UnifiedAddressRequest::AllAvailableKeys)
.expect("should exist");
let encoded_ua = match network {
NetworkType::Main => default_ua.encode(&Network::MainNetwork),
NetworkType::Test => default_ua.encode(&Network::TestNetwork),
Expand Down
6 changes: 4 additions & 2 deletions src/commands/inspect/keys/view.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bech32::{Bech32, Hrp};
use zcash_address::unified::{self, Container, Encoding};
use zcash_keys::keys::UnifiedFullViewingKey;
use zcash_keys::keys::{UnifiedAddressRequest, UnifiedFullViewingKey};
use zcash_protocol::{
consensus::{Network, NetworkConstants, NetworkType},
local_consensus::LocalNetwork,
Expand Down Expand Up @@ -123,7 +123,9 @@ pub(crate) fn inspect_sapling_extfvk(data: Vec<u8>, network: NetworkType) {
};
eprintln!("- Equivalent UFVK: {encoded_ufvk}");

let (default_ua, _) = ufvk.default_address(None).expect("should exist");
let (default_ua, _) = ufvk
.default_address(UnifiedAddressRequest::AllAvailableKeys)
.expect("should exist");
let encoded_ua = match network {
NetworkType::Main => default_ua.encode(&Network::MainNetwork),
NetworkType::Test => default_ua.encode(&Network::TestNetwork),
Expand Down
4 changes: 2 additions & 2 deletions src/commands/keystone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use qrcode::{render::unicode, QrCode};
use tokio::io::{stdout, AsyncWriteExt};
use uuid::Uuid;
use zcash_client_backend::data_api::Account;
use zcash_client_sqlite::WalletDb;
use zcash_client_sqlite::{util::SystemClock, WalletDb};

use crate::{config::WalletConfig, data::get_db_paths, ShutdownListener};

Expand Down Expand Up @@ -44,7 +44,7 @@ impl Enroll {
let params = config.network();

let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let db_data = WalletDb::for_path(db_data, params)?;
let db_data = WalletDb::for_path(db_data, params, SystemClock)?;
let account = select_account(&db_data, self.account_id)?;

let key_derivation = account
Expand Down
4 changes: 2 additions & 2 deletions src/commands/pczt/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use zcash_client_backend::{
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
wallet::OvkPolicy,
};
use zcash_client_sqlite::WalletDb;
use zcash_client_sqlite::{util::SystemClock, WalletDb};
use zcash_protocol::{
memo::{Memo, MemoBytes},
value::Zatoshis,
Expand Down Expand Up @@ -64,7 +64,7 @@ impl Command {
let params = config.network();

let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let mut db_data = WalletDb::for_path(db_data, params)?;
let mut db_data = WalletDb::for_path(db_data, params, SystemClock)?;
let account = select_account(&db_data, self.account_id)?;

// Create the PCZT.
Expand Down
9 changes: 4 additions & 5 deletions src/commands/pczt/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use zcash_client_backend::{
data_api::{wallet::extract_and_store_transaction_from_pczt, WalletRead},
proto::service,
};
use zcash_client_sqlite::WalletDb;
use zcash_client_sqlite::{util::SystemClock, WalletDb};
use zcash_proofs::prover::LocalTxProver;

use crate::{
Expand Down Expand Up @@ -35,7 +35,7 @@ impl Command {
let params = config.network();

let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let mut db_data = WalletDb::for_path(db_data, params)?;
let mut db_data = WalletDb::for_path(db_data, params, SystemClock)?;

let server = self.server.pick(params)?;
let mut client = if self.disable_tor {
Expand All @@ -56,9 +56,8 @@ impl Command {
let txid = extract_and_store_transaction_from_pczt::<_, ()>(
&mut db_data,
pczt,
&spend_vk,
&output_vk,
&orchard::circuit::VerifyingKey::build(),
Some((&spend_vk, &output_vk)),
Some(&orchard::circuit::VerifyingKey::build()),
)
.map_err(|e| anyhow!("Failed to extract and store transaction from PCZT: {:?}", e))?;

Expand Down
4 changes: 2 additions & 2 deletions src/commands/pczt/shield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use zcash_client_backend::{
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
wallet::OvkPolicy,
};
use zcash_client_sqlite::WalletDb;
use zcash_client_sqlite::{util::SystemClock, WalletDb};
use zcash_protocol::{value::Zatoshis, ShieldedProtocol};

use crate::{commands::select_account, config::WalletConfig, data::get_db_paths, error};
Expand Down Expand Up @@ -42,7 +42,7 @@ impl Command {
let params = config.network();

let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let mut db_data = WalletDb::for_path(db_data, params)?;
let mut db_data = WalletDb::for_path(db_data, params, SystemClock)?;
let account = select_account(&db_data, self.account_id)?;

// Create the PCZT.
Expand Down
8 changes: 6 additions & 2 deletions src/commands/wallet/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use zcash_client_backend::{
tor,
};
use zcash_client_sqlite::WalletDb;
use zcash_keys::keys::UnifiedAddressRequest;
use zcash_protocol::value::{Zatoshis, COIN};

use crate::{
Expand All @@ -33,11 +34,14 @@ impl Command {
let params = get_wallet_network(wallet_dir.as_ref())?;

let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let db_data = WalletDb::for_path(db_data, params)?;
let db_data = WalletDb::for_path(db_data, params, ())?;
let account = select_account(&db_data, self.account_id)?;

let address = db_data
.get_current_address(account.id())?
.get_last_generated_address_matching(
account.id(),
UnifiedAddressRequest::AllAvailableKeys,
)?
.ok_or(error::Error::InvalidRecipient)?;

let printer = if let Some(currency) = self.convert {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/wallet/enhance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use zcash_client_backend::{
self, compact_tx_streamer_client::CompactTxStreamerClient, BlockRange, RawTransaction,
},
};
use zcash_client_sqlite::WalletDb;
use zcash_client_sqlite::{util::SystemClock, WalletDb};
use zcash_keys::encoding::AddressCodec;
use zcash_primitives::transaction::{Transaction, TxId};
use zcash_protocol::consensus::{BlockHeight, BranchId, Network};
Expand Down Expand Up @@ -87,7 +87,7 @@ impl Command {
let params = get_wallet_network(wallet_dir.as_ref())?;
let (_, db_data) = get_db_paths(wallet_dir.as_ref());

let mut db_data = WalletDb::for_path(db_data, params)?;
let mut db_data = WalletDb::for_path(db_data, params, SystemClock)?;
let chain_tip = db_data.chain_height()?.ok_or_else(|| {
anyhow!("Chain height must be available to perform transaction enhancement.")
})?;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/wallet/import_ufvk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use zcash_client_backend::{
data_api::{AccountBirthday, AccountPurpose, WalletWrite, Zip32Derivation},
proto::service,
};
use zcash_client_sqlite::WalletDb;
use zcash_client_sqlite::{util::SystemClock, WalletDb};
use zcash_keys::keys::UnifiedFullViewingKey;
use zcash_protocol::consensus;
use zip32::fingerprint::SeedFingerprint;
Expand Down Expand Up @@ -63,7 +63,7 @@ impl Command {
}?;

let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let mut db_data = WalletDb::for_path(db_data, params)?;
let mut db_data = WalletDb::for_path(db_data, params, SystemClock)?;

// Construct an `AccountBirthday` for the account's birthday.
let birthday = {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/wallet/list_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl Command {
pub(crate) fn run(self, wallet_dir: Option<String>) -> anyhow::Result<()> {
let params = get_wallet_network(wallet_dir.as_ref())?;
let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let db_data = WalletDb::for_path(db_data, params)?;
let db_data = WalletDb::for_path(db_data, params, ())?;

for account_id in db_data.get_account_ids()?.iter() {
let account = db_data.get_account(*account_id)?.unwrap();
Expand Down
7 changes: 5 additions & 2 deletions src/commands/wallet/list_addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use clap::Args;
use uuid::Uuid;
use zcash_client_backend::data_api::Account;
use zcash_client_sqlite::WalletDb;
use zcash_keys::keys::UnifiedAddressRequest;

use crate::{commands::select_account, config::get_wallet_network, data::get_db_paths};

Expand All @@ -16,12 +17,14 @@ impl Command {
pub(crate) fn run(self, wallet_dir: Option<String>) -> anyhow::Result<()> {
let params = get_wallet_network(wallet_dir.as_ref())?;
let (_, db_data) = get_db_paths(wallet_dir.as_ref());
let db_data = WalletDb::for_path(db_data, params)?;
let db_data = WalletDb::for_path(db_data, params, ())?;

let account = select_account(&db_data, self.account_id)?;

println!("Account {:?}", account.id());
let (ua, _) = account.uivk().default_address(None)?;
let (ua, _) = account
.uivk()
.default_address(UnifiedAddressRequest::AllAvailableKeys)?;
println!(" Default Address: {}", ua.encode(&params));
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/wallet/list_unspent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Command {
let params = get_wallet_network(wallet_dir.as_ref())?;

let (_, db_data) = get_db_paths(wallet_dir);
let db_data = WalletDb::for_path(db_data, params)?;
let db_data = WalletDb::for_path(db_data, params, ())?;
let account = select_account(&db_data, self.account_id)?;

// Use the height of the maximum scanned block as the anchor height, to emulate a
Expand Down
Loading