heimdall-rs icon indicating copy to clipboard operation
heimdall-rs copied to clipboard

Decompiler - Generated ABIs don't meet the Solidity ABI Spec ("bytes memory" is an invalid type)

Open zilayo opened this issue 11 months ago • 1 comments

Component

Heimdall (Core)

Have you ensured that you are up to date?

  • [X] Bifrost
  • [X] Heimdall

What version of Heimdall are you on?

heimdall 0.7.3

Operating System

macOS (Apple Silicon)

Describe the bug

The ABI generated by the decompiler module generates an ABI that doesn't comply with the Solidity ABI Spec.

ABI generated for WETH:

[{"constant":false,"inputs":[],"name":"name","outputs":[{"internalType":"bytes memory","name":"ret0","type":"bytes memory"}],"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"arg0","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"arg0","type":"address"},{"internalType":"address","name":"arg1","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"ret0","type":"uint256"}],"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"arg0","type":"address"},{"internalType":"uint256","name":"arg1","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"ret0","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"arg0","type":"address"},{"internalType":"uint256","name":"arg1","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"ret0","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"decimals","outputs":[{"internalType":"bool","name":"ret0","type":"bool"}],"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"arg0","type":"address"},{"internalType":"address","name":"arg1","type":"address"},{"internalType":"uint256","name":"arg2","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"ret0","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"symbol","outputs":[{"internalType":"bytes memory","name":"ret0","type":"bytes memory"}],"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"address","name":"ret0","type":"address"}],"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"arg0","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"ret0","type":"uint256"}],"stateMutability":"view","type":"function"}]

Several of the input/output params have a type of bytes memory. Per the spec the storage location shouldn't be included in the ABI - the only valid type in these instances would be bytes (https://docs.soliditylang.org/en/latest/abi-spec.html#types).

This causes issues when trying to use the generated ABI with third party tooling such as alloy / ethers, since they see bytes memory as an invalid type.

zilayo avatar Mar 15 '24 21:03 zilayo

will fix for next update.

Jon-Becker avatar Mar 16 '24 07:03 Jon-Becker

resolved in #372

Jon-Becker avatar May 07 '24 18:05 Jon-Becker