Skip to content

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

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

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

Conversation

@robwoodgate

@robwoodgate robwoodgate commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

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/29 mint quote signatures, and reuses their helpers.


Notes to the reviewers

  • The mint accepts the v1 and current message formats (sig_all_msgs_to_verify), and wallet signing produces both, so requests verify on mints on either side of the upgrade. The pre-0.14 format is neither signed nor accepted: it does not commit to C values or output amounts, and test_sig_all_should_reject_if_the_output_amounts_are_swapped covers this.
  • valid_signatures_any_msg counts each pubkey at most once across formats, so a multi-format witness cannot trip DuplicateSignature.
  • The witness length cap is split from the secret cap (MAX_PROOF_WITNESS_LEN, 8192 bytes) so multisig witnesses carrying one signature per format per signer still fit.
  • Canonical vectors from the spec's tests/11-test.md are pinned in the nut11 test module.
  • Ran on stable 1.96 in a container: cargo test -p cashu --features mint,wallet,nostr, cargo test -p cdk --lib, cargo clippy -p cashu --all-targets, cargo fmt --check.

Suggested CHANGELOG Updates

CHANGED

  • SIG_ALL verification accepts the length-framed v1 message alongside the current format, counting unique pubkeys with valid signatures and ignoring signatures that do not verify
  • Proof witness length is capped separately from secret length (8192 bytes)

ADDED

  • NUT-11 v1 length-framed SIG_ALL message; sign_sig_all signs all accepted message formats

Checklist

  • I followed the code style guidelines
  • I ran just quick-check before committing (ran the equivalent commands listed above on stable in a container)
  • If the Wallet API was modified (added/removed/changed), I have reflected those changes in the FFI bindings (crates/cdk-ffi) — not modified

@github-project-automation github-project-automation Bot moved this to Backlog in CDK Jul 17, 2026
@robwoodgate
robwoodgate marked this pull request as ready for review July 17, 2026 22:31
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.01%. Comparing base (8716e53) to head (c64c544).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2232      +/-   ##
==========================================
+ Coverage   76.99%   77.01%   +0.01%     
==========================================
  Files         379      379              
  Lines       96708    96823     +115     
==========================================
+ Hits        74460    74566     +106     
- Misses      22248    22257       +9     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

asmogo
asmogo previously approved these changes Jul 21, 2026
@asmogo

asmogo commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

@cdk-bot review

@thesimplekid

Copy link
Copy Markdown
Collaborator

@cdk-bot review

Seem like the bot took a nap last night. Should be back up and reviewing now

@robwoodgate

Copy link
Copy Markdown
Contributor Author

Removed the legacy signing format this PR had re-added.

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. Wallet signing helpers sign
v1, current and legacy so requests verify on mints at any upgrade
stage. Witness length gets its own cap to fit one signature per
format per signer. Canonical vectors from the NUT-11 spec tests are
pinned in the test suite.
Wallets sign v1 and current; the pre-0.14 message (secrets then B_
values) is no longer produced, as it does not commit to C values or
output amounts (cashubtc/nuts#404). Mint verification is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants