Skip to content
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

Support for ENS wildcard and offchain resolution #14675

Merged
merged 12 commits into from
Jul 12, 2022

Conversation

makoto
Copy link
Contributor

@makoto makoto commented May 10, 2022

NOTE: This is retry of #14526 as it included some commits I made but for some reason it didn't show my name

Explanation

This PR addresses MetaMask/specifications#9

NOTE: Support for contenthash will be separate PR.

More information

Please read https://medium.com/the-ethereum-name-service/upgrade-ethers-js-to-5-6-1-to-activate-ens-l2-offchain-integration-40ee1a0fdf2a for more deail.

Screenshots/Screencaps

Display forward lookup

Screenshot 2022-04-25 at 16 36 05

Display reverse record (aka primary name)

Screenshot 2022-04-25 at 16 35 48

Manual testing steps

    1. Select testnet (Mainnet/Ropsten/Rinkeby/Goerli network)
    1. Lookup 1.offchainexample.eth to lookup ENS name
    1. Send ETH to 1.offchainexample.eth and check it shows in the transaction log

@makoto makoto requested a review from a team as a code owner May 10, 2022 17:01
@makoto makoto requested a review from mcmire May 10, 2022 17:01
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@makoto makoto changed the title Update ethers.js Support for ENS wildcard and offchain resolution May 11, 2022
0ex-d
0ex-d previously approved these changes May 15, 2022
@makoto
Copy link
Contributor Author

makoto commented May 23, 2022

Hi @mrbaguvix @jacobc-eth . Just wondering if anything else required to get this merged

@seaona
Copy link
Contributor

seaona commented May 30, 2022

Some findings/questions from QA:

  1. It looks like ENS resolution stopped working with emojis in this branch. See difference between this branch (left) and production Extension (right)
    ens-not-resolving

  2. When I look for a subdomain containing emojis, the error Error: STRINGPREP_CONTAINS_UNASSIGNED is thrown on the console and I see ENS Lookup failed. on the UI. Are emojis allowed on subdomains?

image

  1. When an address is not registered (on mainnet), we used to saw the message No address has been set (right). Now we don't see any message, but we cannot proceed with the tx neither.
    I read that you can actually send assets to an ENS name that has never been registered. So I'm wondering in this case, how should we proceed on the UI. Should we allow to go to the next screen and send eth to that ENS address? and/or should we display any message/warning? At the moment, none of these options is happening and maybe it confuses the user

image

  1. On the Address book, we have some differences between this branch (left) and production version (right) when trying to add non-registered ENS. Before we saw a warning text, saying name was not registered, and when proceed, contact was not added and we saw error on update the address book (I don't think it's an ideal flow). Now the process is the same, but we don't see any warning text. I think both approaches could be improved in terms of UI. Not sure how though
address-book.mp4
  1. I can include non-valid address and still be able to click them, while "Recipient address is invalid" message is displayed. I.e. try with a.b..offchainexample.eth or a.b.c..offchainexample.eth
subdomains.mp4
  1. FYI: opened this bug, related to red char highlight, as a separate issue, as it's an old one

  2. FYI: this bug is related to the OffchainResolver contract - it's a separate issue, but I also link it here for context

@makoto
Copy link
Contributor Author

makoto commented May 30, 2022

Hi @seaona thank you for the detailed feedback.
I will look into 3~5.
For 1 and 2, the current ENS name resolution follows a rule specified by IDNA

According to the specification, the emojis like ❤❤❤.eth are supported and both the Metamask and our ens-app website resolve correctly (eg: https://app.ens.domains/name/%E2%9D%A4%E2%9D%A4%E2%9D%A4.eth/details).

However, 😂😂😂.eth (aka "face with tearful joy") uses 0x1f602 which falls in the unassigned range 1D800-1FFFD according to https://datatracker.ietf.org/doc/html/draft-ietf-idn-nameprep#appendix-A.1 hence I would say it is correct behavior not being able to resole these names.

@seaona
Copy link
Contributor

seaona commented May 31, 2022

Thank you so much for the explanation of the emojis, @makoto.

I include below another item, which I think it's not the expected behaviour, but would be great if you could also confirm/take a look.
Basically, when I'm on a testnet (Rinkeby) and I send ETH to a subdomain, I see the ENS domain in the first tx screen, but then, it's not displayed anymore as ENS, but rather as the Address name of Metamask (on confirmation screen) and the Ethereum address (on the tx details).

subdomain-not-displayed.mp4

That's different than the behaviour of a "main" domain, where I see always the ENS name:

image

@makoto
Copy link
Contributor Author

makoto commented Jun 1, 2022

Hi, @seaona I actually can't replicate your case as mariona.eth doesn't seem to have any address set on rinkeby , so not sure why you can even resolve.

Screenshot 2022-06-01 at 17 23 33

In terms of the difference of subdomain (test.mariona.eth) and parent domain (mariona.eth), does this behavior only happen on my PR branch, but not the main branch? I didn't touch UI component so can't think of any reason why it behaves differently unless my ens lookup is throwing different error than main branch hence UI component is not doing correct error handling.

BTW, I am currently doing yarn setup && yarn dist to generate each browser extension and install it to my browser to test but it takes quite a long time to compile. Are there any other ways to test UI behavior?

@makoto
Copy link
Contributor Author

makoto commented Jun 2, 2022

Hi @seaona . I tested again on my normal chrome extension (not the one built from the source) and it doesn't show ENS name on the step 2 nor 3.

Screenshot 2022-06-02 at 10 54 16

Screenshot 2022-06-02 at 10 54 24

Screenshot 2022-06-02 at 10 53 09

@seaona
Copy link
Contributor

seaona commented Jun 3, 2022

hi @makoto thank you very much for your reply and your investigation. Let me check this again and will write back findings in this thread (most likely on Monday)

@makoto
Copy link
Contributor Author

makoto commented Jun 3, 2022

Hi @seaona , I just fixed 3 - 5. PTAL

@seaona
Copy link
Contributor

seaona commented Jun 6, 2022

hi @makoto :) thank you for the updates!!
For having a quick build, instead of building production (yarn dist) you can do yarn start . This will go much faster and it's more convenient while you are developing. Steps are:

  1. Update dependencies: yarn setup
  2. Start project: yarn start - when you see Bundle end: "primary" means that project is ready
  3. Open browser
  4. Upload file from dist/ folder and the appropiate browser folder

Now, everytime you change something on the codebase, you don't need to upload again the source, as it will be updated automatically :)

I've re-tested all the changes and here my updates:
5. I see it fixed
6. I see it fixed
7. I see it fixed

For the mariona.eth I'm seeing the same as you now, might be that while doing some testing I've updated the address resolver 🤔​ I'll do some more testing to confirm and let you know if anything else comes up.
Thank you!!

@makoto
Copy link
Contributor Author

makoto commented Jun 10, 2022

Hi, is there anything else I can help to get this PR merged?

@jacobc-eth
Copy link

Hey @makoto were you still working on also submitting the companion PR on MetaMask Mobile (we'd discussed in this thread: #14526)? This sort of feature really needs cross-client compatibility, and we'd strongly prefer to have it available on MetaMask Mobile in order to merge.

@makoto
Copy link
Contributor Author

makoto commented Jun 17, 2022

@jacobc-eth yes I raised PR on MM Mobile a month ago MetaMask/metamask-mobile#4322 though I couldn't setup the environment by myself so I couldn't test by myself

@Arachnid
Copy link

@jacobc-eth Would it be possible to get some movement on this? Major partners are rolling out subdomains for users soon, and it would be really great to have MM as one of the first wallets to support it.

@makoto
Copy link
Contributor Author

makoto commented Jul 1, 2022

Hi @jacobc-eth @seaona , any update on this?

@jacobc-eth
Copy link

hey @makoto so sorry for the delay and confusion in this thread. thanks so much for submitting the PR for mobile, too. I've personally been extremely sick with COVID and am just now getting caught back up. I'm going to pass along these PRs to the relevant stakeholders and we should be in touch.

@seaona
Copy link
Contributor

seaona commented Jul 4, 2022

@makoto I shared the PR with the extension dev team, to see if we can get the needed approvals

Copy link
Contributor

@darkwing darkwing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and works lovely! Thank you @makoto

@brad-decker brad-decker merged commit fdd8646 into MetaMask:develop Jul 12, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2022
@omnat
Copy link

omnat commented Jul 19, 2022

Hey @makoto, thanks for opening a PR on mobile repo as well! We are looking to release that PR, but it has some merge conflicts that needs your attention. Team is keen to hear if you'll have some time to look into it? Looking forward to hear back. Thank you!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants