Closed blackyblack closed 1 month ago
null
is not a valid params value (see JSON-RPC 2.0 Spec).
My guess is that most providers accept it because most providers use geth, and geth's JSON unmarshalling doesn't tell apart missing values from values set to null
.
I think it makes sense for us to follow the spec here.
There is no direct prohibition for null
value according to spec. And null
is a valid JSON literal. Or you can show me where spec fordbids null
value to prove me wrong.
JSON can represent four primitive types (Strings, Numbers, Booleans, and Null) and two structured types (Objects and Arrays)
params A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
You are right. Thanks.
Version of Hardhat
2.19.1
What happened?
"Invalid request" response is received when
params
field is set tonull
. Other public RPC providers process suchparams
successfully.Minimal reproduction steps
Send POST request to hardhat node:
{"jsonrpc":"2.0","method":"eth_chainId","params": null,"id":1}
Expected result:
Hardhat result:
Search terms
params, null