-
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
Currently, the ledger command only takes int for ledger_index - update the logic to allow string as well. #3582
Conversation
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.
Actually, @gregtatcam can you write a unit test for this? Then I'll approve
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.
Looks good. Left some suggestions that I feel improve the code. I'd like to see them adopted unless anyone objects.
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.
Looks pretty good, but I'd like to request a couple of changes.
-
The DepositAuthorized unit tests are failing as a result of your change. You can choose to fix them yourself, or you could cherry-pick this commit which has a fix: scottschurr@3461cd4
-
The commit messages need some work. Here is generally good advice to follow: https://chris.beams.io/posts/git-commit/ But there are two specific changes I'd like to see
- The first line of the first commit message is too long. It should be 60 characters or less. If there's more stuff coming then that first line should end with a colon followed by a blank line followed by the additional stuff. Consider something like this for that first commit message...
RPC ledger_index argument accepts quoted numeric strings:
Some RPC commands return ledger_index as a quoted numeric string.
This change allows the returned value to be directly copied and
used for follow-on RPC commands.FIXES 3533
- Presumably the remaining commits will want to be squashed into the first commit when this pull request is merged. Please start the commit message of any commits you want squashed with
[FOLD]
. The person assembling a release may not have been following the code review. Including[FOLD]
helps the person building the release to know whether they have additional work to do. So the second commit message might look like this...
[FOLD] Update unit-test
The additional bug-fix and tuning commits should all include [FOLD]
at the front. So, for example, the commit message for the third commit might look like...
[FOLD] Simplify ledger_index parsing:
Change lexicalCastChecked() argument to std::unit32_t.
Update unit-test.
I'm sure you get the idea. Thanks.
src/ripple/json/json_value.h
Outdated
@@ -136,7 +136,7 @@ operator!=(StaticString x, std::string const& y) | |||
* The sequence of an #arrayValue will be automatically resize and initialized | |||
* with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. | |||
* | |||
* The get() methods can be used to obtanis default value in the case the | |||
* The get() methods can be used to obtain default value in the case the |
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 noticing and fixing the typo. I think you could slightly improve readability with "...to obtain a default...". But that's at your discretion.
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.
Thank you. Updated.
@@ -393,7 +419,7 @@ class LedgerRPC_test : public beast::unit_test::suite | |||
void | |||
testLedgerEntryDepositPreauth() | |||
{ | |||
testcase("ledger_entry Request Directory"); | |||
testcase("ledger_entry Deposit Preauth"); |
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 noticing and fixing this.
Thank you. I fixed the unit test. I'll update the commit message and squash per your recommendations once the PR is approved. |
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 and continuous integration passes!
Some RPC commands return ledger_index as a quoted numeric string. This change allows the returned value to be directly copied and used for follow-on RPC commands. FIXES 3533 [FOLD] Update unit-test [FOLD] Simplify ledger index parsing: Change lexicalCastChecked() argument to std::unit32_t Update unit-test [FOLD] Fix unit-test
Assume ledger_index is quoted int if it is not "current", "closed", or "validated".
FIXES #3533