hedera-json-rpc-relay icon indicating copy to clipboard operation
hedera-json-rpc-relay copied to clipboard

`eth_call` errors out when `transaction.to` is set to null

Open quiet-node opened this issue 1 year ago • 1 comments

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

  1. 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"]
}'
  1. 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

quiet-node avatar Apr 12 '24 14:04 quiet-node

Blocking by https://github.com/hashgraph/hedera-mirror-node/issues/8072

quiet-node avatar Apr 12 '24 14:04 quiet-node

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_call with the same params to check if the transaction would cause a revert. 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.

acuarica avatar Jul 12 '24 14:07 acuarica