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: enable pagination and introduce new response data in queries #2398

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

insumity
Copy link
Contributor

Description

Closes: #2385, #2386

Testing

To verify pagination works as expected for list-consumer-chains, we locally modified contrib/local-testnet.sh so that it starts 150 consumer chains and then we opt in to some of those chains in order to launch them. Specifically, we launch 112 of those chains and then executed commands similar to the ones below to verify everything works as expected:

When counting all the chains:
./build/interchain-security-pd query provider list-consumer-chains --node http://127.0.0.1:29170 --count-total
we get:

...
pagination:
  next_key: AAAAAAAAAAMxMDA=
  total: "150" // total number of consumers chains

When counting all the Launched chains:
./build/interchain-security-pd query provider list-consumer-chains 3 --node http://127.0.0.1:29170 --count-total
we get:

...
pagination:
  next_key: AAAAAAAAAAMxMjY=
  total: "112" // total number of Launched chains

When counting all the Registered chains:
./build/interchain-security-pd query provider list-consumer-chains 1 --node http://127.0.0.1:29170 --count-total
we get:

...
pagination:
  next_key: null
  total: "38" // 150 - 112 = 38 total number of Registered chains (chains that failed to launch).

Additionally, queries like this
./build/interchain-security-pd query provider list-consumer-chains 1 --node http://127.0.0.1:29170 --limit 2 --page-key "AAAAAAAAAAI3OQ==" --reverse
work as expected by returning Registered chains in the reverse order.
Note that when page-key is used the total count is not computed (see FilteredPaginate).

Also the following query works as expected:
./build/interchain-security-pd query provider list-consumer-chains 3 --node http://127.0.0.1:29170 --limit 2 --page 4
by returning the 5th page (0-index on pages) of initialized chains with 2 chains in each page.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • Included the correct type prefix in the PR title
  • Added ! to the type prefix if the change is state-machine breaking
  • Confirmed this PR does not introduce changes requiring state migrations, OR migration code has been added to consumer and/or provider modules
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Followed the guidelines for building SDK modules
  • Included the necessary unit and integration tests
  • Added a changelog entry to CHANGELOG.md
  • Included comments for documenting Go code
  • Updated the relevant documentation or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed
  • If this PR is library API breaking, bump the go.mod version string of the repo, and follow through on a new major release

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! the type prefix if the change is state-machine breaking
  • confirmed this PR does not introduce changes requiring state migrations, OR confirmed migration code has been added to consumer and/or provider modules
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage

@github-actions github-actions bot added the C:x/provider Assigned automatically by the PR labeler label Nov 12, 2024
@insumity insumity marked this pull request as ready for review November 12, 2024 12:44
@insumity insumity requested a review from a team as a code owner November 12, 2024 12:44
Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

LGTM

@mpoke
Copy link
Contributor

mpoke commented Nov 13, 2024

@insumity Please update the docs and add a changelog entry.

@github-actions github-actions bot added the C:Docs Assigned automatically by the PR labeler label Nov 14, 2024
@insumity
Copy link
Contributor Author

@mpoke are we supposed to add .changelog entries for all PRs even so small ones like this one?
Not sure what you mean by updating the docs. I do not think we should add information on how to use pagination on the docs, this should be obvious.

@mpoke
Copy link
Contributor

mpoke commented Nov 18, 2024

are we supposed to add .changelog entries for all PRs even so small ones like this one?

Yes if they change something that users might be interested in.

Not sure what you mean by updating the docs. I do not think we should add information on how to use pagination on the docs, this should be obvious.

If the query doesn't change its behavior, then it's fine to not have the docs updated.

@insumity insumity added this pull request to the merge queue Nov 28, 2024
Merged via the queue into main with commit deea6fb Nov 28, 2024
17 of 18 checks passed
@insumity insumity deleted the insumity/fix-queries branch November 28, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Docs Assigned automatically by the PR labeler C:x/provider Assigned automatically by the PR labeler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: list-consumer-chains query does not support pagination
3 participants