Skip to content

feat: align mint quote accounting with NUT-04#2119

Open
thesimplekid wants to merge 2 commits into
cashubtc:mainfrom
thesimplekid:nut04_amount_paid
Open

feat: align mint quote accounting with NUT-04#2119
thesimplekid wants to merge 2 commits into
cashubtc:mainfrom
thesimplekid:nut04_amount_paid

Conversation

@thesimplekid

Copy link
Copy Markdown
Collaborator

Implement the mint quote accounting changes from cashubtc/nuts#377 by exposing amount_paid, amount_issued, and updated_at on mint quote responses.

Keep the deprecated state field only for BOLT11 compatibility while deriving local quote state from the canonical counters for all mint methods. Persist updated_at in wallet quote storage so stale responses cannot move amount_paid or amount_issued backwards.

Description


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

  • I followed the code style guidelines
  • I ran just quick-check before committing
  • If the Wallet API was modified (added/removed/changed), I have reflected those changes in the FFI bindings (crates/cdk-ffi)

@cdk-bot cdk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified findings approved for disclosure:

  • Missing Supabase migration for mint_quote.updated_at (high) - Existing Supabase wallet databases can fail mint quote insert/update paths after this PR because the application sends an updated_at field that the deployed mint_quote table does not have, while startup compatibility checks still accept the old schema version.
    Unanchored locations included in summary:
    • crates/cdk-supabase/src/wallet.rs:2570

Comment thread crates/cdk-supabase/src/wallet.rs
Comment thread crates/cdk-supabase/src/wallet.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf37f626a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/cdk-supabase/src/wallet.rs
Comment thread crates/cdk-npubcash/src/types.rs Outdated
Comment thread crates/cdk/src/wallet/issue/mod.rs
Implement the mint quote accounting changes from cashubtc/nuts#377
by exposing amount_paid, amount_issued, and updated_at on mint quote responses.

Keep the deprecated state field only for BOLT11 compatibility
while deriving local quote state from the canonical counters for all mint methods.
Persist updated_at in wallet quote storage so stale responses cannot move amount_paid or amount_issued backwards.
Add the Supabase mint_quote.updated_at migration and require schema version 8.
Keep imported unpaid NpubCash quotes at updated_at 0 so legacy BOLT11 status
responses can still advance them, and suppress stale websocket notifications
after monotonic quote accounting rejects an update.
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.01609% with 82 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.53%. Comparing base (bfb5b8d) to head (d5257c1).

Files with missing lines Patch % Lines
crates/cdk/src/wallet/streams/payment.rs 70.31% 38 Missing ⚠️
crates/cdk/src/wallet/issue/mod.rs 88.52% 14 Missing ⚠️
crates/cdk-ffi/src/types/quote.rs 10.00% 9 Missing ⚠️
crates/cdk-common/src/mint.rs 77.41% 7 Missing ⚠️
crates/cdk-common/src/mint_quote.rs 42.85% 4 Missing ⚠️
crates/cashu/src/nuts/nut23.rs 50.00% 3 Missing ⚠️
crates/cashu/src/nuts/nut25.rs 0.00% 2 Missing ⚠️
crates/cdk-supabase/src/wallet.rs 0.00% 2 Missing ⚠️
crates/cashu/src/nuts/nut04.rs 75.00% 1 Missing ⚠️
crates/cashu/src/nuts/nut17/mod.rs 96.55% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2119      +/-   ##
==========================================
+ Coverage   71.48%   71.53%   +0.05%     
==========================================
  Files         356      356              
  Lines       73857    74154     +297     
==========================================
+ Hits        52798    53049     +251     
- Misses      21059    21105      +46     

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

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