Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nutshell cleanup wishlist #332

Merged
merged 179 commits into from
Jan 7, 2024
Merged

Nutshell cleanup wishlist #332

merged 179 commits into from
Jan 7, 2024

Conversation

callebtc
Copy link
Collaborator

@callebtc callebtc commented Oct 6, 2023

This PR upgrades Nutshell to the new v1 API without making use of it explicitly (i.e. we use only Lightning and "sats").

The WIP NUT change is here: cashubtc/nuts#55

Changes:

  • v1 API and backwards-compatible deprecated API
  • Keyset IDs are now hex
  • Mint derives keys with BIP32
  • Old base64 keysets are duplicated as hex (new clients can move to the new format, while old clients remain on b64)
  • New hex keysets are duplicated as base64 (if mint rotates, old clients will expect appropriate b64 keyset to work. Option: do not serve any new keyset on deprecated API and remove this duplication)
  • v1 API serves all keysets (original and duplicates) (original base64, duplicate hex: new clients can use their old ecash and cycle to duplicate hex | original hex, duplicate base64: old clients can keep using the mint after rotation)
  • Deprecated API serves only old base64 keysets
  • Wallet works backwards compatible, falls back to deprecated API if v1 API returns 404
  • Mint supports multiple currency units
  • Mint supports multiple backends
  • New Strike backend
  • Wallet supports multiple currency units
  • Mint returns witness data for spent proofs (if present) in /v1/checkstate

Todos:

  • map methods to backends
  • register currency units
  • wallet: use currency symbols from keysets
  • mint: store multiple keysets for multiple currencies
  • Get rid of invoices table and migrate entries
  • Deferred: Store the backend in the melt_quote and mint_quotes db so that different backends can be used to generate quotes and check their status. Right now only the unit is indicative for the backend used. Maybe good enough for now.
  • Internal transactions should expect 0 fees
  • Tests for deprecated API
  • Test wallet with only deprecated endpoints

@codecov
Copy link

codecov bot commented Oct 7, 2023

Codecov Report

Attention: 497 lines in your changes are missing coverage. Please review.

Comparison is base (375b278) 66.70% compared to head (9cfc2f7) 68.76%.
Report is 1 commits behind head on main.

Files Patch % Lines
cashu/mint/router_deprecated.py 0.00% 115 Missing ⚠️
cashu/lightning/strike.py 16.12% 78 Missing ⚠️
cashu/mint/router.py 0.00% 76 Missing ⚠️
cashu/wallet/cli/cli.py 55.12% 35 Missing ⚠️
cashu/wallet/cli/cli_helpers.py 23.80% 32 Missing ⚠️
cashu/core/logging.py 15.62% 27 Missing ⚠️
cashu/mint/ledger.py 89.44% 23 Missing ⚠️
cashu/core/base.py 89.57% 22 Missing ⚠️
cashu/wallet/wallet.py 94.27% 13 Missing ⚠️
cashu/lightning/fake.py 47.61% 11 Missing ⚠️
... and 13 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #332      +/-   ##
==========================================
+ Coverage   66.70%   68.76%   +2.06%     
==========================================
  Files          68       71       +3     
  Lines        5241     6163     +922     
==========================================
+ Hits         3496     4238     +742     
- Misses       1745     1925     +180     

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

@callebtc callebtc merged commit a518274 into main Jan 7, 2024
11 checks passed
@callebtc callebtc deleted the cleanup_wishlist branch January 7, 2024 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant