Skip to content

feat: add issued_count and redeemed_count to keyset_amounts#2008

Open
Forte11Cuba wants to merge 1 commit into
cashubtc:mainfrom
Forte11Cuba:feat/keyset-volume-counters
Open

feat: add issued_count and redeemed_count to keyset_amounts#2008
Forte11Cuba wants to merge 1 commit into
cashubtc:mainfrom
Forte11Cuba:feat/keyset-volume-counters

Conversation

@Forte11Cuba

Copy link
Copy Markdown
Contributor

Description

Add issued_count and redeemed_count columns to the keyset_amounts table to track per-keyset operation counts (number of blind signatures issued and proofs redeemed) alongside the existing amount totals (total_issued, total_redeemed).

These counters are the foundation for the volume-based rotation trigger described in #1999 (Keyset Autorotate & Auto-Prune). They are incremented atomically in the same transaction as the underlying blind_signature insert and proof state update, so they cannot drift under normal operation.


Notes to the reviewers


CHANGED

ADDED

  • issued_count and redeemed_count columns to keyset_amounts table (SQLite + Postgres migrations with backfill)
  • get_total_issued_count method on SignaturesDatabase trait
  • get_total_redeemed_count method on ProofsDatabase trait

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)

@github-project-automation github-project-automation Bot moved this to Backlog in CDK May 26, 2026
@Forte11Cuba Forte11Cuba force-pushed the feat/keyset-volume-counters branch from 75c2912 to 98461e6 Compare May 26, 2026 18:58
@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.65772% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.84%. Comparing base (f0e028c) to head (98461e6).

Files with missing lines Patch % Lines
crates/cdk-sql-common/src/mint/proofs.rs 90.00% 1 Missing ⚠️
crates/cdk-sql-common/src/mint/signatures.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2008      +/-   ##
==========================================
+ Coverage   67.76%   67.84%   +0.07%     
==========================================
  Files         353      353              
  Lines       67840    67989     +149     
==========================================
+ Hits        45975    46130     +155     
+ Misses      21865    21859       -6     

☔ View full report in Codecov by Sentry.
📢 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.

1 participant