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

Create an index for _total_ values and other global indexes #1336

Open
4 tasks
robert-zaremba opened this issue Sep 6, 2022 · 3 comments
Open
4 tasks

Create an index for _total_ values and other global indexes #1336

robert-zaremba opened this issue Sep 6, 2022 · 3 comments
Assignees
Milestone

Comments

@robert-zaremba
Copy link
Member

robert-zaremba commented Sep 6, 2022

Summary

In #1329 , #1330 and #1331 we added new indexes. Recomputing them all the time is time consuming. Instead we should store them as as an index value on chain.

Essentially, we should start by creating an index for:

  • GetAllTotalCollateral
  • ...
    and then see what else we can index.

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@robert-zaremba robert-zaremba added this to the v4 milestone Sep 6, 2022
@robert-zaremba robert-zaremba changed the title Create an index for MaxCollateralShare and other global indexes Create an index for _total_ values and other global indexes Sep 6, 2022
@gsk967
Copy link
Collaborator

gsk967 commented Oct 16, 2022

GetAllTotalCollateral is retrieving the amount of denom from leverage module account balance.
the module account balance will update the real time , how we can go create index for specific denom with module account

@toteki
Copy link
Member

toteki commented Oct 17, 2022

Most of these are already calculated fairly efficiently - and introducing an index or a cache would invite potential edge cases due to rounding and more complex bugs / failure states if they were to ever fall out of sync with the real time value.

Unless we are starting with a specific proposal to improve one of them, we can probably close the issue.

@robert-zaremba
Copy link
Member Author

total values are often recomputed, sometimes few times (eg total collateral) when processing same message.

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

No branches or pull requests

3 participants