feat(mint): enforce NUT 11014/11015 max inputs and outputs#965
Open
b-l-u-e wants to merge 1 commit intocashubtc:mainfrom
Open
feat(mint): enforce NUT 11014/11015 max inputs and outputs#965b-l-u-e wants to merge 1 commit intocashubtc:mainfrom
b-l-u-e wants to merge 1 commit intocashubtc:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #965 +/- ##
==========================================
+ Coverage 74.90% 74.97% +0.06%
==========================================
Files 99 99
Lines 11685 11703 +18
==========================================
+ Hits 8753 8774 +21
+ Misses 2932 2929 -3 ☔ View full report in Codecov by Sentry. |
f27814f to
e41618e
Compare
callebtc
reviewed
Mar 31, 2026
Comment on lines
-402
to
407
| async with self.db.get_connection( | ||
| lock_table="mint_quotes", | ||
| lock_select_statement="quote = :quote", | ||
| lock_parameters={"quote": quote_id}, | ||
| ) as conn: | ||
| async with self.db.get_connection( | ||
| lock_table="mint_quotes", | ||
| lock_select_statement="quote = :quote", | ||
| lock_parameters={"quote": quote_id}, | ||
| ) as conn: | ||
| quote = await self.crud.get_mint_quote( |
Contributor
Author
There was a problem hiding this comment.
invisible changes?
same EOL normalization issue locally CRLF vs LF that causes ^M and makes unrelated changes
i faced in another PR as well
https://github.com/cashubtc/nutshell/pull/901/changes/BASE..04decfccc11f3265c3c66ffa8c11bfa5a8a22b18#r2996024558
Comment on lines
-1052
to
1061
| try: | ||
| Ys = [p.Y for p in proofs] | ||
| lock_parameters = {f"y{i}": y for i, y in enumerate(Ys)} | ||
| ys_list = ", ".join(f":y{i}" for i in range(len(Ys))) | ||
| async with self.db.get_connection( | ||
| lock_table="proofs_pending", | ||
| lock_select_statement=f"y IN ({ys_list})", | ||
| lock_parameters=lock_parameters, | ||
| ) as conn: | ||
| try: | ||
| Ys = [p.Y for p in proofs] | ||
| lock_parameters = {f"y{i}": y for i, y in enumerate(Ys)} | ||
| ys_list = ", ".join(f":y{i}" for i in range(len(Ys))) | ||
| async with self.db.get_connection( | ||
| lock_table="proofs_pending", | ||
| lock_select_statement=f"y IN ({ys_list})", | ||
| lock_parameters=lock_parameters, | ||
| ) as conn: | ||
| await self._store_blinded_messages(outputs, keyset=keyset, conn=conn) |
callebtc
reviewed
Apr 7, 2026
Comment on lines
-1052
to
+1061
| try: | ||
| Ys = [p.Y for p in proofs] | ||
| lock_parameters = {f"y{i}": y for i, y in enumerate(Ys)} | ||
| ys_list = ", ".join(f":y{i}" for i in range(len(Ys))) | ||
| async with self.db.get_connection( | ||
| lock_table="proofs_pending", | ||
| lock_select_statement=f"y IN ({ys_list})", | ||
| lock_parameters=lock_parameters, | ||
| ) as conn: | ||
| try: | ||
| Ys = [p.Y for p in proofs] | ||
| lock_parameters = {f"y{i}": y for i, y in enumerate(Ys)} | ||
| ys_list = ", ".join(f":y{i}" for i in range(len(Ys))) | ||
| async with self.db.get_connection( | ||
| lock_table="proofs_pending", | ||
| lock_select_statement=f"y IN ({ys_list})", | ||
| lock_parameters=lock_parameters, | ||
| ) as conn: |
Collaborator
There was a problem hiding this comment.
I can't see a difference but could you pls revert all unrelated chnages?
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds Cashu/NUT-aligned errors 11014 (Max inputs exceeded) and 11015 (Max outputs exceeded), configurable via
MINT_MAX_INPUTSandMINT_MAX_OUTPUTS(defaults: 1000).TransactionMaxInputsExceededErrorandTransactionMaxOutputsExceededErrorincashu/core/errors.py.verify_inputs_and_outputsand_verify_outputs, and onrestore().Tests cover both error paths in
tests/mint/test_mint_verification.py.