Commit message · Adam Tuckerfix(zcash): sign shielded PCZTs without RoleSigner to fit the device stack
The cypherpunk shielded PCZT signing path used the upstream pczt RoleSigner,
which reconstructs a full TransactionData for every bundle just to compute the
32-byte ZIP-244 sighash. That setup alone needs ~61 KB of stack, well over the
26 KB UiDisplayTask budget, so signing an Orchard->Ironwood migration batch
overflowed the task stack and the device reset into firmware verification.
Replace RoleSigner with the lean signer used before Ironwood: low_level_signer
driven in place, with the sighash computed by the in-repo byte-level
pczt_ext::shielded_sig_commitment instead of a TransactionData rebuild. Extend
that hasher to the v6 (NU6.3) Orchard and Ironwood commitment domains so it
stays correct for migration transactions. This restores the pre-Ironwood
signing footprint (~45 KB on host, the same as the path that already signs
shielded Orchard on shipping Keystones) while supporting Ironwood.
pczt_ext (zcash_vendor):
- digest_orchard_v6 / digest_ironwood_v6 and a v6 branch in
shielded_sig_commitment: v6 bundle personalizations, anchor omitted from the
effects digest, the 5-node to_hash_v6 layout.
- sign_ironwood driver mirroring sign_orchard; a shared sign_orchard_action
that defers the sign/skip decision to the signer (wallet-controlled
zero-value spends are still signed; tx_modifiable is cleared only when a new
signature is added).
app_zcash:
- A lean SeedSigner (PcztSigner) deriving keys and signing actions in place,
preserving the strict per-action validation from the removed collect path
(ZIP 32 derivation shape, dummy_sk rules, already-signed skip, per-account
key cache, PcztNoMyInputs).
- validate_supported_pczt rejects v6 PCZTs carrying a Sapling spend: the lean
hasher implements the Orchard/Ironwood v6 domains but not the v6 Sapling-spend
domain (distinct noncompact personalization, anchor omitted). Keystone never
signs Sapling spends; Sapling outputs are version-independent and remain
supported.
Oracle tests assert the lean sighash is bit-exact against
RoleSigner::shielded_sighash for Orchard-only, dual-pool migration, and
Ironwood-spend shapes, so any upstream sighash change fails CI rather than
producing wrong on-device signatures.
100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
Why it was queuedsigning boundarymemory safetydefensive validationsigning or wallet path
AI analysis · Moderate 54/100This commit fixes a crash in the Keystone hardware wallet when signing certain advanced Zcash transactions. The previous code used a heavy upstream signing helper that needed too much memory, causing the device to reset during an Orchard-to-Ironwood migration. The patch replaces it with a leaner, in-house signer and adds the new v6/Ironwood hash logic needed to keep signatures valid. It also rejects v6 transactions containing Sapling spends because the lean signer does not yet support that specific hash domain.