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

Feat: improve how ENS information is provided #175

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

brunomenezes
Copy link
Collaborator

Summary

These are changes to improve how we check if an Address has ENS information (e.g., name, avatar) to show rather than just Hex addresses. The currently deployed version is very wasteful. It constantly goes into the on-chain to resolve the address name and then looks for an avatar, causing other problems with rate-limiting and quota in extreme cases.

The changes are mainly in the backend. The UI gets data during the first load to be used as a cache and has logic to ask for information during a read miss. The UI has no loading status; it just asks for the information, making it available to the application and other users.

Summary:

  • I added a new Backend API to provide initial ENS data to cache
  • I added a new Backend API to provide ENS information about a single address. ENS checks are only done on addresses included in the Cartesi Staking ecosystem.
  • I Added a new protected backend API that can be called by a Cron service to deal with stale entries. We are using Vercel cron service here for that end. A configured TTL environment variable defines the staleness of an ENS entry.
  • I Added Drizzle to work with the libSQL database. Migrations are also included. We're using Turso for Preview and Production environments. We will use libSQL (a fork of SQLite) for local development.
  • In the front end, when a read miss happens, it is added to the local cache while a network call is fired; with that behaviour, consecutive network calls to the same address will not occur.
  • A vercel.json was added to configure the Cron schedule (currently once daily at midnight UTC). It will be visible in the dashboard once it hits the production environment.
  • As usual, I removed unused code and fix broken tests.
  • I also added new test cases to cover the new service logic.

Below, there is a diagram of how the system architecture works.

ENS data cache Architecture final

Copy link

vercel bot commented Dec 19, 2024

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

Name Status Preview Comments Updated (UTC)
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 6:39am

Copy link

Pull Request Test Coverage Report for Build 12407612649

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 77.511%

Totals Coverage Status
Change from base Build 12170213581: 0.0%
Covered Lines: 338
Relevant Lines: 401

💛 - Coveralls

@brunomenezes brunomenezes self-assigned this Dec 22, 2024
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.

1 participant