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

Some ABIs are not deserializable in Golang #2

Closed
arnaudbriche opened this issue Jul 23, 2024 · 4 comments
Closed

Some ABIs are not deserializable in Golang #2

arnaudbriche opened this issue Jul 23, 2024 · 4 comments

Comments

@arnaudbriche
Copy link

When working in the parquet dump in golang, trying to extract all the ABIs, I've got the following error:

unsupported arg type: Witnet.RadonReducerOpcodes

The message relates to the following ABI:

{
    "name": "encode", 
    "type": "function", 
    "inputs": [
        {
            "name": "reducer", 
            "type": "tuple", 
            "components": [
                {
                    "name": "opcode", 
                    "type": "Witnet.RadonReducerOpcodes", 
                    "internalType": "enum Witnet.RadonReducerOpcodes"
                }, 
                {
                    "name": "filters", 
                    "type": "tuple[]", 
                    "components": [
                        {
                            "name": "opcode", 
                            "type": "Witnet.RadonFilterOpcodes", 
                            "internalType": "enum Witnet.RadonFilterOpcodes"
                        },
                        {
                            "name": "args", 
                            "type": "bytes", 
                            "internalType": "bytes"
                        }
                    ], 
                    "internalType": "struct Witnet.RadonFilter[]"
                }
            ], 
            "internalType": "struct Witnet.RadonReducer"
        }
    ], 
    "outputs": [
        {
            "name": "bytecode", 
            "type": "bytes", 
            "internalType": "bytes"
        }
    ], 
    "stateMutability": "pure"
}

Looks like for enum arguments, the type field should be an int, not Witnet.RadonFilterOpcodes.

@kuzdogan
Copy link
Member

Thanks for the report!

Assuming this is from the compiled_contracts table, could you please share the id of the row?

@arnaudbriche
Copy link
Author

This is indeed from compiled_contracts. The row id is 18fd8e96-9715-4037-a736-d3b3b91297cd

@kuzdogan
Copy link
Member

I was able to reproduce the ABI by recompiling using the data from that row. So it's not wrongly written by the verifier (blockscout). I'm checking if this is a problem in Solidity

@kuzdogan
Copy link
Member

Hey it turns out this is expected in Solidity. The contract in question is a library and non-storage enums for libraries have indeed complex types. I've opened a PR to have this note added in docs: ethereum/solidity#15301

Basically a workaround would be to hard code a uint8 type for enums. See ethereum/solidity#9278 (comment)

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