rust-ethereum / ethabi

Encode and decode smart contract invocations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support error type

cburgdorf opened this issue · comments

There doesn't seem to exist support for the new error type that is defined in the latest ABI spec.

Consider the followign solidity code:

pragma solidity ^0.8.5;

error DummyError(uint256 reason);

contract Foo {

  function bar() public pure {
    revert DummyError({reason: 4});
  }
}

The ABI that solc generates from this is:

[
   {
      "inputs":[
         {
            "internalType":"uint256",
            "name":"reason",
            "type":"uint256"
         }
      ],
      "name":"DummyError",
      "type":"error"
   },
   {
      "inputs":[
         
      ],
      "name":"bar",
      "outputs":[
         
      ],
      "stateMutability":"pure",
      "type":"function"
   }
]

Feeding that to ethabi results in the following error:

"Invalid operation type error."

So, I guess error is just not yet supported as a type.

We are also seeing this issue on graphprotocol/graph-node graphprotocol/graph-node#2577

Hey! Any update on this?

bump @vkgnosis do you think Gnosis is able to allocate any resources on this? we're also encountering it in Foundry

Unfortunately we don't have resources for this at the moment. Fortunately, someone has a draft PR already started here: #251

I'll be happy to review and merge as soon it's ready.

@nlordell #251 is ready now, also I forgot to follow up on #248, that is already ready now

Could you please have a look, can prepare a new release after that?