Skip to content
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

Force json commands to be objects #2319

Closed
wants to merge 3 commits into from

Conversation

HowardHinnant
Copy link
Contributor

  • Null json values can be objects or arrays.
  • json arrays are now interpreted as batch commands.
  • json objects are single commands.
  • null jsons are ambiguous as to whether they are single or batch
    commands and should be avoided.

This fixes a regression introduced with 0.90 by the batch json support.

* Null json values can be objects or arrays.
* json arrays are now interpreted as batch commands.
* json objects are single commands.
* null jsons are ambiguous as to whether they are single or batch
  commands and should be avoided.
@ripplelabs-jenkins
Copy link
Collaborator

ripplelabs-jenkins commented Jan 4, 2018

Jenkins Build Summary

Built from this commit

Built at 20180108 - 21:09:27

Test Results

Build Type Result Status
clang.debug.unity 970 cases, 0 failed, t: 385s PASS ✅
coverage 970 cases, 0 failed, t: 610s PASS ✅
clang.debug.nounity 968 cases, 0 failed, t: 456s PASS ✅
gcc.debug.unity 970 cases, 0 failed, t: 428s PASS ✅
gcc.debug.nounity 968 cases, 0 failed, t: 467s PASS ✅
clang.release.unity 969 cases, 0 failed, t: 466s PASS ✅
gcc.release.unity 969 cases, 0 failed, t: 495s PASS ✅

Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be happier if these changes had some unit tests. It could be something along the lines of

Env env;
auto result = env.rpc("wallet_propose");
BEAST_ASSERT(result["result"]["status"] == "success");

Edited: Removed the seed in the example because providing a seed resolves the problem.

@HowardHinnant
Copy link
Contributor Author

Good suggestion, thanks Ed. Done.

@HowardHinnant
Copy link
Contributor Author

The travis failure is meaningless. It is an "out of time" error, and I've already restarted it once.

Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just for grins I also audited other uses of Json::Value in RPCCall.cpp. It looks like you caught all of them. The only one I had any question about was on line 1302. I think that one's okay, but the usage is not very straightforward. So it may deserve a last look.

👍

Copy link
Contributor

@wilsonianb wilsonianb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Env env{*this};
auto result = env.rpc("validation_create");
BEAST_EXPECT(result.isMember(jss::result) &&
result[jss::result][jss::status] == "success");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be in favor of getting more coverage with an additional test with the optional seed parameter (which @ximinez may have originally suggested) even though that case worked before and after this fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add that test.

@HowardHinnant
Copy link
Contributor Author

@scottschurr I think I'll leave the one at line 1302 alone for now. This war is limited to just the use of Json::value that is formed from interpreting command strings, and doesn't extend to the Json::value default constructor in general. Thanks for doing that survey!

@HowardHinnant HowardHinnant added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Jan 8, 2018
@nbougalis nbougalis mentioned this pull request Jan 10, 2018
@seelabs
Copy link
Collaborator

seelabs commented Jan 16, 2018

In 0.90.0-b3

@seelabs seelabs closed this Jan 16, 2018
@HowardHinnant HowardHinnant deleted the rpc_fix branch December 6, 2018 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants