Skip to content

Commit db34ab8

Browse files
veetragjainclaude
authored andcommitted
feat(wasm-utxo): add orchard (no-circuit) dep + Ironwood PCZT serialization
Introduce the `orchard` crate WITHOUT the `circuit` feature (Sinsemilla / pasta / note-encryption only — no halo2 prover) plus `rand`, `postcard`, and `ff`, and add the `zcash::ironwood_pczt` module that (de)serializes an `orchard::pczt::Bundle`. `orchard::pczt::Bundle` is not serde-serializable, so this bridges it to a compact wire form: a 1-byte format version + a `postcard`-encoded mirror struct whose fields are exactly what orchard's `Bundle/Action/Spend/ Output::parse(...)` consume. Serialize reads the bundle's public getters; deserialize reconstructs via `parse(...)`. This is the witness payload exchanged with the external Ironwood proof service and carried through the PSBT (proving is delegated; no halo2 in wasm-utxo). Notes: - `>32`-byte fields are stored as `Vec<u8>` (serde derives arrays only up to length 32) and length-checked on the way back in. - `note_version` is derived from the bundle version rather than carried on the wire; `zip32_derivation` (wallet metadata the prover doesn't need) is dropped. - `serde` is now a non-optional dependency (the module derives Serialize/Deserialize); the `inspect` feature drops its `dep:serde`. Verified: compiles for wasm32-unknown-unknown and native; a build -> serialize -> deserialize -> re-serialize round-trip is byte-stable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eba18e5 commit db34ab8

4 files changed

Lines changed: 585 additions & 8 deletions

File tree

packages/wasm-utxo/Cargo.lock

Lines changed: 106 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/wasm-utxo/Cargo.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [
2222

2323
[features]
2424
default = []
25-
inspect = ["dep:num-bigint", "dep:serde", "dep:serde_json", "dep:hex"]
25+
inspect = ["dep:num-bigint", "dep:serde_json", "dep:hex"]
2626

2727
[dependencies]
2828
wasm-bindgen = "0.2"
@@ -37,10 +37,24 @@ musig2 = { version = "0.3.1", default-features = false, features = ["k256"] }
3737
getrandom = { version = "0.2", features = ["js"] }
3838
pastey = "0.1"
3939
num-bigint = { version = "0.4", optional = true }
40-
serde = { version = "1.0", features = ["derive"], optional = true }
40+
# serde is non-optional: the Ironwood PCZT serialization (always compiled) derives Serialize/
41+
# Deserialize for its postcard mirror struct.
42+
serde = { version = "1.0", features = ["derive"] }
4143
serde_json = { version = "1.0", optional = true }
4244
hex = { version = "0.4", optional = true }
4345

46+
# Orchard/Ironwood shielded-bundle construction (PCZT Constructor/Signer/Extractor).
47+
# `default-features = false` DROPS the `circuit` feature, so halo2_proofs/halo2_gadgets
48+
# (the heavy prover) are NOT pulled in — only Sinsemilla/pasta/note-encryption. Proving is
49+
# delegated to an external service.
50+
orchard = { version = "0.15", default-features = false, features = ["std"] }
51+
rand = "0.8"
52+
# Compact deterministic encoding of the Ironwood PCZT witness (proof-service payload / PSBT carry).
53+
postcard = { version = "1.0", features = ["use-std"] }
54+
# `ff::PrimeField::to_repr` for the one PCZT witness field (`alpha`, a Pallas scalar) that orchard
55+
# exposes only as a curve scalar. Already in-tree via orchard/pasta_curves.
56+
ff = "0.13"
57+
4458
# Pinned to avoid RUSTSEC-2026-0204 (invalid pointer dereference in fmt::Pointer)
4559
crossbeam-epoch = ">=0.9.20"
4660

0 commit comments

Comments
 (0)