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

Support "input" field in eth_call, eth_estimateGas #1852

Merged
merged 6 commits into from
Mar 20, 2024

Conversation

DmytroNazarenko
Copy link
Collaborator

Description

This PR adds support of "input" field in eth_call, eth_estimateGas according to ETH RPC documentation: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call. Field "data" will be still supported

Tests

Unit test:
Enhance JsonRpcSuite/simple_contract with new call format

Manual test:

  1. Run skaled w/o fix (e.g. 3.18.0)
  2. Deploy simple contract
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

contract Storage {

    uint256 a;

    function getA() public view returns (uint256) {
        return a;
    }

    function setA(uint _a) external  {
        a = _a;
    }
}
  1. Run cmd:
curl ENDPOINT -X POST -H "Content-Type: application/json" -d  '{"id":1931024001,"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"input":"0xd46300fd","from":"0xa68F946090c600eDa6f139783077EE802Afeb990","to":"0x9EcD93c2cF9E551B3B02939c72D3F515A8cb76B0","type":"0x1","value":"0x0"},"latest"]}'
  1. Run cmd:
curl ENDPOINT -X POST -H "Content-Type: application/json" -d  '{"id":1931024001,"jsonrpc":"2.0","method":"eth_call","params":[{"input":"0xd46300fd","from":"0xa68F946090c600eDa6f139783077EE802Afeb990","to":"0x9EcD93c2cF9E551B3B02939c72D3F515A8cb76B0","type":"0x1","value":"0x0"},"latest"]}'
  1. Both cmds return EVM revert instruction without description message
  2. Update skaled, run steps 3-4. Commands should return:
eth_call: {"id":1931024001,"jsonrpc":"2.0","result":"0x000000000000000000000000000000000000000000000000000000000000007b"}
eth_estimateGas: {"id":1931024001,"jsonrpc":"2.0","result":"0x54db"}

Performance Impact

JSON RPC API change only, no performance impact

@DmytroNazarenko DmytroNazarenko marked this pull request as ready for review March 19, 2024 20:18
dimalit
dimalit previously approved these changes Mar 19, 2024
@DmytroNazarenko DmytroNazarenko merged commit 73803db into v3.19.0 Mar 20, 2024
5 checks passed
@DmytroNazarenko DmytroNazarenko deleted the enhancement/update-eth-call-api branch March 20, 2024 19:40
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go-ethereum>=1.13.0 is not compatible because eth_call API has changed (data became input for call arguments)
4 participants