Skip to content

Commit 71ab10e

Browse files
committed
Remove backwards-compatibility for ENS mainnet requirement, let NameNotFound raise
1 parent aefb880 commit 71ab10e

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

Diff for: tests/core/middleware/test_name_to_address_middleware.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import pytest
2-
32
import pytest_asyncio
43

54
from web3 import (
65
AsyncWeb3,
76
Web3,
87
)
98
from web3.exceptions import (
10-
InvalidAddress,
119
NameNotFound,
1210
)
1311
from web3.middleware import (
@@ -95,7 +93,7 @@ def test_pass_name_resolver_send_transaction_dict_args(
9593

9694

9795
def test_fail_name_resolver(w3):
98-
with pytest.raises(InvalidAddress, match=r".*ethereum\.eth.*"):
96+
with pytest.raises(NameNotFound, match=r".*ethereum\.eth.*"):
9997
w3.eth.get_balance("ethereum.eth")
10098

10199

Diff for: web3/_utils/normalizers.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,7 @@ def abi_ens_resolver(
224224
f"Could not look up name {val!r} because ENS is set to None"
225225
)
226226
else:
227-
try:
228-
return type_str, validate_name_has_address(_ens, val)
229-
except NameNotFound as e:
230-
# TODO: This try/except is to keep backwards compatibility when we
231-
# removed the mainnet requirement. Remove this in web3.py v7 and allow
232-
# NameNotFound to raise.
233-
if not isinstance(_ens, StaticENS):
234-
raise InvalidAddress(f"{e}")
235-
raise e
227+
return type_str, validate_name_has_address(_ens, val)
236228
else:
237229
return type_str, val
238230

0 commit comments

Comments
 (0)