Skip to content
Open
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
9 changes: 9 additions & 0 deletions .github/helpers/check-dep-graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
'zip32',
])

# Maps cargo package names to the logical name used in README.md's mermaid graph.
# The workspace imports `orchard` via the `valar-orchard` crates.io package using
# cargo's `package = "valar-orchard"` rename, so `cargo tree` reports the real
# package name `valar-orchard` while the README uses the alias `orchard`.
PACKAGE_NAME_REMAP = {
'valar-orchard': 'orchard',
}

def main():
script_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.dirname(os.path.dirname(script_dir))
Expand Down Expand Up @@ -79,6 +87,7 @@ def main():
continue
(depth, crate, _) = line.strip().split(' ', 2)
depth = int(depth)
crate = PACKAGE_NAME_REMAP.get(crate, crate)

if depth == 0:
crate_stack = [crate]
Expand Down
87 changes: 44 additions & 43 deletions Cargo.lock

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

13 changes: 11 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ redjubjub = { version = "0.8", default-features = false }
sapling = { package = "sapling-crypto", version = "0.6.2", default-features = false }

# - Orchard
orchard = { version = "0.12", default-features = false }
#
# Points at the Valar Group `valar-orchard` fork on crates.io, aliased locally to
# `orchard` so every member still writes `use orchard::…`. The fork is
# upstream-0.12.0 + post-release fixes (up to zcash/orchard 6b12c77) + governance-
# visibility additions needed by the shielded-voting circuits in
# valargroup/voting-circuits. Drop back to `orchard = "0.12"` once those
# visibility changes land in zcash/orchard upstream.
orchard = { version = "0.12.0", package = "valar-orchard", default-features = false }
pasta_curves = "0.5"

# - Transparent
Expand Down Expand Up @@ -231,4 +238,6 @@ unexpected_cfgs = { level = "warn", check-cfg = [

[patch.crates-io]
sapling = { package = "sapling-crypto", git = "https://github.com/zcash/sapling-crypto.git", rev = "b8a81c22f034d68f9bbd6cba728aab807b9ba2ea" }
orchard = { package = "orchard", git = "https://github.com/zcash/orchard.git", rev = "b0bf2670e248958c6ce7c1deed466032e0dbd4d9" }
# No orchard patch: the workspace resolves `orchard` via its `package = "valar-orchard"`
# alias on crates.io, which already carries the post-0.12.0 upstream fixes plus the
# governance-visibility additions.
1 change: 1 addition & 0 deletions pczt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace.
- `pczt::ExtractError`
- `pczt::EffectsOnly`
- `pczt::orchard::Spend::spend_auth_sig` getter (via `getset`).
- `pczt::roles::signer::Signer::shielded_sighash` getter.
- `pczt::roles::signer`:
- `Signer::sighash`
- `Signer::append_transparent_signature`
Expand Down
4 changes: 2 additions & 2 deletions pczt/src/roles/signer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Signer {
/// Calculates the signature digest that must be signed to authorize shielded spends.
///
/// This can be used to produce a signature externally suitable for passing to e.g.
/// [`Self::apply_orchard_signature`].}
/// [`Self::apply_orchard_signature`].
pub fn shielded_sighash(&self) -> [u8; 32] {
self.shielded_sighash
}
Expand All @@ -89,7 +89,7 @@ impl Signer {
/// spend at the given index.
///
/// This can be used to produce a signature externally suitable for passing to e.g.
/// [`Self::append_transparent_signature`].}
/// [`Self::append_transparent_signature`].
///
/// Returns an error if `index` is invalid for this PCZT.
pub fn transparent_sighash(&self, index: usize) -> Result<[u8; 32], Error> {
Expand Down
8 changes: 4 additions & 4 deletions supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,6 @@ criteria = "safe-to-deploy"
version = "11.1.4"
criteria = "safe-to-deploy"

[[exemptions.orchard]]
version = "0.12.0@git:b0bf2670e248958c6ce7c1deed466032e0dbd4d9"
criteria = "safe-to-deploy"

[[exemptions.ordered-float]]
version = "2.10.1"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -1588,6 +1584,10 @@ criteria = "safe-to-deploy"
version = "1.8.0"
criteria = "safe-to-deploy"

[[exemptions.valar-orchard]]
version = "0.12.0"
criteria = "safe-to-deploy"

[[exemptions.wait-timeout]]
version = "0.2.0"
criteria = "safe-to-deploy"
Expand Down
16 changes: 16 additions & 0 deletions zcash_client_sqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ workspace.
- `impl<'conn, P, CL, R> WalletWrite for WalletDb<SqlTransaction<'conn>, P, CL, R>` to
enable calling `WalletWrite` methods inside `WalletDb::transactionally` (amortizing the
database transaction overhead).
- `WalletDb::get_unspent_orchard_notes_at_historical_height` returns all Orchard
notes that existed and were unspent at a given height.
- `WalletDb::generate_orchard_witnesses_at_historical_height` generates Merkle
witnesses at a historical height using an ephemeral in-memory
`shardtree::store::memory::MemoryShardStore`.
- Two new `orchard`-gated variants have been added to
`zcash_client_sqlite::error::SqliteClientError` to surface the failure modes
of `WalletDb::generate_orchard_witnesses_at_historical_height`:
- `HistoricalFrontierInvalid(shardtree::error::InsertionError)` —
the caller-supplied frontier is inconsistent with the shard data
reconstructed from the wallet at the requested height.
- `HistoricalWitnessUnavailable { position, height }` — no witness can be
produced for the specified position at the specified height (the wallet
most likely has not synced through that height).
Shard-read failures continue to surface via the existing
`SqliteClientError::CommitmentTree` variant.

### Changed
- The `accounts` table now stores IVK item caches instead of FVK item caches for
Expand Down
46 changes: 46 additions & 0 deletions zcash_client_sqlite/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
use std::error;
use std::fmt;

#[cfg(feature = "orchard")]
use incrementalmerkletree::Position;
use nonempty::NonEmpty;
#[cfg(feature = "orchard")]
use shardtree::error::InsertionError;
use shardtree::error::ShardTreeError;

#[cfg(feature = "transparent-key-import")]
Expand Down Expand Up @@ -116,6 +120,35 @@ pub enum SqliteClientError {
/// commitment trees.
CommitmentTree(ShardTreeError<commitment_tree::Error>),

/// The caller-supplied frontier passed to
/// [`WalletDb::generate_orchard_witnesses_at_historical_height`] is
/// inconsistent with the shard data reconstructed from the wallet at the
/// requested height.
///
/// [`WalletDb::generate_orchard_witnesses_at_historical_height`]:
/// crate::WalletDb::generate_orchard_witnesses_at_historical_height
#[cfg(feature = "orchard")]
HistoricalFrontierInvalid(InsertionError),

/// A witness could not be generated for the specified position at the
/// specified historical height in a call to
/// [`WalletDb::generate_orchard_witnesses_at_historical_height`].
///
/// The wallet most likely has not synced through `height`, the checkpoint
/// at `height` has been pruned, or `position` does not belong to the
/// wallet.
///
/// [`WalletDb::generate_orchard_witnesses_at_historical_height`]:
/// crate::WalletDb::generate_orchard_witnesses_at_historical_height
#[cfg(feature = "orchard")]
HistoricalWitnessUnavailable {
/// The note commitment tree position for which a witness was
/// requested.
position: Position,
/// The historical height at which the witness was requested.
height: BlockHeight,
},

/// The block at the specified height was not available from the block cache.
CacheMiss(BlockHeight),

Expand Down Expand Up @@ -187,6 +220,8 @@ impl error::Error for SqliteClientError {
SqliteClientError::Io(e) => Some(e),
SqliteClientError::BalanceError(e) => Some(e),
SqliteClientError::AddressGeneration(e) => Some(e),
#[cfg(feature = "orchard")]
SqliteClientError::HistoricalFrontierInvalid(e) => Some(e),
_ => None,
}
}
Expand Down Expand Up @@ -272,6 +307,17 @@ impl fmt::Display for SqliteClientError {
f,
"An error occurred accessing or updating note commitment tree data: {err}."
),
#[cfg(feature = "orchard")]
SqliteClientError::HistoricalFrontierInvalid(err) => write!(
f,
"The frontier supplied to generate_orchard_witnesses_at_historical_height is inconsistent with the wallet's shard data: {err}"
),
#[cfg(feature = "orchard")]
SqliteClientError::HistoricalWitnessUnavailable { position, height } => write!(
f,
"No witness is available for position {} at height {height} (the wallet may need to sync through this height).",
u64::from(*position),
),
SqliteClientError::CacheMiss(height) => write!(
f,
"Requested height {height} does not exist in the block cache."
Expand Down
Loading
Loading