hedera-json-rpc-relay
hedera-json-rpc-relay copied to clipboard
Some Methods fail to send a response when called with WS endpoint
Description
Some methods such as ( noticed so far)
- eth_blockNumber
- estimateGasPrice Does not return any response when accessed through go-ethereum client whereas it works with ethers.js clients
Steps to reproduce
import ( "context" "log" "github.com/ethereum/go-ethereum/ethclient" )
func main() { client, err := ethclient.Dial("WSS_URL") block, _ := client.BlockNumber(context.Background()) log.Println("Block: ", block) }
Additional context
No response
Hedera network
testnet
Version
0.47.0-rc3
Operating system
None
I have drilled this how the request is sent via go-ethereum vs Ethers.js go-ethereum sends no params for these requests - so its treated as undefined by the Relay code & it panics without proper exception handling & null checks
It works with Ethers.js because it sends an empty array
Thanks for the ticket and this is indeed a great catch!
Essentially go-ethereum package does not include params field in the jsonrpc request objects for the methods that do not require any params, i.e. eth_chainId, eth_gasPrice, eth_blockNumber, etc. This results in the undefined for params field and eventually leads to the error while parsing the value in the server. Still not sure how I missed this case where params could be undefined, especially when I covered all the validation checks for other fields in the jsonrpc object like theid, jsonrpc, method. Anywho, the work is in review. Easy fix!