Skip to content

Return values for eth_call are truncated when using revert #941

Closed
@Uxio0

Description

@Uxio0
  • Version: 4.4.0
  • Python: 3.6
  • OS: linux

What was wrong?

When calling a contract with eth_call to a function that has a revert(string(abi.encodePacked("Hello"))); I would expect a return value like this:

0x08c379a0                                                         // Function selector for Error(string)
0000000000000000000000000000000000000000000000000000000000000020 // Data offset
000000000000000000000000000000000000000000000000000000000000001a // String length
4e6f7420656e6f7567682045746865722070726f76696465642e000000000000 // String data

As stated in the solidity documentation: http://solidity.readthedocs.io/en/v0.4.24/control-structures.html

Instead, I get the return value truncated:

0x8c379a000000000000000000000000000000000000000000000000000000000

If I see the RPC Call that web3 does in Wireshark I see this as the result:

0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000001df7

How can it be fixed?

Don't truncate the return value

UPDATE

I can just reproduce the issue calling mycontract.functions.myfunction().call(). If I use eth.call I get the non truncated output (as it should be)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions