Skip to content

Refactor: ENS data gathering#295

Merged
brunomenezes merged 6 commits intomainfrom
refactor/ens-data-gathering
May 8, 2026
Merged

Refactor: ENS data gathering#295
brunomenezes merged 6 commits intomainfrom
refactor/ens-data-gathering

Conversation

@brunomenezes
Copy link
Copy Markdown
Collaborator

Summary

Code changes to improve how the application gathers information about the ENS. This change is targeted for the batch updates when the cron job runs.

Due to the available ENS GraphQL queries, the previous implementation used the resolvedAddress_in operator of the domains query and limited the number of addresses passed as parameters to the static query generated by the gql function. The ratio between cartesi users (i.e., those that are part of the staking ecosystem pool / staker / private-node) with a human-readable name was low, and the ratio of name changes through time to the resolved address was lower too (the assumption is that due to the cost of changing that would not increase significantly), which would make the post-processing reasonable and without loss of data as the query was returning every change but it has a limit.

Lately, a few addresses have joined the staking ecosystem with many changes through time (e.g. changing just a letter or two 🤔). That causes addresses to be omitted from the response because a few fill in all available spots, completely breaking the ratio assumption.

The solution was to replace the static query with a single definition domains(....params...) { fields } to dynamically generate an aliased-by-address query. Each aliased query is only asking about the latest valid name for each address added individually. Also, it made the response perceivable faster as the in operator is replaced with equality checks

  1. It only returns the latest name that resolves to a specific address.
  2. No chance of an address with a name being omitted if one is registered.
  3. No post-processing necessary (i.e. reducing to find the latest)

Also, I changed how the L1 resolver runs by adding a Promise Pool with controlled concurrency (default: 8) that can be increased or decreased by an environment variable. I added JS docs with reasoning behind, but TLDR; it is to avoid rate-limiting, timeouts, etc., from third-party services.

I also already added a changelog entry.

PS: I got a dump yesterday from the production DB with around 2181 rows to use locally; today it has already increased to 2219 in prod. So new addresses are joining the system.

…l to avoid node-rpc rate-limiting. Also, improve time log registering.

* The query now use an address as query alias and check only the latest valid resolved name.
* No post processing is necessary. It is sorted in the third-party service graphQL backend.
* Before it was using the where clause with the filter resolvedAddress_in. Which forces a post processing on application level and the performance in the third-party service to be slow.
* This change also eliminate the risk of addresses being out of the response due to some addresses having multiple changes through time.
* Add information for next explorer release v3.12.4
@brunomenezes brunomenezes requested review from tuler and vfusco May 8, 2026 13:39
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

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

Project Deployment Actions Updated (UTC)
staking Ready Ready Preview, Comment May 8, 2026 1:39pm

Request Review

@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​supercharge/​promise-pool@​3.3.010010010084100

View full report

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 25558778278

Coverage increased (+0.06%) to 66.401%

Details

  • Coverage increased (+0.06%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (29 of 31 lines covered, 93.55%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/services/server/ens/functions.ts 31 29 93.55%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 3797
Covered Lines: 2645
Line Coverage: 69.66%
Relevant Branches: 1980
Covered Branches: 1191
Branch Coverage: 60.15%
Branches in Coverage %: Yes
Coverage Strength: 29.86 hits per line

💛 - Coveralls

@brunomenezes brunomenezes merged commit 93f331f into main May 8, 2026
8 of 9 checks passed
@brunomenezes brunomenezes deleted the refactor/ens-data-gathering branch May 8, 2026 17:34
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