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

[SQS-Ingest] sortAndStorePools: instead of resorting all pools every block, we should put the updated pools in the correct position #176

Open
p0mvn opened this issue Apr 16, 2024 · 0 comments

Comments

@p0mvn
Copy link
Member

p0mvn commented Apr 16, 2024

Background

Currently, we resort pools every block which is redundant since after the first block, the pools that are pushed to SQS are only the ones that are updated.

Ref: https://github.com/osmosis-labs/sqs/pull/175/files#r1566536227

Instead, we should:

  • Sort only the updated k pools
  • In O(n) where n is the total number of pools, place the k updated pools into the right position based on the pool rank

DoD

  • Pool sorting optimized where we avoid resoring all pools in O(nlogn). Instead, sort the k updated pools and place these into the right positions based on pool rating
    • Note that it might be possible that we will have to start persisting pool ratings since they currently aren't
  • Tested
@p0mvn p0mvn added the Onboarding-Calvin label Apr 17, 2024 — with Linear
@p0mvn p0mvn changed the title sortAndStorePools: instead of resorting all pools every block, we should put the updated pools in the correct position [SQS-Ingest] sortAndStorePools: instead of resorting all pools every block, we should put the updated pools in the correct position Apr 17, 2024
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

1 participant