Skip to content

Remove ENS backward compatibility code in abi_ens_resolver (v7 TODO) #3580

Open
@abhinay

Description

@abhinay

What is the current behavior?

There is a try/except NameNotFound block in abi_ens_resolver that was marked with a TODO comment to remove it in Web3.py v7. Specifically:

try:
    return type_str, validate_name_has_address(_ens, val)
except NameNotFound as e:
    # TODO: This try/except is to keep backwards compatibility when we
    #  removed the mainnet requirement. Remove this in web3.py v7 and allow
    #  NameNotFound to raise.
    if not isinstance(_ens, StaticENS):
        raise InvalidAddress(f"{e}")
    raise e

This backward compatibility handling catches NameNotFound and converts it to InvalidAddress (unless _ens is a StaticENS). According to the comment, we intended to remove this logic once we no longer required backward compatibility for mainnet-only ENS.


What should happen?

  • The try/except block should be removed so that NameNotFound is raised directly as intended in Web3.py v7.
  • Code paths that depend on this legacy behavior should be updated or removed, and associated tests should be adjusted accordingly.

Additional context

  • I’ve already prepared a PR that removes this code. This Issue is just to track the change and generate an Issue number for cross-referencing.
  • If maintainers have feedback on timing (e.g., if it should wait for the next major release), we can discuss in this thread.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions