-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
[Mint] Check for duplicate blinding factor within existing promises when initiating a split #381
Comments
Still looking into this. The cost for doing this validation in the mint is very high compared to other checks and thus I'm unsure if it should exist or not. |
I decreased the rate of occurrence of the issue in minibits by increasing and persisting recovery counters before initiating a swap (and recoverying not delivered ecash in case swap succeeds on mint side but fails to reach the wallet). However this is only one situation where this happens. Another common situation is that the user does not fully complete the recovery (so mint keeps unrecovered promises) or forgets to recover whole mint. As the result is fatal we should find a way to fix it, otherwise the whole cost-benefit of detsec does not work. If the check requires search over promises table, some index should make it viable at least until we figure out better overall concept. |
I think you have a point here. |
The general issue is that not all Rest-endpoints in the cashu api are idempotent. I proposed a simple solution here: cashubtc/nuts#64 |
I think It's not only that. You can request a signature on the same blinded message Being able to cache request-response pairs would make sense for spotty internet connections. I'm not sure if that would be more fit for a middleware or another type of layer around the protocol though. |
This issue is already fixed in Nutshell, see here. Fix for LNbits mint still in progress. |
If you provide the same idempotencykey for both requests, this will not result in an error. This is the responsibility of the wallet.
This sounds like an implementation detail to me. I think we should add idempotencykeys to all Rest-Endpoints that have this issue. It doesn't break the api because it's just a header. |
Should be now fixed in v0.4.2 of lnbits cashu extension. |
Related wallet issue: minibits-cash/minibits_wallet#28
Summary:
If wallet send blinded message for a split that has been generated using the same secret as before, mint spends the ecash and fails to deliver new promises, leading to ecash lost from walet POV.
This situation can happen on wallet side for various reasons after implementing the deterministic secrets which uses incremental recovery indexes to derive secrets. In case wallet does not increment the index, the blinded message is generated using secret generated using the same derivation path as before.
Wallet may fail to increment the index because of a bug, or, as in referenced wallet issue, because of external failures, that can not be fully prevented.
Proposed fix:
Mint needs to check there is not existing promise generated from blinded message with the same blinding factor before it spends and not let it fail too late on DB integrity constraint.
The text was updated successfully, but these errors were encountered: