Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

[FEATURE REQUEST] Allow eth_call to accept either the "input" field or the legacy "data" field #3922

@maxhiker

Description

@maxhiker

Now it works this way:
success

$ curl -d '{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [
        {
            "data": "0x2e64cec1",
            "to": "0xa4ce7a086073d666a69064f6220b8aeb2947a535"
        },
        "latest"
    ]
}
' -H "Content-Type: application/json" -X POST http://127.0.0.1:5555
{"id":1,"jsonrpc":"2.0","result":"0x0000000000000000000000000000000000000000000000000000000000000005"}

Failure (with "input" field instead of "data"):

$ curl -d '{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [
        {
            "input": "0x2e64cec1",
            "to": "0xa4ce7a086073d666a69064f6220b8aeb2947a535"
        },
        "latest"
    ]
}
' -H "Content-Type: application/json" -X POST http://127.0.0.1:5555
{"error":{"code":3,"data":"0x","message":"execution reverted"},"id":1,"jsonrpc":"2.0"}

Isolated server logs:

[7f55aafe5640][24-03-02T15:23:58.250][hRpcMethods.cpp:1048][GetEthCallImpl      ] Warning! Execution reverted...
[7f55aafe5640][24-03-02T15:23:58.250][Api.cpp:60          ][EventMetricTrace    ] Invalid revert data for unpacking
[7f55aa7e4640][24-03-02T15:41:59.657][EthRpcMethods.h:47  ][GetEthCallEthI      ] BEG
[7f55aa7e4640][24-03-02T15:41:59.657][thRpcMethods.cpp:951][GetEthCallImpl      ] GetEthCall:{
	"input" : "0x2e64cec1",
	"to" : "0xa4ce7a086073d666a69064f6220b8aeb2947a535"
}

Documentation of eth_call says:

input: DATA - (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation(opens in a new tab).

I believe "data" is some legacy field, which is changed to "input" now. But different tools still use "data" field, for example, Ethers.js, web3 cli etc. Other tools, like Go-bindings, generated by abigen, use "input" field, what leads to error described above.

Is it possible to make eth_call to accept either the "input" field or the legacy "data" field?
Here is example how it is done in Anvil: foundry-rs/foundry#5918

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions