Repository navigation
Conversation
`if (passedFee) { fee = passedFee } else { "Fee is invalid"; exit(1) }`
treats `parseInt('0', 10)` (a valid zero fee) the same as a garbage
value, so `qrl send -f 0`, `send-message -f 0`, `notarize -f 0`,
`generate-lattice-keys -f 0` and `sign-tx-offline -f 0` all abort with
"Fee is invalid" — even though 0 is exactly the default the commands use
when `-f` is omitted (the node accepts any fee >= 0).
Reject only a non-numeric or negative value (`Number.isNaN(passedFee) ||
passedFee < 0`); `-f abc` / `-f .01` / `-f -5` still fail as before.
Also fix the stale "defaults to 100 Shor" text on send / send-message /
generate-lattice-keys — those initialise `fee = 0`. sign-tx-offline
keeps its real 100 default.
Adds an offline `send #3c` regression test: `send -f 0 -T <file>` exits 0
and writes a transaction whose `fee` is "0".
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collaborator
|
Thanks, this PR crosses with some fork work which closes this issue. Thank you for your contribution. |
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.
Problem
The fee parser in the spending commands is:
parseInt('0', 10)is0, which is falsy, soif (passedFee)sends azero fee down the "invalid" branch. Result:
-f 0is rejected onsend,send-message,notarize,generate-lattice-keysandsign-tx-offline— even though
0is exactly the fee these commands use when-fisomitted, and the node accepts any fee
>= 0.The
otsindexcheck a few lines above already gets this right(
if (!passedOts && passedOts !== 0)).Fix
Reject only a non-numeric or negative fee:
-f abc,-f .01,-f -5still fail exactly as before;-f 0nowworks. Also corrected the "defaults to 100 Shor" flag text on
send/send-message/generate-lattice-keys, which initialisefee = 0(sign-tx-offlinekeeps its genuine100default).Tests
test/commands/send.test.jsgainssend #3c: an offlinesend -f 0 -T <file>run that must exit0and write a transactionwhose
feeis"0". Verified against the offline suite(
QRL_TEST_OFFLINE=true);npm run lintclean.🤖 Generated with Claude Code