Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Query all pinned code ids #633

Merged
merged 1 commit into from
Oct 7, 2021
Merged

Query all pinned code ids #633

merged 1 commit into from
Oct 7, 2021

Conversation

alpe
Copy link
Contributor

@alpe alpe commented Oct 7, 2021

Resolves #596

Note: no legacy query support for this query

@alpe alpe requested a review from ethanfrey October 7, 2021 11:53
@codecov
Copy link

codecov bot commented Oct 7, 2021

Codecov Report

Merging #633 (b7a99e6) into master (5e88752) will decrease coverage by 0.30%.
The diff coverage is 29.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #633      +/-   ##
==========================================
- Coverage   60.51%   60.21%   -0.31%     
==========================================
  Files          48       48              
  Lines        5270     5313      +43     
==========================================
+ Hits         3189     3199      +10     
- Misses       1859     1889      +30     
- Partials      222      225       +3     
Impacted Files Coverage Δ
x/wasm/client/cli/query.go 0.00% <0.00%> (ø)
x/wasm/keeper/querier.go 61.73% <75.00%> (+1.17%) ⬆️
app/app.go 84.01% <100.00%> (ø)
x/wasm/keeper/keeper.go 86.97% <0.00%> (-0.34%) ⬇️

Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and great addition.

However, to fully close #596, I think you also need to add a pinned bool field to CodeInfoResponse. So we can see it when we look at a code by id.

Happy to merge this and then accept the minor addition as a new PR


prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.PinnedCodeIndexPrefix)
pageRes, err := query.FilteredPaginate(prefixStore, req.Pagination, func(key []byte, _ []byte, accumulate bool) (bool, error) {
if accumulate {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know of this accumulate flag. Nice use here

@ethanfrey ethanfrey merged commit 53a6476 into master Oct 7, 2021
@ethanfrey ethanfrey deleted the 596-query-pinned-contracts branch October 7, 2021 13:27
@alpe alpe mentioned this pull request Oct 8, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query pinned wasm codes
2 participants