Skip to content

Conversation

@tk-o
Copy link
Contributor

@tk-o tk-o commented May 27, 2025

This PR makes two important changes:

  1. Make it possible to attempt reverse address healing for events coming exclusively from one of the ENS Deployment Chains (mainnet, sepolia, holesky, ens-test-env).

    • Note: reverse label healing is dependent only on Reverse Registry from an ENS Deployment Chain. Hence, we check just the chain of origin for a given event.
  2. Introduce two additional strategies of healing reverse addresses

    a) If the original strategy failed to heal the label with transaction sender address, try healing the label with owner address from event arguments.

    b) If the above strategy failed to heal the label with owner address from event arguments, call RPC for all transaction traces, extract all valid EVM address from those traces, and try to heal the label with each extracted address. One of these extracted addresses must be a hit.

Resolves #616

tk-o added 2 commits May 27, 2025 18:50
Include two addintional strategies to heal labels from reverse registry. Important note: the reverse address healing must only occur for events coming from one of ENS Deployment Chains.
@tk-o tk-o requested a review from a team as a code owner May 27, 2025 16:59
@changeset-bot
Copy link

changeset-bot bot commented May 27, 2025

🦋 Changeset detected

Latest commit: b3b7f43

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
ensindexer Minor
ensadmin Minor
ensrainbow Minor
@ensnode/ens-deployments Minor
@ensnode/utils Minor
@ensnode/ensrainbow-sdk Minor
@ensnode/ponder-metadata Minor
@ensnode/ensnode-schema Minor
@ensnode/ponder-subgraph Minor
@ensnode/shared-configs Minor

Not sure what this means? Click here to learn what changesets are.

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

@vercel
Copy link

vercel bot commented May 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
admin.ensnode.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 6:38pm
ensnode.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 6:38pm
ensrainbow.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 6:38pm

@tk-o tk-o changed the title Feat/616 ens deployment chain only reverse address healing feat(ensindexer): advanced reverse address healing May 27, 2025
Copy link
Collaborator

@shrugs shrugs left a comment

Choose a reason for hiding this comment

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

LGTM

@tk-o tk-o merged commit 48022d6 into main May 27, 2025
7 checks passed
@tk-o tk-o deleted the feat/616-ens-deployment-chain-only-reverse-address-healing branch May 27, 2025 18:39
@github-actions github-actions bot mentioned this pull request May 27, 2025
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.

@tk-o Super work on this PR! 🚀 Reviewed and shared a few suggestions 👍

const ensDeploymentChainId = getEnsDeploymentChainId();
let healedLabel = null;

// 1. if healing label from reverse addresses is enabled, and the parent is a known
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// 1. if healing label from reverse addresses is enabled, and the parent is a known
// 1. if healing labels from reverse addresses is enabled, and the parent is a known

// reverse node (i.e. addr.reverse), give it a go
if (config.healReverseAddresses && REVERSE_ROOT_NODES.has(parentNode)) {
// reverse node (i.e. addr.reverse), and
// the event comes from the chain that is the ENS Deployment Chain, give it a go.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// the event comes from the chain that is the ENS Deployment Chain, give it a go.
// the event comes from the chain that is the ENS Deployment Chain, then attempt to heal the unknown label.

if (config.healReverseAddresses && REVERSE_ROOT_NODES.has(parentNode)) {
// reverse node (i.e. addr.reverse), and
// the event comes from the chain that is the ENS Deployment Chain, give it a go.
// Note: the reverse address healing must only be enabled for ENS Deployment Chains,
Copy link
Member

Choose a reason for hiding this comment

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

Suggest to replace this comment.

The key idea we want to communicate here is ENSIP-19: https://docs.ens.domains/ensip/19

Based on this standard, only an ENS Deployment Chain (such as mainnet, holesky, or sepolia) may record primary names under the addr.reverse subname.

Currently, we are only healing primary names on ENS Deployment Chains. We will add support for non-ENS Deployment Chain primary name healing in the future.

labelHash,
});

// if that didn't work, try healing with the event's`owner` address
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// if that didn't work, try healing with the event's`owner` address
// if that didn't work, try healing with the event's `owner` address

labelHash,
});

// if that didn't work, try healing with the event's`owner` address
Copy link
Member

Choose a reason for hiding this comment

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

Can we document why sometimes the sender address won't work but the owner address will work? It would be nice to give a specific example transaction too, if possible.

This is very helpful for us when we or others look back on this logic months or years from now and we are trying to understand why we made some of these decisions.

Best to do it now while it is still fresh in our mind.

if (!healedLabel) {
// by this point, we have exhausted all options for healing the reverse address
// and we still don't have a valid label, so we throw an error
throw new Error(
Copy link
Member

Choose a reason for hiding this comment

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

This is awesome! I love enforcing an expectation of a 100% success rate 👍

const uniqueAddresses = new Set<Address>();

// Helper function to search for plain addresses (0x followed by 40 hex characters)
const searchForPlainAddresses = (text: string) => {
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 a special reason why we're defining this function inside of getAddressesFromTrace? Is there a special reason not to extract it out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw searchForPlainAddresses function as implementation detail of getAddressesFromTrace, and searchForPlainAddresses was not required anywhere on its own.

};

// Helper function to search for serialized addresses (hex strings in calldata)
const searchForSerializedAddresses = (text: string) => {
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 a special reason why we're defining this function inside of getAddressesFromTrace? Is there a special reason not to extract it out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw searchForSerializedAddresses function as implementation detail of getAddressesFromTrace, and searchForSerializedAddresses was not required anywhere on its own.

* Schema for the `debug_traceTransaction` method in Viem RPC client.
* This schema defines the parameters and return type.
*
* @see https://viem.sh/docs/contract/tracing.html#tracetransaction
Copy link
Member

Choose a reason for hiding this comment

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

This link gives a 404 error

/**
* Options for the `debug_traceTransaction` RPC method.
**/
type DebugTraceTransactionOptions = CallTracerOptions;
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 a special reason why we create this type alias? Why define both CallTracerOptions and DebugTraceTransactionOptions? If so please ignore this comment. Others might have a similar question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are more tracers available, but we only need the CallTracer once. I'll simplify the type to express only what's needed.

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.

Enable label healing from reverse registry exclusively on mainnet

4 participants