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

Add ability to resolve ENS and Unstoppable domains to ethereum address #10447

Merged
merged 4 commits into from
Oct 14, 2021

Conversation

yrliou
Copy link
Member

@yrliou yrliou commented Oct 11, 2021

Resolves brave/brave-browser#18531

The first commit is mostly for doing a refactoring to make things easier, and resolve the bug we have right now where we incorrectly use wallet's network setting for browser URL bar address resolution. please see the commit message for all the things changed.
The second is adding two new APIs to resolve UD/ENS to eth addr.
The third commits are updating/adding unit tests.

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@yrliou yrliou added this to the 1.32.x - Nightly milestone Oct 11, 2021
@yrliou yrliou self-assigned this Oct 11, 2021
@yrliou yrliou requested review from iefremov and a team as code owners October 11, 2021 00:53
@yrliou yrliou requested a review from bbondy October 11, 2021 00:54
@yrliou yrliou force-pushed the UD_ENS_new_wallet branch 3 times, most recently from 9371f10 to b9f681d Compare October 11, 2021 02:55
@@ -125,6 +145,13 @@ bool ContentHash(const std::string& domain, std::string* data) {
return ConcatHexStrings(hex_strings, data);
}

bool Addr(const std::string& domain, std::string* data) {
Copy link
Member

Choose a reason for hiding this comment

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

You could add a test for this one and Get pretty easily in components/brave_wallet/browser/eth_data_builder_unittest.cc

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in b35edba

- Get eth_json_rpc_controller directly via browser context in
decentralized_dns_network_delegate_helper.
- Move logic of parsing result of ENS ContentHash & UD GetMany contract
methods from decentralized_dns_network_delegate_helper into
eth_json_rpc_controller and eth_response_parser.
- Expose EnsResolverGetContentHash to callers directly and keep the
process of getting resolver first as internal implementation defails of
eth_json_rpc_controller.
- Add helper methods for getting contract address by chain id.
- Add ability for callers to specify chain_id when doing ENS/UD resolution.
- Add RequestInternal to be able to override network_url when needed.
@yrliou
Copy link
Member Author

yrliou commented Oct 14, 2021

CI all passed.
I don't think we need to block on network owner code review here, as this PR's change in network folder is mainly just moving logics away from decentralized_dns network delegate helper into wallet component and update tests accordingly.
cc @bbondy to help merge it.

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

Successfully merging this pull request may close these issues.

Backend support of ENS and UD address resolution for sending assets
2 participants