fix: reject non-finite withdrawal amounts#5728
Closed
iamdinhthuan wants to merge 1 commit into
Closed
Conversation
jaxint
approved these changes
May 19, 2026
Contributor
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Great work on this PR. 🚀
TJCurnutte
approved these changes
May 19, 2026
TJCurnutte
left a comment
There was a problem hiding this comment.
Approved. The non-finite withdrawal amount guard is in the right place: immediately after float(raw_amount) and before nonce/database work.
What I checked:
math.isfinite(amount)rejectsNaN,inf, and-infbefore balance, nonce, or signature logic can operate on non-finite floats.- Existing malformed JSON, nonnumeric amount, negative amount, and minimum-withdrawal behavior remains covered by the focused tests.
- The shared import name in the tests avoids duplicate module/Prometheus registration during the combined test run.
Validation performed on head 9b3dc1a5ef2ab87eb3371cc423408220f879e67f:
git diff --check origin/main...HEAD -- node/rustchain_v2_integrated_v2.2.1_rip200.py node/tests/test_withdraw_amount_validation.py node/tests/test_withdrawal_validation.pypassed./Users/curnutte/.hermes/hermes-agent/venv/bin/python3 -B -m py_compile node/rustchain_v2_integrated_v2.2.1_rip200.py node/tests/test_withdraw_amount_validation.py node/tests/test_withdrawal_validation.pypassed./Users/curnutte/.hermes/hermes-agent/venv/bin/python3 -B -m pytest -q node/tests/test_withdraw_amount_validation.py node/tests/test_withdrawal_validation.py --tb=short -p no:cacheproviderreturned12 passed in 0.24s.- Temp-DB Flask probe compared
origin/mainwith this PR for/withdraw/request:origin/mainletNaN/infreach database work and returned 500 in the stripped temp DB path, while this PR returned HTTP 400 withAmount must be a finite positive numberforNaN,inf, and-infbefore DB access.
I do not see a blocking issue in this diff.
Owner
|
Closing as duplicate of #5719 (william08190, first-poster — filed 4 hours earlier at 11:07 UTC vs 15:52 UTC here, both reference issue #4420 'reject non-finite withdrawal amounts'). #5719 was merged with credit. Thanks for the parallel work; per the first-poster-per-issue rule, credit goes to whoever lands first. |
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.
Summary
Fixes #4420
Verification