Skip to content

fix(wallet): validate mint signatures when receiving proofs - #2534

Closed
asmogo wants to merge 1 commit into
cashubtc:mainfrom
asmogo:feat/validate-receive-signatures
Closed

asmogo wants to merge 1 commit into
cashubtc:mainfrom
asmogo:feat/validate-receive-signatures

Conversation

@asmogo

@asmogo asmogo commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Description

Receiving ecash could accept a mint swap response with an invalid DLEQ proof or a mismatched amount or keyset, credit unusable proofs, and delete the recovery record. Validate returned blind signatures against the requested outputs before constructing or storing proofs.

Invalid responses now leave the receive saga and transaction pending so recovery can obtain valid signatures later. Valid responses remain supported with or without optional DLEQ proofs.

Notes to the reviewers

Reproduced on upstream main e294f845 before applying the fix. Five regression tests cover invalid DLEQ proofs, amount/keyset/count mismatches, preserved recovery, and valid responses with and without DLEQ proofs. This is independent of #2516, which adds Nostr payment-request validation and operation linkage.

Local validation:

  • cargo fmt --all -- --check
  • cargo clippy -p cdk --all-targets --offline -- -D warnings
  • cargo test -p cdk --lib --offline: 693 tests passed in the sandbox; the three tests requiring local TCP listeners passed when rerun with the necessary permissions (696 total).

Suggested CHANGELOG Updates

FIXED

  • Validate mint-returned blind signatures when receiving ecash and preserve recovery state after rejecting an invalid response.

Checklist

  • I followed the code style guidelines.
  • I ran just quick-check before committing. Scoped formatting, Clippy, and CDK library tests were run as listed above.
  • FFI synchronization checked: no public Wallet API signatures or types changed.

@github-project-automation github-project-automation Bot moved this to Backlog in CDK Sep 11, 2026
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.93%. Comparing base (e294f84) to head (5867ca2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2534      +/-   ##
==========================================
+ Coverage   79.88%   79.93%   +0.04%     
==========================================
  Files         387      387              
  Lines      106600   106744     +144     
==========================================
+ Hits        85158    85321     +163     
+ Misses      21442    21423      -19     

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

@thesimplekid

Copy link
Copy Markdown
Collaborator

Duplicate of #2511?

thesimplekid added a commit to thesimplekid/cdk that referenced this pull request Sep 12, 2026
Adapt the receive regression tests from cashubtc#2534 to check invalid DLEQ,
amount, keyset, and signature counts, preserved pending state, successful
recovery, and valid signatures with and without optional DLEQ proofs.

Validate against existing premint messages to avoid cloning the requested
outputs while retaining contextual warnings.

Co-authored-by: asmo <asmogo@protonmail.com>
@thesimplekid

Copy link
Copy Markdown
Collaborator

Few better tests I took from here and put on #2511

@github-project-automation github-project-automation Bot moved this from Backlog to Done in CDK Sep 12, 2026
thesimplekid added a commit to thesimplekid/cdk that referenced this pull request Sep 15, 2026
Adapt the receive regression tests from cashubtc#2534 to check invalid DLEQ,
amount, keyset, and signature counts, preserved pending state, successful
recovery, and valid signatures with and without optional DLEQ proofs.

Validate against existing premint messages to avoid cloning the requested
outputs while retaining contextual warnings.

Co-authored-by: asmo <asmogo@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants