Skip to content

Update abi.ParseSelector() to handle complex/nested tuples  #24571

@ATMackay

Description

@ATMackay

Rationale

github.com/ethereum/go-ethereum/accounts/abi.ParseSelector() (added in commit:37f9d25) has expanded the set of selector types that can be converted into ABI JSON spec to include selectors containing nested types. However the current implemetation fails for method selectors containing nested tuples. For example it cannot parse withdraw((address,uint256,uint8)[],bytes) without error as abi.ParseSelector() cannot decode the nested tuple (address,uint256,uint8)[].

When testing against the list of method selectors from https://github.com/ethereum-lists/4bytes/tree/master/signatures I found that 503 of 534583 (0.094092034%) method selectors encounter this error.

Implementation

It may be naive to assume that this can be solved by adding a function to the abi package that detects (..)[] substrings and then refactor abi.parseType() to handle this case within a new if branch...... More thought is needed here...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions