Commit Graph

1459 Commits

Author SHA1 Message Date
thesimplekid
7b18e47ce5 Merge pull request #962 from thesimplekid/justfile_errors
Reduce clippy ci and catch errors in justfile scripts
2025-08-14 18:17:08 +01:00
thesimplekid
28ef002c34 Merge pull request #964 from gudnuf/fix/bolt12-internal-settlment
fix: allow paid and issued bolt12 quotes to settle internally
2025-08-14 09:41:51 +01:00
gudnuf
325afd75f7 fix: allow paid and issued bolt12 quotes to settle internally 2025-08-13 19:14:43 -07:00
thesimplekid
8578e8532b Merge pull request #957 from thesimplekid/bump_msrv_1.85
feat: bump msrv from 1.75.0 to 1.85.0
2025-08-13 22:13:51 +01:00
thesimplekid
c563bc53a4 Merge pull request #961 from thesimplekid/nutshell_tests
fix: nutshell itests
2025-08-13 21:41:51 +01:00
thesimplekid
500aae862e Merge pull request #960 from thesimplekid/free_disk_ci
chore: free disk space on ci
2025-08-13 21:41:39 +01:00
thesimplekid
31459fcb95 fix: nutshell itests 2025-08-13 20:14:38 +01:00
thesimplekid
8c66114b27 chore: free disk space on ci 2025-08-13 19:46:22 +01:00
thesimplekid
9f7a632056 fix: fake mint multiple units (#958) 2025-08-13 17:14:12 +01:00
thesimplekid
47c5bb7465 fix: fake mint multiple units 2025-08-13 13:59:32 +01:00
C
64f7b07855 Do not perform external calls during a database transaction. (#954)
The codebase was used to correctly perform signatory calls during a database
transaction, as the signatory was previously exclusively in process. However, a
few months ago, it was changed to be a trait that can be either local or
remote. Making external calls to services, adding latency, during an ongoing
database transaction is a bad idea because it will lock the rows until the
service call is finalized, which is unpredictable.

The issue is even worse in our pipeline where the SQLite storage driver is used
with the ":memory:" path, which forces the Database pool to have a size of 1.
Since our tests run in parallel, they would randomly fail.

This issue was failing in the CI, but the error was not making the pipeline
fail. This bug was fixed as well.
2025-08-13 12:25:59 +01:00
thesimplekid
ec9108d69d feat: bump msrv from 1.75.0 to 1.85.0 2025-08-13 10:56:09 +01:00
thesimplekid
021a42280f fix: sqlite drop melt request (#956) 2025-08-13 10:52:53 +01:00
thesimplekid
12b707ac3d fix: sqlite drop melt request 2025-08-13 09:00:02 +01:00
thesimplekid
5d98fdf353 Keyset counter (#950)
* feat: refresh keysets

* fix(cdk): resolve keyset counter skipping index 0 in deterministic secret generation

- Modified Database::get_keyset_counter to return u32 instead of Option<u32>
- Added database migrations to increment existing keyset counters by 1
- Removed counter increment logic from wallet operations to use actual counter value
- Ensures deterministic secret generation starts from index 0 instead of skipping it
2025-08-13 08:54:45 +01:00
thesimplekid
69d0cf0818 Merge pull request #952 from thesimplekid/add_payment_method
fix: add payment method to quote
2025-08-13 08:38:04 +01:00
thesimplekid
ffb0335587 Merge pull request #953 from thesimplekid/drop_melt_request
chore: drop unused mint table melt_request
2025-08-12 18:00:08 +03:00
thesimplekid
e87d818137 chore: drop unused mint table melt_request 2025-08-12 13:21:33 +01:00
thesimplekid
12452680ac fix: add payment method to quote 2025-08-12 13:13:23 +01:00
C
7af054520e Add explicit rollback. (#947)
The proof_writer implicit rollback on Drop is too slow for our tests causing
race conditions with Postgres.

This commit enhances the rollback logic and makes it explicit
2025-08-11 23:54:37 +01:00
thesimplekid
b48604e02c feat: add nix cache to ci (#949)
* feat: add nix cache to ci

* feat: shared caches
2025-08-11 23:35:30 +01:00
thesimplekid
8da03b87e2 Merge pull request #946 from crodas/feature/run-db-operation
Introduce `run_db_operation_sync` and `run_db_operation`
2025-08-11 22:56:22 +03:00
Cesar Rodas
937d9ac43b Introduce run_db_operation_sync and run_db_operation
These functions are designed as a single funnel to talk to the database,
whether it is synchronous or asynchronous.

This single funnel will log SQL queries and slow operations, providing a clear
and unified debug message for the problematic query, so it can be optimized
accordingly (for instance, missing indexes or unbound SQL requests).
2025-08-11 11:55:52 -03:00
thesimplekid
d24a968bd4 Merge pull request #943 from crodas/fix/avoid-empty-proofs-query
Fixed bug to avoid empty calls `get_proofs_states`
2025-08-08 11:01:58 +03:00
Cesar Rodas
2e1099adbe Fixed bug to avoid empty calls get_proofs_states 2025-08-07 22:24:30 -03:00
thesimplekid
5521a377e8 Merge pull request #938 from lollerfirst/new-secret-derivation
New Secret Derivation (Follow up)
2025-08-07 10:53:28 +03:00
lollerfirst
25e38701d8 update to spec 2025-08-06 17:01:52 +02:00
C
ad8f1ece5c Working on a better database abstraction (#931)
* Working on a better database abstraction

After [this question in the chat](https://matrix.to/#/!oJFtttFHGfnTGrIjvD:matrix.cashu.space/$oJFtttFHGfnTGrIjvD:matrix.cashu.space/$I5ZtjJtBM0ctltThDYpoCwClZFlM6PHzf8q2Rjqmso8)
regarding a database transaction within the same function, I realized a few
design flaws in our SQL database abstraction, particularly regarding
transactions.

1. Our upper abstraction got it right, where a transaction is bound with `&mut
   self`, so Rust knows how to handle its lifetime with' async/await'.
2. The raw database does not; instead, it returns &self, and beginning a
   transaction takes &self as well, which is problematic for Rust, but that's not
   all. It is fundamentally wrong. A transaction should take &mut self when
   beginning a transaction, as that connection is bound to a transaction and
   should not be returned to the pool. Currently, that responsibility lies with
   the implementor. If a mistake is made, a transaction could be executed in two
   or more connections.
3. The way a database is bound to our store layer is through a single struct,
   which may or may not internally utilize our connection pool. This is also
   another design flow, in this PR, a connection pool is owned, and to use a
   connection, it should be requested, and that connection is reference with
   mutable when beginning a transaction

* Improve the abstraction with fewer generics

As suggested by @thesimplekid

* Add BEGIN IMMEDIATE for SQLite
2025-08-06 07:58:03 +01:00
gudnuf
cceea654fe feat: enhance auth config (#922)
* feat: enhance auth config
2025-08-05 12:55:17 +01:00
thesimplekid
2bd97e4d80 Merge pull request #928 from lollerfirst/new-secret-derivation
New Secret Derivation
2025-08-04 10:08:21 -04:00
thesimplekid
9ed8536cd0 Merge pull request #934 from thesimplekid/doc_tests
chore: stop test from running
2025-08-03 12:51:55 -04:00
thesimplekid
9f9c96577f chore: stop test from running 2025-08-03 10:14:43 -04:00
thesimplekid
d61a73d5bc docs(DEVELOPMENT.md): clarify Nix usage and add alternative setup instructions (#933) 2025-08-03 00:45:54 -04:00
lollerfirst
92eea181fd new secret derivation
Wallet holds `seed` instead of `xpriv`

fix doctest  errors

update examples

adjustments

fix doctests

fix all doctests

Update crates/cdk/src/wallet/multi_mint_wallet.rs

Co-authored-by: thesimplekid <tsk@thesimplekid.com>

fix

remove clone call
2025-08-02 19:36:20 +02:00
thesimplekid
4b8c8b08da docs(DEVELOPMENT.md): clarify Nix usage and add alternative setup instructions 2025-08-01 22:42:00 -04:00
thesimplekid
3c4fce5c45 feat: add keyset u32 mapping migration (#926)
* feat: add keyset u32 mapping migration and duplicate handling

- Add new database migration (version 3) to include u32 representation for keysets
- Implement migration for both redb and SQL databases
- Add duplicate detection and handling for keyset entries
- Create unique index constraint for keyset_u32 column in SQL
- Update keyset storage to include u32 identifiers
- Handle backwards compatibility for existing databases

* chore: clippy

* refactor(cashu): simplify keyset ID verification logic

- Consolidate match expression into a single expression
- Use direct comparison with ensure_cdk macro
- Improve readability of keyset ID validation

* refactor(cdk): rename `fetch_keyset_keys` to `load_keyset_keys` for clarity

- Renamed `fetch_keyset_keys` to `load_keyset_keys` across multiple modules to better reflect its behavior of loading keys from local storage or fetching from mint when missing.
- Added debug logging to indicate when keys are being fetched from the mint.
- Simplified key loading logic in `update_mint_keysets` by removing redundant existence checks.

* chore: remove unused vec
2025-07-31 10:04:38 -04:00
thesimplekid
3a3cd88ee9 Mintd lib (#914)
* feat(cdk-integration-tests): refactor regtest setup and mintd integration

- Replace shell-based regtest setup with Rust binary (start_regtest_mints)
- Add cdk-mintd crate to workspace and integration tests
- Improve environment variable handling for test configurations
- Update integration tests to use proper temp directory management
- Remove deprecated start_regtest.rs binary
- Enhance CLN client connection with retry logic
- Simplify regtest shell script (itests.sh) to use new binary
- Fix tracing filters and improve error handling in setup
- Update dependencies and configurations for integration tests

fix: killing

chore: comment tests for ci debugging

chore: compile

Revert "chore: comment tests for ci debugging"

This reverts commit bfc594c11cf37caeaa6445cb854ae5567d2da6bd.

* chore: sql cipher

* fix: removal of sqlite cipher

* fix: auth password

* refactor(cdk-mintd): improve database password handling and function signatures

- Pass database password as parameter instead of parsing CLI args in setup_database
- Update function signatures for run_mintd and run_mintd_with_shutdown to accept db_password
- Remove direct CLI parsing from database setup logic
- Fix auth database initialization to use correct type when sqlcipher feature enabled
2025-07-31 00:43:43 -04:00
thesimplekid
9e4b768657 Merge pull request #927 from thesimplekid/goose_in_ci
Goose changelog recipes
2025-07-30 23:56:13 -04:00
thesimplekid
dc19798201 feat(dev): add Goose recipes for changelog and commit message generation
- Add new Goose recipes for generating conventional commit messages and updating changelogs
- Include recipes for both staged changes and recent commits analysis
- Add convenient Just commands for running the new recipes
- Update README with usage instructions for the new recipes ([thesimplekid]).
2025-07-30 23:51:16 -04:00
David Caseria
6ebcbba0c4 refactor: update send functionality across wallet components (#925)
* refactor: update send functionality across wallet components

---------
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-07-30 23:37:41 -04:00
thesimplekid
f663a6e41c Merge pull request #923 from thesimplekid/debug_20_auth
feat(cdk): enable NUT-20 support in mint builder configuration
2025-07-30 20:27:49 -04:00
thesimplekid
cb30b092a5 Merge pull request #920 from vnprc/payment_method_unit_tests
test: add PaymentMethod parsing and db read/write tests
2025-07-30 10:20:06 -04:00
thesimplekid
b5fc4a17c3 fix: include axum in swagger 2025-07-30 10:07:22 -04:00
thesimplekid
9a784fbacd feat(cdk): enable NUT-20 support in mint builder configuration 2025-07-30 09:21:01 -04:00
thesimplekid
d8acf5e5ac chore: update change log (#921) 2025-07-29 22:24:25 -04:00
thesimplekid
c6f6eea1aa chore: update change log 2025-07-29 21:59:29 -04:00
C
8e0c44248b Add NUT-19 support in the wallet (#912)
* Add NUT-19 support in the wallet
2025-07-29 21:45:30 -04:00
thesimplekid
72887341ca Merge pull request #919 from crodas/fix/add-missing-migration
Add missing migrations for wallet and auth db
2025-07-29 21:41:55 -04:00
vnprc
714022fe14 test: add PaymentMethod parsing and db read/write tests 2025-07-29 21:41:45 -04:00
Cesar Rodas
ed7b64b71a Add missing migrations for wallet and auth db 2025-07-29 20:28:09 -03:00