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

Querying stakepools with limit=1000 only returns 100 results #333

Closed
2 of 6 tasks
rcmorano opened this issue Oct 8, 2020 · 1 comment · Fixed by #357
Closed
2 of 6 tasks

Querying stakepools with limit=1000 only returns 100 results #333

rcmorano opened this issue Oct 8, 2020 · 1 comment · Fixed by #357
Milestone

Comments

@rcmorano
Copy link
Contributor

rcmorano commented Oct 8, 2020

Environment

On my side (dandelion endpoint), I'm using these official docker images:

  • inputoutput/cardano-graphql:2.1.0
  • inputoutput/cardano-graphql-hasura:2.1.0
  • inputoutput/cardano-db-sync:5.0.1

Platform

  • Linux / Ubuntu
  • Linux / Other
  • macOS
  • Windows

Platform version: Ubuntu 20.04.1 LTS

Runtime

  • Node.js
  • Kubernetes, Docker

Runtime version:

/application/packages/server/dist # node -v
v12.15.0
/application/packages/server/dist # 

Kubernetes/Docker:

$ kubectl get nodes -o wide
NAME                                             STATUS   ROLES    AGE   VERSION   INTERNAL-IP     EXTERNAL-IP       OS-IMAGE                        KERNEL-VERSION     CONTAINER-RUNTIME
_REDACTED_  Ready    <none>   36d   v1.18.3   10.69.132.45    _REDACTED_       Ubuntu 20.04.1 LTS a25c031bef   5.4.0-42-generic   docker://19.3.12

Steps to reproduce the bug

1.- Query (using official example query) one of the provided endpoints with limit=1000 query variable:

# my instance
curl -s 'https://graphql-api.testnet.dandelion.link/' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://graphql-api.testnet.dandelion.link' --data-binary '{"query":"query allStakePoolFields (\n    $limit: Int!\n)  {\n    stakePools (limit: $limit, offset: 100) {\n        fixedCost\n        hash\n        margin\n        metadataHash\n        owners {\n            hash\n        }\n        pledge\n        relays {\n            ipv4\n            ipv6\n            dnsName\n            dnsSrvName\n        }\n        retirements {\n            announcedIn {\n                hash\n            }\n            inEffectFrom\n        }\n        rewardAddress\n        updatedIn {\n            hash\n        }\n        url\n    }\n}","variables":{"limit":1000}}' --compressed | jq '.data.stakePools | length'
# official explorer instance
curl -s 'https://explorer.cardano-testnet.iohkdev.io/graphql' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://explorer.cardano-testnet.iohkdev.io' --data-binary '{"query":"query allStakePoolFields (\n    $limit: Int!\n)  {\n    stakePools (limit: $limit, offset: 100) {\n        fixedCost\n        hash\n        margin\n        metadataHash\n        owners {\n            hash\n        }\n        pledge\n        relays {\n            ipv4\n            ipv6\n            dnsName\n            dnsSrvName\n        }\n        retirements {\n            announcedIn {\n                hash\n            }\n            inEffectFrom\n        }\n        rewardAddress\n        updatedIn {\n            hash\n        }\n        url\n    }\n}","variables":{"limit":1000}}' --compressed | jq '.data.stakePools | length'

2.- Query with limit=100 and offset=100 returns the rest of the stakepools confirming they are there and first query limit just doesn't work:

# my instance
curl -s 'https://graphql-api.testnet.dandelion.link/' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://graphql-api.testnet.dandelion.link' --data-binary '{"query":"query allStakePoolFields (\n    $limit: Int!\n)  {\n    stakePools (limit: $limit, offset: 100) {\n        fixedCost\n        hash\n        margin\n        metadataHash\n        owners {\n            hash\n        }\n        pledge\n        relays {\n            ipv4\n            ipv6\n            dnsName\n            dnsSrvName\n        }\n        retirements {\n            announcedIn {\n                hash\n            }\n            inEffectFrom\n        }\n        rewardAddress\n        updatedIn {\n            hash\n        }\n        url\n    }\n}","variables":{"limit":100, "offset":100}}' --compressed | jq '.data.stakePools | length'
# official explorer instance
curl -s 'https://explorer.cardano-testnet.iohkdev.io/graphql' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://explorer.cardano-testnet.iohkdev.io' --data-binary '{"query":"query allStakePoolFields (\n    $limit: Int!\n)  {\n    stakePools (limit: $limit, offset: 100) {\n        fixedCost\n        hash\n        margin\n        metadataHash\n        owners {\n            hash\n        }\n        pledge\n        relays {\n            ipv4\n            ipv6\n            dnsName\n            dnsSrvName\n        }\n        retirements {\n            announcedIn {\n                hash\n            }\n            inEffectFrom\n        }\n        rewardAddress\n        updatedIn {\n            hash\n        }\n        url\n    }\n}","variables":{"limit":100, "offset":100}}' --compressed | jq '.data.stakePools | length'

What is the expected behavior?

Paging works as expected and return more than 100 results.

@rhyslbw
Copy link
Contributor

rhyslbw commented Oct 8, 2020

Thanks for raising this again @rcmorano. The problem here is that we have a static limit in Hasura as a easy way to protect the API from abuse, but clearly introduces misleading results as you have documented. I will revisit this before the next release

@rhyslbw rhyslbw added this to the 3.0.0 milestone Oct 26, 2020
rhyslbw added a commit that referenced this issue Nov 4, 2020
Closes #333

BREAKING CHANGE: Omitting the limit in queries will now return 2500 records, rather than 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants