fix(ens): remove abi_ens_resolver v8 backwards-compat NameNotFound catch#3844
Open
genisis0x wants to merge 1 commit into
Open
fix(ens): remove abi_ens_resolver v8 backwards-compat NameNotFound catch#3844genisis0x wants to merge 1 commit into
genisis0x wants to merge 1 commit into
Conversation
…tch (ApeWorX#3580) The TODO at web3/_utils/normalizers.py:227 flagged the try/except NameNotFound block for removal in web3.py v8. v8 has shipped (beta.3 / 8.0.0-beta.3), so the backward-compat wrap of NameNotFound into InvalidAddress can go. After the change the sync abi_ens_resolver lets NameNotFound propagate from validate_name_has_address regardless of whether the configured resolver is a StaticENS — matching async_abi_ens_resolver which already had no such guard. Updated tests/core/middleware/test_name_to_address_middleware.py::test_fail_name_resolver to expect NameNotFound (the async counterpart at line 179 already does), and dropped the now-unused StaticENS / NameNotFound imports from normalizers.py. Closes ApeWorX#3580
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #3580.
web3/_utils/normalizers.py:227had a TODO flagging thetry/except NameNotFoundblock for removal in v8:v8 has shipped (
8.0.0-beta.3), so the backward-compat wrap can go.Changes
web3/_utils/normalizers.py: drop thetry/exceptand letNameNotFoundpropagate fromvalidate_name_has_addressdirectly. The sync resolver now matchesasync_abi_ens_resolver(line 282-304), which already has no such guard — closing a sync/async inconsistency the TODO already implied.web3/_utils/normalizers.py: remove the now-unusedStaticENSandNameNotFoundimports.tests/core/middleware/test_name_to_address_middleware.py::test_fail_name_resolver: switch the expectation fromInvalidAddresstoNameNotFound. The async counterpart at line 179 (test_async_fail_name_resolver) already expectsNameNotFound, so this aligns the two paths.newsfragments/3580.breaking.rst: user-facing breaking-change note.Compat surface
The only callers exposed to the change are those that previously caught
InvalidAddresson ENS lookup failures specifically. Two filtered grep sweeps to confirm no internal callers in the repo depend on the old shape:pytest.raises(InvalidAddress)sites intests/core/contracts/test_contract_call_interface.pyandtests/core/utilities/test_validation.pypass non-checksum hex addresses throughvalidate_address, not ENS names throughabi_ens_resolver, so they keep raisingInvalidAddressas before.NameNotFound.Tests
pre-commit run --files web3/_utils/normalizers.py tests/core/middleware/test_name_to_address_middleware.py— all hooks green (black, flake8, isort, pydocstyle, mypy, autoflake, pyupgrade, blocklint).