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: Enhance Delegation Management with Caching and Reverse Mapping #1664

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ursulabauer
Copy link

I’ve implemented several important improvements to the delegation handling logic for better performance and efficiency:

  1. Delegation Caching:

    • I’ve added a caching mechanism to store delegation data for specific combinations of space, network, and snapshot. This significantly reduces the need for repeated requests to the subgraph, improving the overall performance when querying delegation data multiple times, especially for large sets of addresses.
  2. Reverse Delegation Mapping:

    • A new function getDelegationReverseData was introduced to ensure that we store both the delegator and delegate addresses in a reversed mapping. This improves the structure of delegation data and makes it more efficient to look up delegators for any given address.
  3. Optimized Data Retrieval:

    • The delegations are now retrieved more efficiently by filtering and mapping only the necessary data. This makes the logic cleaner and more optimized.
  4. Improved Data Return:

    • The getDelegationsData function has been refactored to provide a more structured and efficient way of returning delegation data, including the list of delegators for each address and a full list of all unique delegators.

These changes not only streamline the delegation process but also enhance scalability and performance by reducing unnecessary computations and improving data handling efficiency.

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