Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maxhiker opened this issue Mar 2, 2024 · 0 comments

Comments

@maxhiker
Copy link

maxhiker commented Mar 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant