-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix account_objects with invalid marker do not return an error #5046
base: develop
Are you sure you want to change the base?
Conversation
f5edf6f
to
6117405
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #5046 +/- ##
=========================================
- Coverage 76.2% 76.2% -0.0%
=========================================
Files 760 760
Lines 61568 61572 +4
Branches 8119 8122 +3
=========================================
+ Hits 46909 46910 +1
- Misses 14659 14662 +3
|
13b6555
to
e66a096
Compare
e66a096
to
627655e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this bug. I have some comments which would hopefully make this fix a little better.
src/test/rpc/AccountObjects_test.cpp
Outdated
auto resp = env.rpc("json", "account_objects", to_string(params)); | ||
auto& accountObjects = resp[jss::result][jss::account_objects]; | ||
BEAST_EXPECT(!resp[jss::result].isMember(jss::error)); | ||
BEAST_EXPECT( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add here check that this is the last page:
BEAST_EXPECT(!resp[jss::result].isMember(jss::marker));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
// check if dirIndex is valid | ||
if (!dirIndex.isZero() && !ledger->read({ltDIR_NODE, dirIndex})) | ||
return RPC::invalid_field_error(jss::marker); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since RPC::getAccountObjects
returning false
would have the same result, I would move this check into the body of RPC::getAccountObjects
; this will keep the checks (other than the marker
format, in the code segment above) in that one function only, which is more robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/xrpld/rpc/detail/RPCHelpers.cpp
Outdated
// non-zero dirIndex validity was checked in the caller function; | ||
// by this point, it should be zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as commented elsewhere, I would prefer if this function did not rely on the validation of dirIndex
happening in the caller, but rather move that check into the body of getAccountObjects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
While you are at it, I see that EDIT: If you want to see coverage on your local computer, without waiting for codecov.io to catch up on your branch, see instructions in https://github.com/XRPLF/rippled/blob/develop/BUILD.md#coverage-report . You will need Linux, gcc compiler and Python package
That will create |
Yes. I just added. There might be a potential bug here, if we pass in some marker like
|
It would be great to fix it, yes - @mDuo13 any comments ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice !
fix #4542
High Level Overview of Change
Context of Change
Type of Change
.gitignore
, formatting, dropping support for older tooling)API Impact
libxrpl
change (any change that may affectlibxrpl
or dependents oflibxrpl
)