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 filtered paginate in the incentives module #1218

Closed
xBalbinus opened this issue Apr 7, 2022 · 6 comments · Fixed by #1759
Closed

Fix filtered paginate in the incentives module #1218

xBalbinus opened this issue Apr 7, 2022 · 6 comments · Fixed by #1759
Labels
C:gRPC Issues and PRs related to the gRPC service and HTTP gateway. C:x/incentives

Comments

@xBalbinus
Copy link
Contributor

FilteredPaginate does pagination of all the results in the PrefixStore based on the provided PageRequest.

We need to make the incentives module follow this

https://github.com/cosmos/cosmos-sdk/blob/master/types/query/filtered_pagination.go

Please feel free to add more details @ValarDragon

@xBalbinus xBalbinus moved this to 🔍 Needs Review in Osmosis Chain Development Apr 7, 2022
@alexanderbez alexanderbez added the C:gRPC Issues and PRs related to the gRPC service and HTTP gateway. label Apr 7, 2022
@hieuvubk
Copy link
Contributor

hieuvubk commented Jun 1, 2022

@xBalbinus
did this issue close? I see incentives grpc_query already followed filter logic above

@xBalbinus
Copy link
Contributor Author

I don't think this issue was officially closed, if it already follows then closing is no problem

Repository owner moved this from Needs Review 🔍 to Done ✅ in Osmosis Chain Development Jun 1, 2022
@ValarDragon ValarDragon reopened this Jun 1, 2022
Repository owner moved this from Done ✅ to In Progress🏃 in Osmosis Chain Development Jun 1, 2022
@hieuvubk
Copy link
Contributor

hieuvubk commented Jun 7, 2022

@ValarDragon can u add more details?

@ValarDragon
Copy link
Member

Theres a few queries in the incentives modules that just do filtered paginate incorrectly, https://github.com/osmosis-labs/osmosis/blob/main/x/incentives/keeper/grpc_query.go#L124-L132

Its getting all active gauges and filtering, inside the loop.

That loop should instead be reading off the key / value, and seeing if its valid. Rather than reading all of it.

But to be honest, most of the filtered paginate calls in that file are suspicious / wrong. (E.g. a lot that don't do any filtering!)

@hieuvubk
Copy link
Contributor

@xBalbinus @ValarDragon could u take a look at this pr. I think it can close this issue. Thank u so much!

@xBalbinus
Copy link
Contributor Author

A kind reminder that Bez commented something you may want to change, otherwise I defer to @ValarDragon’s judgement because I have less context

Repository owner moved this from In Progress🏃 to Done ✅ in Osmosis Chain Development Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:gRPC Issues and PRs related to the gRPC service and HTTP gateway. C:x/incentives
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants