-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
disasm: Names for Tuple Components are not set #148
Comments
HMMM! That is annoying behaviour on go-ethereum's part! I'm generally hesitant to add made up results that WhatsABI did not actually extract. It would make it harder to distinguish if the ABI actually has a field named _0 vs the disassembler just assigning it that name. I guess some options:
What do you think? |
@shazow I understand your concern; that makes a lot of sense. From a user’s perspective, I think having a Geth-friendly ABI generated by default might be preferable. |
@yohamta I'm hesitant to make it default but I'll consider it. Would you be interested in contributing this? Could start with a standalone helper like |
That sounds good to me! I'll open a draft PR later so we can discuss further. |
@yohamta Do you have a deployed contract/whatsabi code to reproduce this issue by the way? |
@shazow Yes, here is the contract that reproduces the issue: |
Problem
When inferring ABIs from bytecode, WhatsABI currently omits names for tuple components that are likely derived from Solidity structs. While the ABI specification technically allows unnamed tuple components, Solidity always generates names for struct members when creating the ABI. This discrepancy causes compatibility issues with libraries like go-ethereum that expect these names to be present when working with structs (See https://github.com/ethereum/go-ethereum/blob/v1.14.11/accounts/abi/type.go#L181).
Example contract:
ABI Generated by Solidity Compiler:
Proposed solution
Fill in the component names with_n
when they're empty.Fill in the component names with
field${n}
when they're empty.Example:
To be:
EDIT: Adjusted the placeholder format that should be supported by geth.
The text was updated successfully, but these errors were encountered: