-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for ENSIP-10 #2411
Add support for ENSIP-10 #2411
Conversation
1306e2a
to
9b4ef00
Compare
2e8cb54
to
79c490b
Compare
This is ready for review / discussion.
Of importance here is, because this is such a new functionality, there aren't official test vectors for wildcard resolution. I did manually test on Ropsten as was recommended but for the purposes of our test suite I just added a |
96d9c4e
to
457f510
Compare
FYI, Tested
|
457f510
to
5f95ffe
Compare
@makoto Thanks for testing. Yeah... it was easy to test manually with the examples that were given but I wanted to add some in-house tests that were a bit more difficult for us without official test vectors. I ended up just writing a simple resolver for now. Not ideal but it ends up testing that the functionality works at least. I appreciated the test examples though. That definitely helped manually test everything 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for taking this on! I added some comments but nothing major. Some things we should check before we merge if you haven't already:
- did you check to make sure the doc generation works? Do you think it's worth adding docs to the ENS overview too?
- I can't remember what we decided about backporting this to v5? If we do want to backport, the
fn_name
needs to be changed back toget
for the v5 PR, and the error classes should remain the same.
ens/main.py
Outdated
def resolver(self, normal_name: str) -> Optional['Contract']: | ||
return self._get_resolver(normal_name)[0] | ||
|
||
def resolve(self, name: str, fn_name: str = 'addr') -> Optional[Union[ChecksumAddress, str]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I can't remember where we landed on the change from get
-> fn_name
. Did we decide this was going to be a v6 only feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... changing the signature should def be v6
only. I think it makes more sense for anyone reading the code coming in. v5
would have to remain the same so as to not be a breaking change.
edit for future reference: This will be a v6
only addition since, technically, the new parent resolution functionality is a breaking change.
I think the ENS module could use a big improvement in the docs in general... was thinking about updating the docs in a separate PR but I could tack it on here. Thoughts? I did not check the doc generation... I'll check that out too. edit: Added some doc improvements here |
d4dbe17
to
4d452b9
Compare
4d452b9
to
fbe084e
Compare
fbe084e
to
355dbac
Compare
- Adds support for extended resolvers for wildcard resolution as defined by ENSIP-10. - Adds the method ``parent()`` to the ENS class whose function is to extract the proper parent from an ENS name. - Adds the ``ens_encode_name()`` method that uses DNS name-encoding standards with a few tweaks, such as skipping the fully-encoded length validation for the domain (limit of 255 for DNS) and encoding the empty names as defined by ENSIP-10 as a single zero byte ``b'\x00'``. Unrelated: - Minor cleanup for some existing ens tests
- Test wildcard resolver functionality using a basic resolver with support for the `resolve()` method and validate the parent ens domain and its subdomains within the resolve method of the contract. - Test the new ``ens_encode_name()`` from the ``ens.utils`` module. - Test the new ``ENS.parent()`` method to extract a parent from an ENS name.
- Make ``ENS.resolve()`` an internal method to provide a better user experience / less confusion. ``ENS.address()`` and ``ENS.name()`` should better abstract forward and backward resolution without the need to expose the ``resolve()`` method as part of the API. - Normalize the name being passed into ``ENS.resolver()`` since this is an exposed method for user input. This is done on other methods for the class but was not yet done for ``ENS.resolver()``.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Nice work!
What was wrong?
Related to issue #2406
How was it fixed?
hatch.eth
ens domain on Ropsten as recommended in issue Support for new ENS features #2406.ens.utils.ens_encode_name()
andENS.parent()
methods added to provide support for this implementationTodo:
extendedResolver
interface and functionalityCute Animal Picture