AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 54 Bitcoin

fix(zcash): sign shielded PCZTs without RoleSigner to fit the device stack

Public commit record

What the developer wrote

Authored by Adam Tucker

100/100 · Strong
fix(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.
✓ 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
The short version

What changed, and why it matters

This 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.

Recommended action

Treat this as a reliability/availability fix with consensus-critical cryptographic changes. Review the new v6 sighash constants and 5-node layout against upstream zcash_primitives for bit-exact correctness, ensure the Sapling-spend rejection is enforced at all entry points, and verify the oracle tests run in CI for every future upstream pczt dependency update. Consider stack-size regression tests for the signing task.

Security signals we found

01

Stack overflow / device reset in signing task due to excessive stack usage by upstream RoleSigner

02

Replacement of heavy upstream signer with lean in-repo low_level_signer to fit device stack budget

03

Addition of consensus-critical NU6.3 v6 Orchard/Ironwood sighash domains in pczt_ext

04

Rejection of v6 Sapling spends because the new lean hasher does not cover that domain

05

Oracle tests comparing lean sighash bit-exact against upstream RoleSigner to detect upstream drift

06

Per-account spend-authorizing key cache and strict per-action validation preserved from prior path

Risk score

Why this scored 54/100

Our methodology →
Potential impact 18/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.