Commit Graph

747 Commits

Author SHA1 Message Date
thesimplekid
e84d6ea7ab chore: Update rust-version (MSRV) to 1.75.0 (#623) 2025-03-05 10:32:41 +00:00
C
f7d9a1b5db Drop the in-memory database (#613)
* Drop the in-memory database

Fixes #607

This PR drops the implementation of in-memory database traits.

They are useful for testing purposes since the tests should test our codebase
and assume the database works as expected (although a follow-up PR should write
a sanity test suite for all database trait implementors).

As complexity is worth with database requirements to simplify complexity and
add more robustness, for instance, with the following plans to add support for
transactions or buffered writes, it would become more complex and
time-consuming to support a correct database trait. This PR drops the
implementation and replaces it with a SQLite memory instance

* Remove OnceCell<Mint>

Without this change, a single Mint is shared for all tests, and the first tests
to run and shutdown makes the other databases (not-reachable, as dropping the
tokio engine would also drop the database instance).

There is no real reason, other than perhaps performance. The mint should
perhaps run in their own tokio engine and share channels as API interfaces, or
a new instance should be created in each tests

* Fixed bug with foreign keys

[1] https://gist.github.com/crodas/bad00997c63bd5ac58db3c5bd90747ed

* Show more debug on failure

* Remove old code

* Remove old references to WalletMemoryDatabase
2025-03-04 19:44:34 +00:00
thesimplekid
d615897ef0 chore: improve logging in verification 2025-03-04 12:02:05 +00:00
thesimplekid
a82e3eb314 fix: attempt to swap after a failed transaction (#622)
* fix: attempt to swap after a failed transaction

* fix: revert test change in https://github.com/cashubtc/cdk/pull/585
2025-03-03 14:10:47 +00:00
C
63393056a0 Do not use INSERT OR REPLACE in SQLite. (#620)
Instead, use `INSERT` and `ON CONFLICT`.  The reason is that in case of
conflicts, the `REPLACE` will trigger a DELETE and then perform an INSERT, as
outlined in the documentation[1], and that may cause a cascade of deletion due
to our FOREIGN KEYs.

Here is the official documentation:

```
When a UNIQUE or PRIMARY KEY constraint violation occurs, the REPLACE algorithm
deletes pre-existing rows that are causing the constraint violation prior to
inserting or updating the current row and the command continues executing
normally. If a NOT NULL constraint violation occurs, the REPLACE conflict
resolution replaces the NULL value with the default value for that column, or
if the column has no default value, then the ABORT algorithm is used. If
a CHECK constraint or foreign key constraint violation occurs, the REPLACE
conflict resolution algorithm works like ABORT.  When the REPLACE conflict
resolution strategy deletes rows in order to satisfy a constraint, delete
triggers fire if and only if recursive triggers are enabled.  The update
hook is not invoked for rows that are deleted by the REPLACE conflict
resolution strategy. Nor does REPLACE increment the change counter. The
exceptional behaviors defined in this paragraph might change in a future
release.
```

[1] https://www.sqlite.org/lang_conflict.html
2025-02-28 11:35:29 +00:00
thesimplekid
062d7be58f chore: pin base64ct as newer version is unsuported on stable 2025-02-26 10:57:15 +00:00
thesimplekid
827e4aebde Refactor mintd used in itest (#616) 2025-02-25 11:47:17 +00:00
lollerfirst
692e13ff16 Refactor Keyset Initialization (#615)
* reorg keyset startup initialization
2025-02-24 15:16:50 +00:00
C
d5df413d6b Drop AmountStr (#612)
* Drop AmountStr

Fixes #609

Instead write a customer serializer for Keys to serialize amounts as strings

* Add a custom error for invalid amounts
2025-02-22 17:46:02 +00:00
codingpeanut157
606385f44a fix openApi attributes to keyset id to present it as a string
The attribute `schema(as = String)` does not result in the expected
behaviour.
It does not convert Id to being represented as a simple string, but
rather simply rename the type `Id` to `String`.

This commit removes the attribute that implements utoipa::ToSchema trait
for type `Id` and adds attribute to all the types that have a keyset id
    as inner type to represent it as string.
2025-02-20 16:27:43 +01:00
thesimplekid
e1458b07a8 chore: cdk-mintd v0.7.2 2025-02-13 11:50:07 +00:00
thesimplekid
a880e15d4c Merge pull request #603 from ok300/ok300-fix-mint-startup-clean-db-no-rpc
Fix minting and melting error on fresh `mintd` with RPC disabled
2025-02-13 11:47:23 +00:00
ok300
96003f3979 Fix minting and melting on mintd with RPC disabled 2025-02-13 12:34:50 +01:00
thesimplekid
7b7def17ee chore: release v0.7.1 2025-02-13 10:44:09 +00:00
thesimplekid
d6566f573b fix: cln return error on stream 2025-02-13 10:17:00 +00:00
thesimplekid
c8167cf8b7 Merge pull request #600 from thesimplekid/check_addition
feat: use checked addition for u64
2025-02-12 13:43:44 +00:00
thesimplekid
85ea5fff74 feat: use checked addition for u64 2025-02-12 12:27:05 +00:00
thesimplekid
664061fa49 Merge pull request #599 from thesimplekid/custom_der_paths_to_builder
feat: custome der paths to builder
2025-02-12 10:19:19 +00:00
thesimplekid
e70c03e489 feat: custome der paths to builder 2025-02-11 23:36:48 +00:00
daywalker90
38cd88bdf9 cdk-cln: refactor to use .call_typed 2025-02-11 17:03:09 +01:00
thesimplekid
3a4c363309 feat: debug print to hide seed and print version 2025-02-09 11:16:33 +00:00
thesimplekid
fedd4b9e58 Merge pull request #591 from thesimplekid/feat_mint_quote_status_check
feat: check mint ln payment status
2025-02-09 11:14:19 +00:00
thesimplekid
0efa50ffad fix: use correct error 2025-02-09 10:49:44 +00:00
thesimplekid
9697e602df refactor: use Mint check payment status 2025-02-09 10:06:01 +00:00
thesimplekid
1abfd7f52b feat: remove unpaid mint quote start up check 2025-02-08 13:02:43 +00:00
thesimplekid
98d77ce2c8 feat: check mint ln payment status 2025-02-08 12:57:57 +00:00
thesimplekid
d51edef7b0 feat: use only one table up 2025-02-08 12:08:27 +00:00
thesimplekid
a8ec52612b Refactor mint tranactions checks (#585)
* refactor: consolidate validation checks

* refactor: melt verification checks

* refactor: mint verification

* chore: clippy

* chore: use error codes

* fix: order of verifications

* fix: p2pk test ws updates

We only expect the proof to be set to pending once. As a proof without
a signature failes before the spent check where the state is chaged.

* fix: mint_melt regtest frome wait
2025-02-08 11:17:44 +00:00
callebtc
b818054f9a Add filtering for mint quote states in database (#586)
* filter for mint quote states in db

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2025-02-08 09:28:54 +00:00
thesimplekid
0be37aa9e2 chore: cdk-cli rand feature 2025-02-06 13:51:02 +00:00
thesimplekid
d0a6975b40 chore: add license to cdk-commion 2025-02-06 13:38:52 +00:00
thesimplekid
be5e5d2371 chore: prepare v0.7.0 2025-02-06 13:12:16 +00:00
thesimplekid
47ee54d7f5 feat: mint management rpc server and client cli 2025-02-06 12:05:13 +00:00
thesimplekid
8f5764aad2 feat: restart minting in cdk-cli with quote id 2025-02-06 10:46:18 +00:00
lollerfirst
f2e1940cc7 [NUT-15] LND Support for MPP Payments (#536)
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-02-06 09:30:48 +00:00
thesimplekid
4cbf833999 chore: pin uuid 2025-02-05 14:00:58 +00:00
thesimplekid
a1681212b1 fix: redb delete proof state 2025-02-05 11:32:04 +00:00
thesimplekid
55c095c2ef fix: mint mem delete proof state 2025-02-05 11:12:09 +00:00
thesimplekid
0e3f35b0de fix: delete proofs when unspent 2025-02-05 11:00:17 +00:00
thesimplekid
7b69aa966a feat: add remove proofs to mint db 2025-02-05 10:48:33 +00:00
thesimplekid
f495a2cf04 chore: release mintd:v0.6.2,cdk:0.6.1 2025-02-04 17:22:04 +00:00
thesimplekid
5af1be369c fix: reset quote status 2025-02-04 17:17:35 +00:00
thesimplekid
0adf4e210d fix: cache test mint 2025-02-04 16:40:11 +00:00
thesimplekid
e8a85bf097 feat: tests for melt multi unit 2025-02-04 14:56:00 +00:00
thesimplekid
e31de19ba5 chore: add tests for swap with multiple units 2025-02-04 13:44:27 +00:00
thesimplekid
05259b99f4 fix: mint with outputs greater then total or multiple units 2025-02-04 13:04:59 +00:00
ok300
82ad503505 Align various wallet.balance() methods 2025-02-03 08:24:06 +01:00
thesimplekid
df8291dc04 feat: rotate next keyset 2025-02-02 14:30:59 +00:00
thesimplekid
65e07e37f1 fix: mint start with newest keyset
chore: test for newest keyset

chore: add pure tests to ci
2025-02-02 11:53:19 +00:00
thesimplekid
017f88e5bc Merge pull request #567 from thesimplekid/fix_mint_melt_test
fix: add time out to wait invoice in tests
2025-01-30 09:58:43 +00:00