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

fix: filter out expired ENS handles from results #150

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Dec 3, 2023

🧿 Current issues / What's wrong ?

When resolving ENS address from ENS's subgraph, we're returning all names associated to the address, without taking into account expiration date.

💊 Fixes / Solution

Fix #147

We should filter out expired domains from the results.

🚧 Changes

  • Filter out expired domains from ENS results.
  • Add relevant tests

🛠️ Tests

Test with the following query

curl -X POST http://localhost:3008/ -H "Content-Type: application/json" -d '{"method": "resolve_names", "params": ["49415.eth"] }'

This domain is expired (https://app.ens.domains/49415.eth)

Before fix, it returns

{"jsonrpc":"2.0","result":{"49415.eth":"0xD3F0DC8F0aE3b5cd6FCB4a7e5dBC3154554d17F3"},"id":null}

After fix, it returns

{"jsonrpc":"2.0","result":{},"id":null}

Copy link

codecov bot commented Dec 3, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (43df893) 63.49% compared to head (c3dcfdc) 63.58%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #150      +/-   ##
==========================================
+ Coverage   63.49%   63.58%   +0.09%     
==========================================
  Files          24       24              
  Lines        1145     1148       +3     
  Branches      132      132              
==========================================
+ Hits          727      730       +3     
  Misses        414      414              
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wa0x6e wa0x6e requested a review from ChaituVR December 3, 2023 17:25
domains(where: {name_in: ["${normalizedHandles.join('","')}"]}) {
domains(where: {
name_in: ["${normalizedHandles.join('","')}"],
expiryDate_gt: "${Math.floor(Date.now() / 1e3)}"}
Copy link
Contributor

Choose a reason for hiding this comment

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

expiryDate is null if name is a subdomain example 1.snapspace.eth should be fine.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add some tests for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mhhh... subdomain does not return any address, even without the expiryDate filter.

Should we just convert all subdomains to domains, and use the domain's resolved address ? (and map it back to the subdomain)

Copy link
Contributor

Choose a reason for hiding this comment

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

mmm getting complicated 😢 may be better to return the domain if doesn't have expiryDate for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue is that subdomain does not return any result, even on master.

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.

Fix: filter out expired ens domains
2 participants