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

enum gets downcasted to uint8 #132

Open
gosuto-inzasheru opened this issue Jun 5, 2024 · 7 comments
Open

enum gets downcasted to uint8 #132

gosuto-inzasheru opened this issue Jun 5, 2024 · 7 comments

Comments

@gosuto-inzasheru
Copy link

gnosis' Delay contract contains an Enum.Operation that when generating the interface simply gets reduced to a uint8.

why is there no proper declaration of the Operation enum included in the interface?

@gnidan
Copy link
Owner

gnidan commented Jun 5, 2024

Sounds like a bug, or possibly the input ABI JSON is missing the necessary internalType information.

Apologies that I'm going out of town for a few days, but I will look into this when I get back next week.

Thanks for raising this!

@gosuto-inzasheru
Copy link
Author

the abi does contain internalType data, eg:

{
  "inputs": [
    { "internalType": "address", "name": "to", "type": "address" },
    { "internalType": "uint256", "name": "value", "type": "uint256" },
    { "internalType": "bytes", "name": "data", "type": "bytes" },
    {
      "internalType": "enum Enum.Operation",
      "name": "operation",
      "type": "uint8"
    }
  ],
  "name": "execTransactionFromModule",
  "outputs": [{ "internalType": "bool", "name": "success", "type": "bool" }],
  "stateMutability": "nonpayable",
  "type": "function"
}

@gnidan
Copy link
Owner

gnidan commented Jun 5, 2024

Oh, right! I remember now - this tool hasn't been able to support enums because the ABI JSON does not encode the values of the enum. This would have to be a new feature to allow you to specify these values, separately from the ABI JSON.

Kind of annoying, sorry :/

@gosuto-inzasheru
Copy link
Author

a feature as in a feature in the abi standard or as in a feature in the abi-to-sol tool?

@gnidan
Copy link
Owner

gnidan commented Jun 5, 2024

Feature in abi-to-sol - like on the web UI, imagine new text boxes to specify extra info (or a flag on the CLI)

This might be something that could be added to the ABI JSON itself, but that would require Solidity to agree to add it, and then it wouldn't exist for older contracts anyway.

@gosuto-inzasheru
Copy link
Author

i see; the abi json is the limitation here

my use case would require this to be available in the cli version of the app, but i understand that that wont be possible either way (unless the abi json standard is amended)

feel free to close :)

@gnidan
Copy link
Owner

gnidan commented Jun 5, 2024

Yeah, sorry that it's not easier.

I'll keep this issue open... I'd like to address this someday, and this issue will remind me :)

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants