Commit Graph

59 Commits

Author SHA1 Message Date
Cesar Rodas
2dec11e1e4 Fix race conditions
Because of the nature of Rust tests, the nutshell integration test has a race
condition. Triggering the issue in the local environment was hard, but it
happens more often in #509 because all the keys are read from memory without
blocking the database.

The error happens because, by default, Rust tests run in parallel, and maybe by
design or by mistake, the external wallet did not increase its counter until
the completion of the minting. This led to some tests having the same blinded
messages, and the fastest test would mint successfully. The slowest test would
result in the CDK failing to sign duplicated blinded messages.

In any case, the fix is on the rust side, running the tests sequentially.
2025-04-28 18:53:41 -03:00
thesimplekid
7fbe55ea02 Test fees (#698)
* feat: Add Docker container setup for Nutshell mint in test-nutshell recipe

* test: Add wait mechanism for Nutshell docker container startup

* test: Modify Nutshell wallet tests to run sequentially

* fix: mintd set input fee pkk

* feat: fee tests

* fix: melt returning fee in change

* fix: fee tests

* fix: fee tests
2025-04-03 00:30:50 +01:00
thesimplekid
f4c857c3e7 Nutshell wallet (#695)
* chore: Add nutshell wallet integration test script

feat: Add MINT_URL configuration for docker container in nutshell wallet integration test script

chore: Make nutshell_wallet_itest.sh executable

fix: Update MINT_URL to use host.docker.internal for Docker container access

feat: Add Docker container startup for Cashu daemon in wallet integration test script

chore: Update Docker image to use Docker Hub repository

feat: Add cleanup trap to stop Docker container and unset variables

feat: Add initial test stub for nutshell wallet mint functionality

test: Add Cashu wallet mint integration test

feat: Add just command for nutshell wallet integration test

refactor: Organize imports and improve code formatting in nutshell wallet test

fix: Update Cashu Docker image and test URL for correct container access

fix: Update Docker container name and image for Cashu wallet test script

fix: Handle Docker container name conflict in nutshell wallet integration test

fix: Update Docker image to cashubtc/nutshell:latest in wallet integration test script

feat: Add support for running separate Nutshell mint and wallet containers

feat: Update Nutshell mint and wallet container configurations for integration testing

fix: Update wallet port and container configuration in integration test script

chore: Export MINT_URL and WALLET_URL as environment variables

fix: Update invoice creation and state checking in nutshell wallet test

fix: Update MINT_URL to use host.docker.internal for container access

fix: Update nutshell wallet mint test to handle invoice payment state

refactor: Improve Nutshell wallet test with better error handling and robustness

refactor: Improve code formatting and logging in nutshell wallet test

refactor: Replace anyhow with expect for error handling in Nutshell wallet test

refactor: Simplify error handling in Nutshell wallet mint test

refactor: Replace `?` with `expect()` in Nutshell wallet test

refactor: Simplify nutshell wallet test by removing unused code and improving error handling

refactor: Extract minting and balance helper functions in nutshell wallet test

feat: Add test for Nutshell wallet token swap functionality

fix: Trim quotes from token in nutshell wallet swap test

refactor: Remove debug print statements and improve code readability

refactor: Improve test_nutshell_wallet_melt with payment state checking and balance verification

refactor: Update Nutshell wallet integration test script configuration

feat: Extract common mint startup function into shared script

refactor: Simplify nutshell wallet integration test script and improve startup process

feat: Add mintd process termination and test status capture in integration test script

refactor: Capitalize env vars and ensure comprehensive cleanup in trap

feat: nutshell wallet test

* ci: Add test step for Nutshell wallet integration tests

* ci: Split Nutshell integration tests into separate jobs

* feat: nutshell wallet test

* ci: Add Docker setup and increase timeout for Nutshell wallet integration tests

* chore: Improve Nutshell wallet integration test script robustness

* fix: Remove -i flag from Nix develop and improve Docker accessibility check

* fix: payment processor

* fix: wallet tests

* feat: Add integration shell with Docker and Rust stable for testing

* ci: Simplify Nutshell wallet integration test workflow and script

* fix: Improve mintd endpoint detection and error handling in integration test script

* fix: wallet tests
2025-03-30 13:08:00 +01:00
thesimplekid
52bfc8c9ce feat: nutshell itests (#691) 2025-03-29 22:04:43 +00:00
ok300
240e22c96a Remove stale crate references (#692) 2025-03-28 14:49:07 +00:00
optout
d5104a94eb sample: Add example program for melt 2025-03-24 14:52:07 +01:00
thesimplekid
be93ff2384 Clear and Blind Auth (#510)
* feat: auth

* chore: corret error codes

* chore: corret error codes

* fix: feature auth in cdk-axum

* refactor: auth logging

* feat: include dleq in auth proof

* feat: mint max auth proofs

* chore: clippy
2025-03-24 11:13:22 +00:00
thesimplekid
162507c492 feat: payment processor 2025-03-10 14:44:57 +00:00
thesimplekid
f5be0ceeb6 chore: remove phd 2025-03-05 11:04:05 +00:00
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
827e4aebde Refactor mintd used in itest (#616) 2025-02-25 11:47:17 +00:00
thesimplekid
be5e5d2371 chore: prepare v0.7.0 2025-02-06 13:12:16 +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
67be74abb8 feat: tests on lnd node 2025-01-24 14:55:02 +00:00
thesimplekid
486f98bc8b feat: lnd mint 2025-01-23 23:45:31 +00:00
thesimplekid
72c66af8b7 feat: second lnd node 2025-01-23 20:56:01 +00:00
thesimplekid
a9662d0362 refactor: add second cln node 2025-01-20 21:07:21 +00:00
thesimplekid
c5d4fa52ef refactor: regtest mint as bin 2025-01-13 20:58:19 +00:00
Cesar Rodas
760564cee0 Introduce subscription support in the Wallet crate.
The main goal is to add a subscription to CDK Mint updates into the wallet.
This feature will be particularly useful for improving the code whenever loops
hit the mint server to check status changes.

The goal is to add an easy-to-use interface that will hide the fact that we're
connecting to WebSocket and subscribing to events. This will also hide the fact
that the CDK-mint server may not support WebSocket updates.

To be fully backward compatible, the HttpClientMethods traits have a new
method, `subscribe,` which will return an object that implements
`ActiveSubscription.`

In the primary implementation, there is a `SubscriptionClient` that will
attempt to connect through WebSocket and will fall to the HTTP-status pull and
sleep approach (the current approach), but upper stream code will receive
updates as if they come from a stream of updates through WebSocket. This
`SubscriptionClient` struct will also manage reconnections to WebSockets (with
automatic resubscriptions) and all the low-level stuff, providing an
easy-to-use interface and leaving the upper-level code with a nice interface
that is hard to misuse. When `ActiveSubscription` is dropped, it will
automatically unsubscribe.

Fixed bug with Default as described in https://github.com/cashubtc/cdk/pull/473#discussion_r1871032297
2024-12-08 16:25:00 +00:00
thesimplekid
c8f82b29d0 chore: remove bindings from cdk repo 2024-11-19 14:57:53 +00:00
thesimplekid
357957d2ac chore: changelog 2024-11-19 10:22:32 +00:00
thesimplekid
187664439c refactor: mint into mods 2024-09-30 22:45:57 +02:00
thesimplekid
610571d05b fix: itest change ordering 2024-09-30 20:43:04 +02:00
thesimplekid
7ea568e615 feat: sql store signatures dleq 2024-09-30 12:20:43 +02:00
thesimplekid
5139c47dac feat: check outgoing payment status flow 2024-09-25 20:28:05 +02:00
thesimplekid
3413c24936 ci: add db matrix to ci 2024-09-21 11:10:38 +02:00
thesimplekid
4a0637a6a5 feat: itests select db 2024-09-21 11:10:38 +02:00
thesimplekid
f9bb5eb913 feat: itests
fix: melt change promises amount
2024-09-19 11:43:43 +02:00
thesimplekid
a06b52039c fix: itest cdk version 2024-09-08 22:39:12 +01:00
thesimplekid
3bf1a3b28f chore: version cdk in other crates 2024-09-08 22:12:06 +01:00
thesimplekid
e065662328 chore: justfile doc check 2024-08-31 20:00:23 +01:00
thesimplekid
bc3b7b28c3 chore: fmt flake and add custom justfile 2024-08-31 16:40:56 +01:00
thesimplekid
e2041d3928 chore: flakebox install 2024-08-29 11:41:12 +01:00
thesimplekid
65163b89bc refactor: check scripts for justfile
chore: ci run examples
2024-08-19 14:48:45 +02:00
thesimplekid
e8114f3383 feat(tests): integration test 2024-08-19 00:01:30 +02:00
thesimplekid
e4069c0243 chore: use workspace version 2024-08-08 10:11:31 -04:00
thesimplekid
bc9fad9e0e feat: strike api for mint backend
feat: Use mint melt settings
2024-07-22 16:16:05 +01:00
thesimplekid
e0efd316d1 feat: Mint fake wallet ln backend 2024-07-16 17:01:56 +01:00
thesimplekid
6a315fc3b9 feat: mintd axum server
feat: deafult NUT-04 and NUT-05 settings to enable bolt11 sats
2024-07-05 23:49:31 +01:00
thesimplekid
16aeec92c7 feat: cln lightning 2024-07-05 23:49:31 +01:00
thesimplekid
6c3f67392b chore: typos in precommit 2024-07-05 22:50:34 +01:00
thesimplekid
04a463be1f feat(wallet): make wallet single mint and unit
feat(wallet): cli use mint with one url and unit

feat(wallet): remove p2pk keys from wallet

feat(wallet): multimint wallet
2024-06-27 12:09:44 +01:00
thesimplekid
5ebdd4f506 feat: cdk-cli 2024-06-09 00:04:20 +01:00
thesimplekid
bbc63306db feat: mint sqlite 2024-06-08 10:34:39 +01:00
thesimplekid
24688deb80 chore: add examples to ci 2024-06-07 00:27:06 +01:00
thesimplekid
c64c741e14 feat: nostr receive 2024-05-19 10:33:37 +01:00
David Caseria
2a09dff5c6 Address PR feedback 2024-05-14 20:27:07 -04:00
thesimplekid
21c8b18dc4 chore: update ci and add binding script 2024-05-10 11:27:32 +01:00
thesimplekid
7d714a2fc5 chore: precommit scripts for bindings 2024-05-10 11:27:32 +01:00