Refactor to allow tezos-client to use binary mode
Context
Clients can use binary mode when calling RPCs thanks to the parameter media_type. This parameter has no effect when using tezos-client.
This merge request allows the binary mode for tezos-client.
The function bin_client/Client_rpc_commands.call now uses the new function cctxt#generic_media_type_call instead of cctxt#generic_json_call. This function checks the accepted media_types set in the config and makes the RPC call accordingly.
The test client_binary_mode is adapted to check the correctness of the answer in addition to testing the call success.
Fix: #1921 (closed)
Manually testing the MR
- Call an rpc in json mode (without parameter should work), for exemple you can run
tezos-client rpc get /version - Call the same rpc in binary mode:
tezos-client --media_type binary rpc get /version. A binary answer must be displayed - You can use
tezos-codedto decode the binary to check the result.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment, theDevelopment Versionsection ofCHANGES.mdfor everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Arvid Jakobsson