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

Improved accuracy in state indexing: Addressing inaccuracies in TheGraph implementation #19

Closed
wants to merge 4 commits into from

Conversation

NandyBa
Copy link
Member

@NandyBa NandyBa commented Oct 1, 2023

Issue

According to the following illustrations, it's evident that the current implementation of TheGraph only considers deposit and borrow amounts, neglecting the borrow and deposit rates. This leads to inaccuracies in the representation of borrowed amounts, as detailed below.

Illustration of the Issue:

Case 1: Illustration of borrow balance issue

For instance, a 10.5k xDAI borrow balance is misrepresented as a 10k xDAI borrow on the community dashboard due to the omission of borrow rate by TheGraph’s current implementation.

Capture d’écran 2023-10-02 à 00 49 40

Screenshot 1: Screenshot of RMM (match on-chain data)

Capture d’écran 2023-10-02 à 00 48 43

Screenshot 2: Screenshot of Community Dashboard (un-match on-chain data)

Case 2: Illustration of deposit balance issue

For instance, a 54,1k xDAI is misrepresented as a 53k xDAI deposit on the community dashboard due to the omission of deposit rate by TheGraph’s current implementation.

Capture d’écran 2023-10-02 à 00 57 58

Screenshot 3: Screenshot of Gnosisscan (Gnosis chain explorer)
Show the 53k deposit and the current balance at 54,1k armmWXDAI (xDAI deposited on the RMM) link

Capture d’écran 2023-10-02 à 00 58 22

Screenshot 4: Screenshot of Community Dashboard (un-match on-chain data)

Here, the screenshot illustrates how the borrow amount is inaccurately depicted on the community dashboard due to the lack of consideration for borrow and deposit rates in TheGraph’s current indexing methodology.

Proposed Solution:

The feature/rmm-debt-from-smart-contract branch has been developed to address this oversight by incorporating borrow and deposit rates, ensuring the accurate representation of borrow amounts in state indexing.

Benefits of the Solution:

  • Increased Accuracy: By accounting for borrow and deposit rates, this solution provides a more true-to-life representation of state, facilitating smoother and more coherent user experiences.

Additional Advisory:

While the feature/rmm-debt-from-smart-contract branch serves to rectify the inaccuracies in state representation due to the current limitations of TheGraph implementation, a more sustainable solution would be to address this issue at its root – by updating the indexing code of TheGraph itself.

However, as of now, the codebase for TheGraph’s indexing code is private, and therefore inaccessible for external contributions or modifications. This restricts the possibility of submitting updates or enhancements directly to the source and necessitates interim solutions like the one provided in this branch to manage and mitigate the inaccuracies observed.

Call to Action:

I strongly advise that, once accessible, the TheGraph indexing code be updated to inherently account for borrow and deposit rates to ensure accuracy and reliability in state representations. This would eliminate the need for workaround solutions and provide a more streamlined and cohesive experience for the community.

In the interim, I recommend the integration of the feature/rmm-debt-from-smart-contract branch as a temporary measure to address the current inaccuracies.

Final Thoughts:

Until the accessibility status of TheGraph's indexing code changes, solutions like the one proposed in this branch are pivotal in maintaining accuracy and trust within the community. I look forward to a time when such inherent inaccuracies can be resolved at their source, fostering a more stable and reliable ecosystem for all users.

@NandyBa NandyBa mentioned this pull request Oct 1, 2023
@NandyBa NandyBa force-pushed the feature/rmm-debt-from-smart-contract branch 2 times, most recently from d553905 to 42bc4fa Compare October 1, 2023 23:59
@jycssu-com
Copy link
Collaborator

Unfortunately, even if the code for the subgraph becomes public, it will not be possible to take this change into account. Indeed, the data from the graph can only save the balances at the time of their indexing. As a result, the balances are only updated when the user interacts with the RMM, like make a deposit.

This issue is described and documented on the AAVE subgraphs Github. They offer a solution to calculate real values from data extracted from the graph, using their library @aave/math-utils. It would be interesting to see if this solution would be more durable to integrate because it would avoid unnecessary calls to an RPC

Source :

@NandyBa
Copy link
Member Author

NandyBa commented Oct 6, 2023

To implement it I need the REALT_GNOSIS_POOL_ADDRESS_PRIVIDER and the REALT_GNOSIS_UI_POOL_DATA_PROVIDER.
I already have the REALT_GNOSIS_POOL_ADDRESS_PRIVIDER but missing REALT_GNOSIS_UI_POOL_DATA_PROVIDER.

It's can be good to fork the bgd-labs/aave-address-book adding RealT Market or more easy link all important address on a doc readme.

@NandyBa NandyBa closed this Aug 18, 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.

2 participants