Skip to content

Conversation

@shrugs
Copy link
Collaborator

@shrugs shrugs commented Dec 23, 2025

closes #1403

  • configuration and knowledge of a contract's managed name was way too diffuse before this
  • centralizes knowledge of contracts and their managed names
  • improves naming, removes special semantic type because i think it created more confusion than necessary
  • caches the namehashing of managed names

@shrugs shrugs requested a review from a team as a code owner December 23, 2025 19:28
@changeset-bot
Copy link

changeset-bot bot commented Dec 23, 2025

⚠️ No Changeset found

Latest commit: 36d2bdc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Dec 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Dec 26, 2025 9:22pm
ensnode.io Ready Ready Preview, Comment Dec 26, 2025 9:22pm
ensrainbow.io Ready Ready Preview, Comment Dec 26, 2025 9:22pm

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@shrugs Hey I like making this code less diffuse 👍 Reviewed and shared a few suggestions.

* @see https://github.com/base/basenames/blob/1b5c1ad/src/L2/RegistrarController.sol#L488
* @see https://github.com/Consensys/linea-ens/blob/3a4f02f/packages/linea-ens-contracts/contracts/ethregistrar/ETHRegistrarController.sol#L447
*/
export const tokenIdToLabelHash = (tokenId: bigint): LabelHash => uint256ToHex32(tokenId);
Copy link
Member

Choose a reason for hiding this comment

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

Let's find a strategy where this isn't at the global scope and/or is not given a name that sounds like it should work across all contexts the way that tokenIdToLabelHash does. The current framing of this function suggests it should be a universal utility however it's an implementation detail that each subregistry can implement a custom strategy for.

For example, all registries that manage multiple / (almost) all names, including the NameWrapper or 3DNS registries use namehash, rather than labelhash based tokenIds.

A strategy I've had in mind for this would be to define some class / interface for each of the registry's we implement special logic for, and then each of those class / interface implementations could define custom logic as relevant. Wdyt?

The constructor for such a class might read from a config to decide what the managed name is depending on the namespace, etc.

Please check related ideas in apps/ensindexer/src/lib/tokenscope/nft-issuers.ts including the getDomainId: (tokenId: TokenId): Node functions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the act of calling tokenIdToLabelHash encodes the information that this contract (whatever it is) is encoding labelhashes as tokenIds. would a name like this assuage your concerns?

  • decodeTokenIdAsLabelHash
  • decodeTokenIdAsNameHash

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.

3 participants