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

fix: fix #1369 Numeric id not supported anymore in JSON RPC call #1496

Closed
wants to merge 2 commits into from

Conversation

code-pangolin
Copy link
Contributor

replace json_rpc_types::Request whith jsonrpc_core::Request

Motivation

fix https://github.com/AleoHQ/snarkOS/issues/1369

Test Plan

curl -s -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"latestblockheight","params":[],"id":"1"}' localhost:3032
{"jsonrpc":"2.0","result":62514,"id":"1"}% 

curl -s -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"latestblockheight","params":[],"id":1}' localhost:3032  
{"jsonrpc":"2.0","result":62514,"id":1}%  

## ref

seems the serde_json feature "arbitrary_precision" causes this bug: serde-rs/json#505 paritytech/jsonrpsee#480

fixed it by replacing json_rpc_types::Request whith jsonrpc_core::Request and use the workaround in https://docs.rs/jsonrpc-core/18.0.0/src/jsonrpc_core/lib.rs.html#69

the jsonrpc_core crate supports batch call, i will add the batch call feature in future, and try to remove the json_rpc_types crate completely.

@ljedrz ljedrz added RPC RPC-related issues testnet2 labels Jan 7, 2022
@ljedrz
Copy link
Collaborator

ljedrz commented Jan 7, 2022

While a fix for the id issue is welcome, it would be best to limit the use of jsonrpc-* crates for the reasons outlined in https://github.com/AleoHQ/snarkOS/issues/754. json-rpc-types was picked as a temporary replacement as it will be much simpler to later migrate to jsonrpsee once the latter is ready for production use.

@raychu86
Copy link
Contributor

Closed in favor of #1539

@raychu86 raychu86 closed this Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RPC RPC-related issues testnet2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Numeric id not supported anymore in JSON RPC call
3 participants