-
Notifications
You must be signed in to change notification settings - Fork 1.8k
ENS - Stop inferring .eth TLD #1205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
922dfea
fce2e20
11d06e2
1ab9472
903f646
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
import pytest | ||
from unittest.mock import ( | ||
patch, | ||
|
@@ -32,12 +31,7 @@ | |
'0x2a7ac1c833d35677c2ff34a908951de142cc1653de6080ad4e38f4c9cc00aafe', | ||
), | ||
( | ||
'tester', | ||
'tester.eth', | ||
'0x2a7ac1c833d35677c2ff34a908951de142cc1653de6080ad4e38f4c9cc00aafe', | ||
), | ||
( | ||
'TESTER', | ||
'TESTER.eth', | ||
'TESTER.eth', | ||
'0x2a7ac1c833d35677c2ff34a908951de142cc1653de6080ad4e38f4c9cc00aafe', | ||
), | ||
|
@@ -63,27 +57,19 @@ | |
'lots.of.subdomains.tester.eth', | ||
'0x0d62a759aa1f1c9680de8603a12a5eb175cd1bfa79426229868eba99f4dce692', | ||
), | ||
( | ||
'lots.of.subdomains.tester', | ||
'lots.of.subdomains.tester.eth', | ||
'0x0d62a759aa1f1c9680de8603a12a5eb175cd1bfa79426229868eba99f4dce692', | ||
), | ||
], | ||
) | ||
def test_set_address(ens, name, full_name, namehash_hex, TEST_ADDRESS): | ||
assert ens.address(name) is None | ||
owner = ens.owner('tester') | ||
owner = ens.owner('tester.eth') | ||
|
||
ens.setup_address(name, TEST_ADDRESS) | ||
assert is_same_address(ens.address(name), TEST_ADDRESS) | ||
|
||
# check that .eth is only appended if guess_tld is True | ||
namehash = Web3.toBytes(hexstr=namehash_hex) | ||
normal_name = ens.nameprep(full_name) | ||
if ens.nameprep(name) == normal_name: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can either drop this |
||
assert is_same_address(ens.address(name, guess_tld=False), TEST_ADDRESS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think just this assertion should stay in, omitting |
||
else: | ||
assert ens.address(name, guess_tld=False) is None | ||
assert is_same_address(ens.address(name), TEST_ADDRESS) | ||
|
||
# check that the correct namehash is set: | ||
assert is_same_address(ens.resolver(normal_name).addr(namehash), TEST_ADDRESS) | ||
|
@@ -98,7 +84,7 @@ def test_set_address(ens, name, full_name, namehash_hex, TEST_ADDRESS): | |
@pytest.mark.parametrize( | ||
'name, equivalent', | ||
[ | ||
('TESTER', 'tester.eth'), | ||
('TESTER.eth', 'tester.eth'), | ||
('unicÖde.tester.eth', 'unicöde.tester.eth'), | ||
], | ||
) | ||
|
@@ -165,12 +151,15 @@ def getowner(name): | |
|
||
|
||
def test_set_resolver_leave_default(ens, TEST_ADDRESS): | ||
owner = ens.owner('tester') | ||
owner = ens.owner('tester.eth') | ||
ens.setup_address('leave-default-resolver.tester.eth', TEST_ADDRESS) | ||
eth = ens.web3.eth | ||
num_transactions = eth.getTransactionCount(owner) | ||
|
||
ens.setup_address('leave-default-resolver.tester', '0x5B2063246F2191f18F2675ceDB8b28102e957458') | ||
ens.setup_address( | ||
'leave-default-resolver.tester.eth', | ||
'0x5B2063246F2191f18F2675ceDB8b28102e957458' | ||
) | ||
|
||
# should skip setting the owner and setting the default resolver, and only | ||
# set the name in the default resolver to point to the new address | ||
|
Uh oh!
There was an error while loading. Please reload this page.