hedera-json-rpc-relay
hedera-json-rpc-relay copied to clipboard
`eth_call` errors out when `transaction.to` is set to null
Description
Currently, eth_call will reject requests that have transaction.to set to null. However, it should accept nullable transaction.to in the cases of contract deployment.
Steps to reproduce
- Run below cURL request
curl --location 'https://testnet.hashio.io/api' \
--header 'Content-Type: application/json' \
--data '{
"id": "test_id",
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"from":"0x05fba803be258049a27b820088bab1cad2058871",
"to": null,
"data":"0x60806040"}, "latest"]
}'
- Observe the response to see the error like below
{"error":{"code":-32602,"name":"Invalid parameter","message":"[Request ID: b2a2c4cf-1ce4-4a56-bbc3-c25e51c51c53] Invalid parameter 'to' for TransactionObject: Expected 0x prefixed string representing the address (20 bytes), value: null"},"jsonrpc":"2.0","id":"test_id"}
Additional context
No response
Hedera network
mainnet, testnet, previewnet, other
Version
latest
Operating system
None
Blocking by https://github.com/hashgraph/hedera-mirror-node/issues/8072
The ArianeLabs team identified a problem when trying to use Brownie with Hedera Testnet. It appears that before executing a transaction, Brownie tries to execute an
eth_callwith the same params to check if the transaction would cause arevert. When they tried to deploy a smart contract, Hedera responded with"Invalid Contract Address: undefined"for such a call.
cc. @arianejasuwienas
After investigation, we realized this problem is caused by the non-nullable to field.