Skip to content

feat: verify and sign the length-framed NUT-11 SIG_ALL message - #1088

Open
robwoodgate wants to merge 6 commits into
cashubtc:mainfrom
robwoodgate:feat/sigall-v1
Open

feat: verify and sign the length-framed NUT-11 SIG_ALL message#1088
robwoodgate wants to merge 6 commits into
cashubtc:mainfrom
robwoodgate:feat/sigall-v1

Conversation

@robwoodgate

@robwoodgate robwoodgate commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Implements the length-framed NUT-11 SIG_ALL message aggregation (Cashu_SigAllSig_v1) proposed in cashubtc/nuts#404. The new format matches the domain separation and length framing already used for NUT-20 mint quote signatures.

  • The mint verifies the v1 and current message formats, counts unique public keys with valid signatures, and ignores signatures that do not verify (including malformed ones, which previously aborted the verification loop)
  • The wallet signs the v1 and current formats, so its transactions verify on mints on either side of the upgrade
  • Melt verification passes the quote id instead of a prebuilt message string; each format binds the quote per its own rules
  • Canonical vectors from the spec's tests/11-test.md are pinned in tests/nuts/test_nut11_test_vectors.py

Draft until cashubtc/nuts#404 settles.

The mint accepts the v1 ("Cashu_SigAllSig_v1") and current message
formats, counting unique public keys with valid signatures and
ignoring signatures that do not verify. The wallet signs v1, current
and legacy so its transactions verify on mints at any upgrade stage.
Canonical vectors from the NUT-11 spec tests are pinned in the test
suite.
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.46%. Comparing base (0ae760f) to head (7c9ec52).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cashu/mint/conditions.py 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1088      +/-   ##
==========================================
+ Coverage   74.35%   74.46%   +0.10%     
==========================================
  Files         115      115              
  Lines       13155    13175      +20     
==========================================
+ Hits         9782     9811      +29     
+ Misses       3373     3364       -9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@robwoodgate
robwoodgate marked this pull request as ready for review July 17, 2026 22:32
@ye0man
ye0man requested review from KvngMikey and a1denvalu3 July 20, 2026 12:22

@KvngMikey KvngMikey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK @ 0111594

Just the final agreement on the legacy format left.

@robwoodgate

Copy link
Copy Markdown
Contributor Author

ACK @ 0111594

Just the final agreement on the legacy format left.

My recommendation would be current ('v0') and the proposed 'v1' only, the legacy MTS should be dropped unilaterally. SIG_ALL is a pretty niche feature, so I think the benefit of dropping it outweighs the inconvenience to older wallets.

Wallets sign v1 and current; the pre-0.21 message (secrets then B_
fields) is no longer produced, as it does not commit to C values or
output amounts (cashubtc/nuts#404). Mint verification is unchanged.
@robwoodgate

Copy link
Copy Markdown
Contributor Author

I have removed the legacy signing format this PR had re-added

# Conflicts:
#	cashu/mint/conditions.py
#	cashu/mint/ledger.py
#	cashu/wallet/p2pk.py
#	tests/mint/test_mint_conditions.py
#	tests/nuts/test_nut11_test_vectors.py
Restore cashu/mint/ledger.py byte-for-byte to main: the merge
resolution normalized its mixed line endings, which made the whole
file show as changed. Give the transaction unit test outputs
even-length hex B_ values: the v1 SIG_ALL message decodes them to
raw bytes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants