Skip to content
Draft
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
1,058 changes: 416 additions & 642 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 28 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
members = [
"zallet",
]
# `vendor/core2-shim-0.3` and `vendor/core2-shim-0.4` are referenced from the
# `[patch.crates-io]` table below, but excluded from the workspace because
# Cargo requires workspace member crate names to be unique and both shims must
# be named `core2` to satisfy the resolver.
# `vendor/core2-shim-0.3` is referenced from the `[patch.crates-io]` table below,
# but excluded from the workspace because the shim must be named `core2` to
# satisfy the resolver.
exclude = [
"vendor/core2-shim-0.3",
"vendor/core2-shim-0.4",
]
resolver = "2"

Expand Down Expand Up @@ -129,10 +127,10 @@ secp256k1 = { version = "0.29", features = ["recovery"] }
zaino-common = "0.1"
zaino-fetch = "0.1"
zaino-proto = "0.1"
zaino-state = "0.1"
zebra-chain = "2.0"
zebra-rpc = "2.0.1"
zebra-state = "2.0"
zaino-state = "0.2"
zebra-chain = "9.0"
zebra-rpc = "9.0"
zebra-state = "8.0"

# Zcash wallet
deadpool = "0.12"
Expand Down Expand Up @@ -182,25 +180,37 @@ zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "2
zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "2c4e6c769c2e70e71f14c9cf95f2dccfdb7ef239" }
zcash_protocol = { git = "https://github.com/zcash/librustzcash.git", rev = "2c4e6c769c2e70e71f14c9cf95f2dccfdb7ef239" }

# TEMPORARY: Zebra 9 depends on libzcash_script. The crates.io release can be
# built with an older bindgen that cannot parse the crate's rust-version. Drop
# this patch once libzcash_script has a crates.io release with that build fix.
libzcash_script = { git = "https://github.com/ZcashFoundation/zcash_script.git", tag = "zcash_script-v0.4.5" }
zcash_script = { git = "https://github.com/ZcashFoundation/zcash_script.git", tag = "zcash_script-v0.4.5" }

# TEMPORARY: All `core2` versions on crates.io were yanked by upstream on
# 2026-04-14, breaking fresh dependency resolution because we still pull
# `core2 ^0.3` (via `equihash 0.2.2`) and `core2 ^0.4` (via `zaino-state`)
# transitively. Both entries below redirect those `core2` requests to local
# shims that re-export `corez` (the Zcash ecosystem's clean-room replacement,
# https://github.com/zcash/corez). See `vendor/core2-shim-0.3/README.md` for
# `core2 ^0.3` transitively via `equihash 0.2.2`. The entry below redirects
# that `core2` request to a local shim that re-exports `corez`, the Zcash
# ecosystem's clean-room replacement. See `vendor/core2-shim-0.3/README.md` for
# context and removal criteria.
core2 = { path = "vendor/core2-shim-0.3" }
core2_v04 = { package = "core2", path = "vendor/core2-shim-0.4" }

# TEMPORARY: `zewif-zcashd 0.1` depends on `orchard ^0.10`, and all matching
# crates.io releases have been yanked. That old Orchard line also depends on
# yanked Halo2 gadget releases. Fresh dependency resolution breaks when CI
# deletes `Cargo.lock`, so pin the exact source tags until `zewif-zcashd` moves
# to an unyanked Orchard release.
orchard = { git = "https://github.com/zcash/orchard.git", rev = "ca77cd8232339d9ab322ff8344454b1dc861882f" }
halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "263356784042d7d4c1c17d357c94c1acaeb75ab5" }

age = { git = "https://github.com/str4d/rage.git", rev = "92f437bc2a061312fa6633bb70c91eef91142fd4" }

zewif = { git = "https://github.com/zcash/zewif.git", rev = "f84f80612813ba00a0a8a9a5f060bd217fa981cc" }
zewif-zcashd = { git = "https://github.com/zcash/zewif-zcashd.git", rev = "9c72d1805c269f88ea5caa4eb33c6d38013b9776" }

zaino-common = { git = "https://github.com/zingolabs/zaino.git", rev = "15b81f110349b34090341b3ab8b7cd58c7b9aeef" }
zaino-fetch = { git = "https://github.com/zingolabs/zaino.git", rev = "15b81f110349b34090341b3ab8b7cd58c7b9aeef" }
zaino-proto = { git = "https://github.com/zingolabs/zaino.git", rev = "15b81f110349b34090341b3ab8b7cd58c7b9aeef" }
zaino-state = { git = "https://github.com/zingolabs/zaino.git", rev = "15b81f110349b34090341b3ab8b7cd58c7b9aeef" }
zaino-common = { git = "https://github.com/valargroup/zaino.git", rev = "e48ae9722e32f994f441992e1a70bc5ea737460e" }
zaino-fetch = { git = "https://github.com/valargroup/zaino.git", rev = "e48ae9722e32f994f441992e1a70bc5ea737460e" }
zaino-proto = { git = "https://github.com/valargroup/zaino.git", rev = "e48ae9722e32f994f441992e1a70bc5ea737460e" }
zaino-state = { git = "https://github.com/valargroup/zaino.git", rev = "e48ae9722e32f994f441992e1a70bc5ea737460e" }

[profile.release]
debug = "line-tables-only"
9 changes: 5 additions & 4 deletions zallet/src/components/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use tokio::sync::RwLock;
use zaino_common::{CacheConfig, DatabaseConfig, ServiceConfig, StorageConfig};
use zaino_state::{
FetchService, FetchServiceConfig, FetchServiceSubscriber, IndexerService, IndexerSubscriber,
StatusType, ZcashService,
Status, StatusType, ZcashService,
};

use crate::{
Expand Down Expand Up @@ -90,7 +90,7 @@ impl Chain {
}?;

let config = FetchServiceConfig::new(
resolved_validator_address,
resolved_validator_address.to_string(),
config.indexer.validator_cookie_path.clone(),
config.indexer.validator_user.clone(),
config.indexer.validator_password.clone(),
Expand All @@ -103,10 +103,11 @@ impl Chain {
// completely filling the cache. Zaino's DB currently only contains a
// cache of CompactBlocks, so we make do for now with uncached queries.
// TODO: https://github.com/zingolabs/zaino/issues/249
size: zaino_common::DatabaseSize::Gb(0),
size: zaino_common::DatabaseSize(0),
},
},
config.consensus.network().to_zaino(),
None,
);

info!("Starting Zaino indexer");
Expand All @@ -130,7 +131,7 @@ impl Chain {

let service = indexer.read().await;
let status = match service.as_ref() {
Some(service) => service.inner_ref().status().await,
Some(service) => service.inner_ref().status(),
None => StatusType::CriticalError,
};

Expand Down
25 changes: 8 additions & 17 deletions zallet/src/components/json_rpc/methods/get_new_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use documented::Documented;
use jsonrpsee::{core::RpcResult, types::ErrorCode as RpcErrorCode};
use schemars::JsonSchema;
use serde::Serialize;
use zaino_state::FetchServiceSubscriber;
use zaino_proto::proto::service::BlockId;
use zaino_state::{FetchServiceSubscriber, LightWalletIndexer};
use zcash_client_backend::{
data_api::{AccountBirthday, WalletRead, WalletWrite},
proto::service::TreeState,
Expand Down Expand Up @@ -57,8 +58,10 @@ pub(crate) async fn call(

let treestate = {
let treestate = chain
.fetcher
.get_treestate(birthday_height.saturating_sub(1).to_string())
.get_tree_state(BlockId {
height: u64::from(u32::from(birthday_height.saturating_sub(1))),
hash: vec![],
})
.await
.map_err(|_| RpcErrorCode::InternalError)?;

Expand All @@ -71,20 +74,8 @@ pub(crate) async fn call(
height: u64::try_from(treestate.height).map_err(|_| RpcErrorCode::InternalError)?,
hash: treestate.hash,
time: treestate.time,
sapling_tree: treestate
.sapling
.commitments()
.final_state()
.as_ref()
.map(hex::encode)
.unwrap_or_default(),
orchard_tree: treestate
.orchard
.commitments()
.final_state()
.as_ref()
.map(hex::encode)
.unwrap_or_default(),
sapling_tree: treestate.sapling_tree,
orchard_tree: treestate.orchard_tree,
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ pub(crate) async fn call(
let consensus_branch_id = consensus::BranchId::for_height(
wallet.params(),
tx.height()
.map(BlockHeight::from_u32)
.and_then(|height| u32::try_from(height).ok().map(BlockHeight::from_u32))
.unwrap_or(mempool_height),
);
let tx =
Expand Down
25 changes: 8 additions & 17 deletions zallet/src/components/json_rpc/methods/recover_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use jsonrpsee::{
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use zaino_state::FetchServiceSubscriber;
use zaino_proto::proto::service::BlockId;
use zaino_state::{FetchServiceSubscriber, LightWalletIndexer};
use zcash_client_backend::{
data_api::{Account as _, AccountBirthday, WalletRead, WalletWrite},
proto::service::TreeState,
Expand Down Expand Up @@ -87,8 +88,10 @@ pub(crate) async fn call(

let treestate = {
let treestate = chain
.fetcher
.get_treestate(treestate_height.to_string())
.get_tree_state(BlockId {
height: u64::from(u32::from(treestate_height)),
hash: vec![],
})
.await
.map_err(|e| {
LegacyCode::InvalidParameter.with_message(format!(
Expand All @@ -105,20 +108,8 @@ pub(crate) async fn call(
height: u64::try_from(treestate.height).map_err(|_| RpcErrorCode::InternalError)?,
hash: treestate.hash,
time: treestate.time,
sapling_tree: treestate
.sapling
.commitments()
.final_state()
.as_ref()
.map(hex::encode)
.unwrap_or_default(),
orchard_tree: treestate
.orchard
.commitments()
.final_state()
.as_ref()
.map(hex::encode)
.unwrap_or_default(),
sapling_tree: treestate.sapling_tree,
orchard_tree: treestate.orchard_tree,
}
};

Expand Down
2 changes: 1 addition & 1 deletion zallet/src/components/json_rpc/methods/view_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ impl WalletTxInfo {
let tx_index = block
.vtx
.iter()
.find(|ctx| ctx.hash == tx.txid().as_ref())
.find(|ctx| ctx.txid == tx.txid().as_ref())
.map(|ctx| u32::try_from(ctx.index).expect("Zaino should provide valid data"));

(
Expand Down
13 changes: 9 additions & 4 deletions zallet/src/components/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ pub(crate) use error::SyncError;
mod steps;
use steps::ChainBlock;

fn zaino_tx_height_to_block_height(height: i32) -> Option<BlockHeight> {
u32::try_from(height).ok().map(BlockHeight::from_u32)
}

#[derive(Debug)]
pub(crate) struct WalletSync {}

Expand Down Expand Up @@ -601,7 +605,7 @@ pub(crate) async fn fetch_transparent_utxos(

let parse_height = tx_obj
.height()
.map(BlockHeight::from_u32)
.and_then(zaino_tx_height_to_block_height)
.unwrap_or(mined_height);
let tx = match Transaction::read(
tx_obj.hex().as_ref(),
Expand Down Expand Up @@ -681,7 +685,7 @@ async fn data_requests(
Ok(zebra_rpc::methods::GetRawTransaction::Raw(_)) => unreachable!(),
Ok(zebra_rpc::methods::GetRawTransaction::Object(tx)) => tx
.height()
.map(BlockHeight::from_u32)
.and_then(zaino_tx_height_to_block_height)
.map(TransactionStatus::Mined)
.unwrap_or(TransactionStatus::NotInMainChain),
// TODO: Zaino is not correctly parsing the error response, so we
Expand Down Expand Up @@ -712,7 +716,8 @@ async fn data_requests(
// with an enum variant that should never occur.
Ok(zebra_rpc::methods::GetRawTransaction::Raw(_)) => unreachable!(),
Ok(zebra_rpc::methods::GetRawTransaction::Object(tx)) => {
let mined_height = tx.height().map(BlockHeight::from_u32);
let mined_height =
tx.height().and_then(zaino_tx_height_to_block_height);

// TODO: Zaino should either be doing the tx parsing for us,
// or telling us the consensus branch ID for which the tx is
Expand Down Expand Up @@ -841,7 +846,7 @@ async fn data_requests(
zebra_rpc::methods::GetRawTransaction::Object(tx) => tx,
};

let mined_height = tx.height().map(BlockHeight::from_u32);
let mined_height = tx.height().and_then(zaino_tx_height_to_block_height);

// Ignore transactions that don't match the status filter.
match (&req.tx_status_filter(), mined_height) {
Expand Down
2 changes: 1 addition & 1 deletion zallet/src/components/sync/steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ async fn fetch_compact_block_inner(
.into_iter()
.map(|ctx| CompactTx {
index: ctx.index,
txid: ctx.hash,
txid: ctx.txid,
fee: ctx.fee,
spends: ctx
.spends
Expand Down
3 changes: 2 additions & 1 deletion zallet/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ impl Network {
canopy: local_network.canopy.map(|h| h.into()),
nu5: local_network.nu5.map(|h| h.into()),
nu6: local_network.nu6.map(|h| h.into()),
nu6_1: None,
nu6_1: local_network.nu6_1.map(|h| h.into()),
nu6_2: local_network.nu6_2.map(|h| h.into()),
nu7: None,
})
}
Expand Down
Loading