-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: rpc: Remove unnecessary uses of ParseNonRFCJSONValue() and rename it #27256
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
refactor: rpc: Remove unnecessary uses of ParseNonRFCJSONValue() and rename it #27256
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
0f22456
to
f43b98b
Compare
f43b98b
to
104e482
Compare
104e482
to
860e707
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.
Code review ACK 860e707. This looks good, but we will have to find another function to give the most confusing function name award to. I left a few minor review suggestions, but they can be ignored.
860e707
to
79ee14b
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.
Code review ACK 79ee14b. Just added static
and updated commit description since last review
Preparation to deprecate ParseNonRFCJSONValue() but keep test coverage on the underlying UniValue::read() unaffected. The test coverage on AmountFromValue is no longer included, since that is already tested in the rpc_parse_monetary_values test case. Fuzzing coverage on ParseNonRFCJSONValue() was duplicated between string.cpp and parse_univalue.cpp, only the one in parse_univalue.cpp is kept.
As per bitcoin#26506 (review), this function is no longer necessary and we can use UniValue::read() directly. To avoid code duplication, we keep the function to throw on invalid input data but rename it to Parse() and remove it from the header.
79ee14b
to
cfbc8a6
Compare
Force pushed to add test a test case on Addressed all of @ryanofsky's comments - thank you for the review! |
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.
Code review ACK cfbc8a6. Only change since last review is adding a new test
fa4c696 test: Fix failing univalue float test (MarcoFalke) Pull request description: Currently the test may fail for some compilers, because `1e-8` may not be possible to represent exactly/consistently. ``` $ ./src/univalue/test/object object: univalue/test/object.cpp:424: void univalue_readwrite(): Assertion `v.read("0.00000000000000000000000000000000000001e+30 ") && v.get_real() == 1e-8' failed. Aborted (core dumped) ``` Fixes #27256 (comment) ACKs for top commit: laanwj: ACK fa4c696 stickies-v: ACK fa4c696 , thanks for fixing! Tree-SHA512: dea4f4f843381d5e8ffaa812b2290a11e081b29f8777d041751c4aa9942e60f1f8d2d1a652d9a52b41dec470a490c9fe26ca9bc762dd593c3521b328a8af2826
Follow-up to #26612 (comment). As per #26506 (review),
ParseNonRFCJSONValue()
is no longer necessary and we can useUniValue::read()
directly:The implementation of
ParseNonRFCJSONValue()
was already simplified in #26612 and test coverage updated to ensure behaviour didn't change.To avoid code duplication, we keep the function to throw on invalid input data but rename it to
Parse()
and remove it from the header.The existing test coverage we had on
ParseNonRFCJSONValue()
is moved over toUniValue::read()
.