emeraldpay / dshackle

Fault Tolerant Load Balancer for Ethereum and Bitcoin APIs
Apache License 2.0
308 stars 55 forks source link

Params must be an array #258

Closed roderik closed 12 months ago

roderik commented 1 year ago

I'm using quite some tools in the ecosystem on top of dshackle and I've noticed that quite a few have some issues with one of the validations.

https://github.com/emeraldpay/dshackle/blob/f4de5cc32693d79fcc2c27ef1a67688f7c244771/src/main/kotlin/io/emeraldpay/dshackle/proxy/ReadRpcJson.kt#L73-L79

Here there is a check if there is a params field that it needs to be a list. Which is obviously just fine. Also, just below, it is allowed to have no params field at all.

But i have at least 2 tools that have an empty params field

[2023-09-06 10:34:15] {"request":{"jsonrpc":"2.0","id":0,"method":"eth_gasPrice","params":null},"response":{"jsonrpc":"2.0","id":0,"error":{"code":-32600,"message":"Params must be an array"}},"status":200}

I'm wondering here, as it is an N->1 situation and most other direct clients don't have an issue with it, if it would make sense to allow null/undefined too, or replace it with [] in that case?