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

tests: functional tests for BIP-322 message signing and proof of funds

Public commit record

What the developer wrote

Authored by Ruben Waterman

88/100 · Strong
tests: functional tests for BIP-322 message signing and proof of funds

Adds test_utils/bip0322.py (to_spend/to_sign PSBT builders, sighash
recomputation, signature verification and smp encoding helpers),
musig() support in test_utils/wallet_policy.py's plain descriptor
derivation, and a ragger suite covering:
- P2WPKH, P2TR, legacy P2PKH, registered 2-of-2 multisig, and musig()
(taproot keypath and scriptpath) signings, each verifying the
returned signature against an independently recomputed sighash;
- the address being proven on a change address, the empty message,
and an explicit SIGHASH_ALL on a taproot input;
- proof of funds (P2WPKH and P2TR), verifying every input's signature
and the on-screen total; the unverified inputs warning is shown for
a real input missing the non-witness utxo, but never for the
to_spend input; proof-of-funds inputs may also have a final
sequence, explicit or implied by an omitted PSBT_IN_SEQUENCE;
- long and short non-printable messages (hash display);
- the review rejected by the user;
- rejections: message/to_spend mismatch, first input not spending
output 0 of to_spend, non-zero amounts, OP_RETURN with a data push,
extra outputs, invalid tx version, timelocks (non-zero locktime,
non-zero or omitted sequence on the first input, relative timelock
on a proof-of-funds input), external proof-of-funds inputs, and
non-ALL sighashes (refused by the generic sighash gating by
default, and by the BIP-322 validation when the non-standard
sighash setting is enabled).

The message is set with the client's PSBT.generic_signed_message.

Golden snapshots for all five devices.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Salvatore Ingala <6681844+bigspider@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit only adds automated tests and test helper code for a new Bitcoin message-signing feature (BIP-322). It does not change the actual Ledger app firmware that users run, so it cannot by itself introduce a security vulnerability in shipped software. The tests exercise both valid and invalid signing requests, including many cases designed to make the device reject malformed or suspicious inputs.

Recommended action

No security action required; treat as routine test coverage. If reviewing the related BIP-322 firmware implementation, ensure the rejection logic exercised by these tests is correctly implemented in the app source (not shown in this commit).

Security signals we found

01

No firmware/source code changes; test-only commit

02

Tests include negative/rejection cases for malformed BIP-322 PSBTs

03

Tests verify signatures against independently recomputed sighashes

04

Tests cover proof-of-funds external-input rejection and unverified-input warnings

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/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.