Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tests/core/middleware/test_name_to_address_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Web3,
)
from web3.exceptions import (
InvalidAddress,
NameNotFound,
)
from web3.middleware import (
Expand Down Expand Up @@ -95,7 +94,7 @@ def test_pass_name_resolver_send_transaction_dict_args(


def test_fail_name_resolver(w3):
with pytest.raises(InvalidAddress, match=r".*ethereum\.eth.*"):
with pytest.raises(NameNotFound, match=r".*ethereum\.eth.*"):
w3.eth.get_balance("ethereum.eth")


Expand Down
12 changes: 1 addition & 11 deletions web3/_utils/normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
text_if_str,
)
from web3._utils.ens import (
StaticENS,
async_validate_name_has_address,
is_ens_name,
validate_name_has_address,
Expand All @@ -60,7 +59,6 @@
)
from web3.exceptions import (
InvalidAddress,
NameNotFound,
Web3ValueError,
)

Expand Down Expand Up @@ -224,15 +222,7 @@ def abi_ens_resolver(
f"Could not look up name {val!r} because ENS is set to None"
)
else:
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
return type_str, validate_name_has_address(_ens, val)
else:
return type_str, val

Expand Down