Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Subgraph issues raised during age6 #127

Merged
merged 6 commits into from
Aug 21, 2023
Merged

Conversation

julien-devatom
Copy link
Contributor

@julien-devatom julien-devatom commented Aug 21, 2023

Description of change

Since the previous refactoring, the subgraph's epochs key id was badly generated.
The implications are the followings:

  • There is no root update done with a bad computation; the bug was introduced at the beginning of age6 (not updated yet).
  • As a consequence, 300 MORPHO was not distributed in the current main merkle tree of the users distribution of the age6 (not pushed onchain yet)
  • The API was predicting a wrong amount for the age6, but there is no consequences on the rate (market emission) displayed in the different dapps, which is independent on the rewards distribution.

The following steps are:

  • redeploy the subgraph (done)
  • rerun the users distribution test and remove the skipped tests
  • check the derivation per market & epochs (basically what the tests are doing)

Another issue was raised for this distribution:
If there is no tx during an epoch for a given market, the subgraph used the last epoch market rate to distribute rewards (which is not the case for the off-chain script. Until now, all market side was active during epochs, but the Compound COMP borrow side was not active during the age 3. So the off-chain script was distributing the correct rewards for the users of age 4, but the user has repaid COMP during age6, and the age five was skipped. So basically, the subgraph has badly distributed rewards to the user, considering a 0 rate for the age4. There is no incidence for the previous Merkle trees, but we have to loop over all epochs between the previous update and the current epoch in the subgraph.

This transaction is the one that is making issues (repay of COMP where Borrow side of cCOMP market has no activity for 3 epochs)

Pull-Request Checklist

  • Code is up-to-date with the main branch
  • yarn lint passes with this change
  • yarn test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions outlined in the conventional commit spec

@julien-devatom julien-devatom requested review from a team, ghivert, mlgarchery and oumar-fall and removed request for a team August 21, 2023 07:22
@julien-devatom julien-devatom self-assigned this Aug 21, 2023
@julien-devatom julien-devatom changed the title fix(subgraph): key id wrongly generated Subgraph issues raised during age6 Aug 21, 2023
src/utils/computeUsersDistributions.ts Show resolved Hide resolved
src/utils/computeUsersDistributions.ts Show resolved Hide resolved
subgraph/src/initializer.ts Show resolved Hide resolved
@julien-devatom julien-devatom merged commit 375d4c0 into main Aug 21, 2023
4 checks passed
@julien-devatom julien-devatom deleted the hotfix/fix-subgraph-key-id branch August 21, 2023 15:07
@github-actions
Copy link

🎉 This PR is included in version 4.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants