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

Replace JSON library #1871

Open
Tracked by #2467
cryptocode opened this issue Mar 27, 2019 · 6 comments
Open
Tracked by #2467

Replace JSON library #1871

cryptocode opened this issue Mar 27, 2019 · 6 comments
Assignees
Labels
rpc Changes related to Remote Procedure Calls

Comments

@cryptocode
Copy link
Contributor

cryptocode commented Mar 27, 2019

The current use of Boost ptree in RPC is problematic for several reasons:

  • The output is not standard JSON
    • Empty objects and arrays are replaced with strings
    • Bool values are quoted
    • Numbers are quoted. However, arbitrary precision numbers (such as balances) should still be quoted. This is fairly common practice because several JSON parsers otherwise fail or give the wrong result.
  • Slow and memory hungry
  • No streaming/sax support. We may want to employ this in the future for more efficient handling of large requests/responses.

Challenges/notes:

  • Just replacing the library would be a breaking change. The approach will be to make the JSON backend configurable. We can deprecate Boost ptree, but keep it default for a while.
  • It's a large change, as it touches all RPC actions and block-json serializations.
    • Step 1 is to make an internal library, e.g a common interface which can have multiple implementations.
      • Implement Boost ptree backend
      • Implement RapidJSON backend (RapidJSON will likely be a git submodule)
    • Step 2 is to replace all use of Boost ptree with the internal library.

This replaces a few related issues.

@kolya182
Copy link

kolya182 commented Dec 5, 2019

@cryptocode
Copy link
Contributor Author

@kolya182 out of curiosity, would your Go client deal with both history being an empty array [] and history not being present at all in the JSON?

@kolya182
Copy link

kolya182 commented Dec 5, 2019

@kolya182 out of curiosity, would your Go client deal with both history being an empty array [] and history not being present at all in the JSON?

Empty array is expected for address with 0 transactions, instead history returns different type. Expecting to have history property no matter amount of transactions would be ideal.

@zhyatt
Copy link
Collaborator

zhyatt commented Mar 12, 2020

In V22 flatbuffers' JSON support takes over ptree with RPC 2.0. Migration to the new RPC version will remove this issue.

@codesoap
Copy link

Migration to the new RPC version will remove this issue.

Is there any ticket where I can check the progress on this?

@zhyatt zhyatt reopened this Sep 28, 2021
@zhyatt zhyatt mentioned this issue Sep 28, 2021
7 tasks
@zhyatt
Copy link
Collaborator

zhyatt commented Sep 28, 2021

Reopening as this is being considered in a RPC v2.

@codesoap This can be tracked as part of #2467 and is related to #3348

@zhyatt zhyatt removed this from the V21.0 milestone Sep 28, 2021
@zhyatt zhyatt added the rpc Changes related to Remote Procedure Calls label Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rpc Changes related to Remote Procedure Calls
Projects
None yet
Development

No branches or pull requests

5 participants