Skip to content

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Mar 16, 2025

Toward https://github.com/snapshot-labs/workflow/issues/485

This PR adds support for checking a domain owner offchain, using the domain DNS records for top level donain (
https://docs.ens.domains/registry/dns#offchain-verification-gasless), and resolved address for subdomain

For offchain subdomains, it will return the resolved address as owner, since offchain subdomain do not have the concept of owner/controller

Also edit the function signature to always return an address, to be combatible with sx

Test

const owner = await snapshot.utils.getEnsOwner(DOMAIN);
  • It should return results as before for regular .eth domains
  • It should return results for regular domains, using the dns txt records to prove ownership (like defi.app)
  • It should return results for subdomain, such as lucemans.cb.id

Those offchain subdomains should resolved to these addresses

{
    "defi.app": "0x7aeB96261e9dC2C9f01BaE6A516Df80a5a98c7eB",
    "lucemans.cb.id": "0x4e7abb71BEe38011c54c30D0130c0c71Da09222b",
    "lucemans.uni.eth": "0x225f137127d9067788314bc7fcc1f36746a3c3B5",
    "ulas.clv.eth": "0xd883E2d407361049dd3DACE2fF4278D75BC11d2A"
  }

@wa0x6e wa0x6e changed the title feat: offchain validate name owner fron DNS feat: offchain validate name owner Mar 17, 2025
@wa0x6e
Copy link
Contributor Author

wa0x6e commented Mar 17, 2025

Code has been updated to also support offchain subdomains

@wa0x6e wa0x6e force-pushed the feat-check-offchain-dns-owner branch from dbfb663 to b55dafc Compare March 17, 2025 20:52
@wa0x6e wa0x6e force-pushed the feat-check-offchain-dns-owner branch from dbd43b1 to 6c555fa Compare March 19, 2025 18:13
@wa0x6e wa0x6e requested a review from ChaituVR March 19, 2025 18:58
src/utils.ts Outdated
Comment on lines 708 to 709
const sepoliaMissingResolverError =
e.message.includes('UNSUPPORTED_OPERATION') && network === '11155111';
Copy link
Member

Choose a reason for hiding this comment

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

Is there some other way than hardcoding sepolia? this testnet can change time to time

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can just ignore all unsupported operations irrespective of the network?

Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

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

Everything else is working well

@wa0x6e wa0x6e requested a review from ChaituVR March 26, 2025 17:16
wa0x6e and others added 2 commits March 27, 2025 02:51
Co-authored-by: Chaitanya <yourchaitu@gmail.com>
Co-authored-by: Chaitanya <yourchaitu@gmail.com>
@wa0x6e wa0x6e requested a review from ChaituVR March 26, 2025 17:51
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

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

tAck

@ChaituVR ChaituVR merged commit ebf3cfb into master Mar 26, 2025
4 checks passed
@ChaituVR ChaituVR deleted the feat-check-offchain-dns-owner branch March 26, 2025 18:01
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.

2 participants