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

[Question]: Endpoint to list consumer chains returns wrong pagination #2305

Open
1 task done
freak12techno opened this issue Sep 21, 2024 · 2 comments
Open
1 task done
Labels
more-info-needed Further information is requested

Comments

@freak12techno
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

https://rest.provider-sentry-01.rs-testnet.polypore.xyz/interchain_security/ccv/provider/consumer_chains/2

Returns empty chains, but pagination.total === '26'

Interchain Security Version

github.com/cosmos/interchain-security/[email protected]

How to reproduce?

Just query the endpoint above, it's the node on a provider chain of ICS testnet.

@freak12techno freak12techno added status: waiting-triage This issue/PR has not yet been triaged by the team. type: bug Issues that need priority attention -- something isn't working labels Sep 21, 2024
@MSalopek MSalopek removed the type: bug Issues that need priority attention -- something isn't working label Oct 3, 2024
@MSalopek
Copy link
Contributor

MSalopek commented Oct 3, 2024

Thanks for opening an issue.

I don't think this is a bug since you're not providing any pagination instructions (limit).

The system is returning the total number of entries so you are able to compare how many records are there in total.

This is the intention:
If you query without a pagination limit and your chain list is empty, you interpret it as follows: "there are 0 chains matching my query out of the total amount of chains (26)".

Notice in sdk validators that the pagination key is removed if you set the limit:

gaiad q staking validators --status BOND_STATUS_BONDED --page-limit 1 --node "https://rpc.cosmos.nodestake.top:443" -o json | jq .
{
  "validators": [
    {
      ...
    }
  ],
  "pagination": {
    "next_key": "FAd6UWZF69GY8QE0QmIbT1fNeIlg"
  }
}
➜

It's available if you don't set the limit:

gaiad q staking validators --status BOND_STATUS_BONDED --node "https://rpc.cosmos.nodestake.top:443" -o json | jq .
{
  "validators": [
    {...},
    {...},
  ],
  "pagination": {
    "next_key": "FIhpiwd4KhTD5FQEDQe93WgZjHgP",
    "total": "200"
  }
}

Do you have different needs from this query that we're currently not handling? Could you tell us more about your usecase?

Also, there was a bug - it was fixed here: #2313

@MSalopek MSalopek added more-info-needed Further information is requested and removed status: waiting-triage This issue/PR has not yet been triaged by the team. labels Oct 3, 2024
@MSalopek MSalopek changed the title [Bug]: Endpoint to list consumer chains returns wrong pagination [Question]: Endpoint to list consumer chains returns wrong pagination Oct 3, 2024
@freak12techno
Copy link
Contributor Author

freak12techno commented Oct 3, 2024

Problem is that the pagination total returns the total of all consumer chains, not only consumer chains with the phase I queried for. For example when I query consumer chains with phase CONSUMER_PHASE_UNSPECIFIED (like this https://rest.provider-sentry-01.rs-testnet.polypore.xyz/interchain_security/ccv/provider/consumer_chains/0) it gives me pagination.total == 28, which is ok, as there are 28 entries in the response. But if I query, for example, only chains that are CONSUMER_PHASE_LAUNCHED (https://rest.provider-sentry-01.rs-testnet.polypore.xyz/interchain_security/ccv/provider/consumer_chains/3), it returns currently 1 entry (which is correct), but pagination.total is still 28, not 1, as it I think should be (as there's only 1 chain with phase CONSUMER_PHASE_LAUNCHED, not 28).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-info-needed Further information is requested
Projects
Status: 🤔 F1: Investigate
Development

No branches or pull requests

2 participants