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

[Bug] Numeric id not supported anymore in JSON RPC call #1369

Closed
nmeilick opened this issue Dec 2, 2021 · 1 comment · Fixed by #1539
Closed

[Bug] Numeric id not supported anymore in JSON RPC call #1369

nmeilick opened this issue Dec 2, 2021 · 1 comment · Fixed by #1539
Labels
bug Incorrect or unexpected behavior RPC RPC-related issues testnet2

Comments

@nmeilick
Copy link

nmeilick commented Dec 2, 2021

🐛 Bug Report

JSON RPC does not accept a numeric id anymore and responds with Couldn't parse the RPC body. When id is given as a String or Null, the API call works. This behavior is new and was apparently introduced in a change within the past 12 hours.

Steps to Reproduce

  1. curl -s -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"latestblockheight","params":[],"id":1}' localhost:3032
    Output: {"jsonrpc":"2.0","error":{"code":-32700,"message":"Couldn't parse the RPC body"},"id":null}

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

Expected Behavior

Support id as String, Number and Null, as in the JSON RPC specs

Your Environment

snarkOS: 2.0.0 (c762a1d)
Rust: 1.56.1
OS: Ubuntu Linux 20.04

@nmeilick nmeilick added the bug Incorrect or unexpected behavior label Dec 2, 2021
@ljedrz ljedrz added RPC RPC-related issues testnet2 labels Dec 6, 2021
@ljedrz
Copy link
Collaborator

ljedrz commented Dec 6, 2021

Correct, the JSON-RPC 2.0 spec allows the id to be numeric.

code-pangolin added a commit to code-pangolin/snarkOS that referenced this issue Dec 23, 2021
replace json_rpc_types::Request whith jsonrpc_core::Request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect or unexpected behavior RPC RPC-related issues testnet2
Projects
None yet
2 participants