-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[Proposal] Deprecate RPC binary strings #9422
Comments
The custom binary string is encoded how exactly? I'd guess as raw binary, yet then it'd have a 1/256 chance of being |
If memory serves me, other endpoints previously had this behavior and were converted to "[h]exadecimal encoded binary within JSON". So, that should probably be done with these endpoints. |
For For monero/src/rpc/core_rpc_server_commands_defs.h Lines 2481 to 2488 in cc73fe7
it'll be raw binary or a compressed format. If
The bytes can be any Unicode code point (valid or not) instead of just ASCII, so I believe the chances would be much lower than this.
I can't assert how binary string deserialization works. |
Then it would seem |
How about following this model: A new
|
Sounds good but is there a reason to add Would the same model apply to |
Agree, would seem like a nice to have if someone requests it, not a required feature, especially considering the
Seems a reasonable approach to me |
What
This is a proposal to deprecate binary string usage in
monerod
's daemon RPC interface.Binary strings are JSON strings that appear in
monerod
's daemon RPC output that contain raw binary data.There are 2 JSON-RPC methods whose responses contain these binary strings:
get_txpool_backlog
(backlog
field)get_output_distribution
(distributions
field)Example
For example, the output of
get_txpool_backlog
:is:
The
backlog
field is a JSON string containing raw binary data.Problem
The main problem with these binary strings is that when represented as a string, they do not always contain valid Unicode or escape characters. This is against the JSON specification.
Any sane JSON parser will reject this mixed format, for example:
jq
Python
C++
Rust
Mixing binary and JSON in this manner means that users of these RPC calls must essentially implement a custom JSON parser themselves that can parse this format (including Monero itself).
Replacements
I propose that Monero replaces these binary strings with one of the following options:
Full JSON
RPC output that have binary strings can be replaced with regular JSON output, for example:
Full JSON could be viable depending on how often these RPC call are used. It may not be if these methods are called frequently.
Full binary
The current JSON-RPC methods can be deprecated in favor of
.bin
endpoints (e.g./get_txpool_backlog.bin
) that expect full binary rather than the mixed format.It is worth noting that an un-documented binary version of
get_output_distribution
is already used bywallet2
, in favor of the mixed version.Hexadecimal encoded binary within JSON
Similar to other methods/endpoints, Monero could encode this binary information in hexadecimal before serialization instead of embedding raw binary, for example:
Steps
If this proposal moves forward, the steps towards completion would be:
monerod
's RPC (de)serializationwallet2
)monero-site
documentationThe text was updated successfully, but these errors were encountered: