fix: account_tx limit parameter validation for malformed values - #5891
Merged
Conversation
mvadari
marked this pull request as ready for review
October 14, 2025 21:09
Copilot
AI
changed the title
[WIP] Fix account_tx to handle malformed limit values
Fix account_tx limit parameter validation for malformed values
Oct 14, 2025
mvadari
approved these changes
Oct 14, 2025
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
mvadari
approved these changes
Oct 14, 2025
account_tx limit parameter validation for malformed values
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5891 +/- ##
=======================================
Coverage 78.3% 78.3%
=======================================
Files 817 817
Lines 68981 68982 +1
Branches 8333 8321 -12
=======================================
+ Hits 54021 54023 +2
+ Misses 14960 14959 -1
🚀 New features to boost your workflow:
|
godexsoft
approved these changes
Oct 15, 2025
godexsoft
left a comment
Contributor
There was a problem hiding this comment.
Overall this is fine. I believe in Clio we have the same behaviour.
| if (auto err = RPC::readLimitField(limit, RPC::Tuning::accountTx, context)) | ||
| return *err; | ||
|
|
||
| args.limit = limit; |
Contributor
There was a problem hiding this comment.
nit: Why not directly use args.limit?
| } | ||
|
|
||
| unsigned int limit; | ||
| if (auto err = RPC::readLimitField(limit, RPC::Tuning::accountTx, context)) |
bthomee
reviewed
Oct 22, 2025
bthomee
reviewed
Oct 22, 2025
mvadari
force-pushed
the
copilot/fix-account-tx-error-handling
branch
from
October 22, 2025 21:23
782630f to
24a8364
Compare
kuznetsss
reviewed
Oct 27, 2025
bthomee
approved these changes
Oct 28, 2025
This change fixes the `account_tx` RPC method to properly validate malformed limit parameter values. Previously, invalid values like `0`, `1.2`, `"10"`, `true`, `false`, `-1`, `[]`, `{}`, etc. were either accepted without errors or caused internal errors. Now all malformed values correctly return the `invalidParams` error.
bthomee
force-pushed
the
copilot/fix-account-tx-error-handling
branch
from
October 28, 2025 17:20
bf58766 to
9b31907
Compare
bthomee
enabled auto-merge
October 28, 2025 17:21
|
3907f32 |
bthomee
added a commit
that referenced
this pull request
Apr 7, 2026
This change fixes the `account_tx` RPC method to properly validate malformed limit parameter values. Previously, invalid values like `0`, `1.2`, `"10"`, `true`, `false`, `-1`, `[]`, `{}`, etc. were either accepted without errors or caused internal errors. Now all malformed values correctly return the `invalidParams` error.
Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
ximinez
pushed a commit
that referenced
this pull request
Apr 10, 2026
This change fixes the `account_tx` RPC method to properly validate malformed limit parameter values. Previously, invalid values like `0`, `1.2`, `"10"`, `true`, `false`, `-1`, `[]`, `{}`, etc. were either accepted without errors or caused internal errors. Now all malformed values correctly return the `invalidParams` error.
Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
ximinez
pushed a commit
that referenced
this pull request
Apr 22, 2026
This change fixes the `account_tx` RPC method to properly validate malformed limit parameter values. Previously, invalid values like `0`, `1.2`, `"10"`, `true`, `false`, `-1`, `[]`, `{}`, etc. were either accepted without errors or caused internal errors. Now all malformed values correctly return the `invalidParams` error.
Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
beartec-jpg
pushed a commit
to beartec-jpg/FalconLedger
that referenced
this pull request
Jun 1, 2026
…F#5891) This change fixes the `account_tx` RPC method to properly validate malformed limit parameter values. Previously, invalid values like `0`, `1.2`, `"10"`, `true`, `false`, `-1`, `[]`, `{}`, etc. were either accepted without errors or caused internal errors. Now all malformed values correctly return the `invalidParams` error. Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
This was referenced Jul 7, 2026
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.
High Level Overview of Change
Fixed
account_txRPC method to properly validate malformedlimitparameter values. Previously, invalid values like0,1.2,"10",true,false,-1,[],{}, etc. were either accepted without errors or caused internal errors. Now all malformed values correctly returninvalidParamserror.Fixes #5138
Context of Change
This is a bug fix for improper parameter validation in the
account_txRPC method. The bug has existed since the method was implemented - the original code directly calledasUInt()on the limit parameter without proper type validation, which bypassed type checking and caused implicit conversions or internal errors.The fix follows the established pattern used by other RPC methods (like
account_lines) by:readLimitFieldhelper function for consistent behaviorType of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Before / After
Before (incorrect behavior):
Request with limit = 0:
{"method": "account_tx", "params": [{"account": "rpU4XtUSB7vx7hnDbkJ7pdbqAHEEoxTL33", "limit": 0}]}Response: Success with transactions (incorrect - should reject invalid limit)
Request with limit = "10":
{"method": "account_tx", "params": [{"account": "rpU4XtUSB7vx7hnDbkJ7pdbqAHEEoxTL33", "limit": "10"}]}Response: Success (incorrect - should reject non-integer)
Request with limit = -1:
{"method": "account_tx", "params": [{"account": "rpU4XtUSB7vx7hnDbkJ7pdbqAHEEoxTL33", "limit": -1}]}Response: Internal error (incorrect error type)
After (correct behavior):
Request with limit = 0:
{"method": "account_tx", "params": [{"account": "rpU4XtUSB7vx7hnDbkJ7pdbqAHEEoxTL33", "limit": 0}]}Response:
{ "result": { "error": "invalidParams", "error_code": 31, "error_message": "Invalid parameters.", "status": "error" } }Request with limit = "10", 1.2, true, false, -1, [], {}, etc.:
{"method": "account_tx", "params": [{"account": "rpU4XtUSB7vx7hnDbkJ7pdbqAHEEoxTL33", "limit": "10"}]}Response:
{ "result": { "error": "invalidParams", "error_code": 31, "error_message": "Invalid field 'limit', not unsigned integer.", "status": "error" } }Valid request with limit = 10:
{"method": "account_tx", "params": [{"account": "rpU4XtUSB7vx7hnDbkJ7pdbqAHEEoxTL33", "limit": 10}]}Response: Success with up to 10 transactions
Test Plan
Added comprehensive test coverage in
AccountTx_test.cppfor all malformed limit values from the issue:limit = 0→ returnsrpcINVALID_PARAMSlimit = 1.2,"10",true,false,-1,[],{},"malformed",["limit"],{"limit": 10}→ returnexpected_field_errorwith message "Invalid field 'limit', not unsigned integer."limit = 10(valid) → works correctlyThe tests verify that:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.