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 /cosmos/bank/v1beta1/supply for a past block height returns a panic #13767

Closed
andynog opened this issue Nov 4, 2022 · 3 comments
Closed

Comments

@andynog
Copy link
Contributor

andynog commented Nov 4, 2022

Summary of Bug

Trying to retrieve the bank supply via a REST endpoint for a previous block height and the endpoint returns a panic

Version

 "node_info": {
       .....
        "network": "cosmoshub-4",
        "version": "v0.34.21",
        .....
        }
    },
    "application_version": {
        "name": "gaia",
        "server_name": "gaiad",
        "version": "v7.1.0",
        "commit": "5db8fcc9a229730f5115bed82d0f85b6db7184b4",

Steps to Reproduce

Query the /cosmos/bank/v1beta1/supply endpoint for a past height (12702000), the server latest height at the time of the query is (12569986)

curl --location --request GET 'https://cosmos-lcd.quickapi.com:443/cosmos/bank/v1beta1/supply?pagination.limit=10000' \
--header 'x-cosmos-block-height: 12702000'

This returns an error:

{
    "code": 2,
    "message": "runtime error: invalid memory address or nil pointer dereference: panic",
    "details": []
}

I'm assuming that the server is pruned and that specified height in the --header is not available anymore. If I query for a past height that is very close to the latest height then it works.

Maybe a better error message could be returned if that's the case ? Maybe even with a field saying what is the earliest available height that could be queried for?

Thanks!

@facundomedica
Copy link
Member

facundomedica commented Nov 4, 2022

Can you confirm that you got 12702000 and 12569986 mixed up? What version of the SDK are you running? (nvm just saw it)

@facundomedica
Copy link
Member

This was a bug that is already fixed on the main branch: #13355

@andynog
Copy link
Contributor Author

andynog commented Nov 4, 2022

Can you confirm that you got 12702000 and 12569986 mixed up? What version of the SDK are you running? (nvm just saw it)

Yes, sorry, I've had a typo the latest height was greater than the height I've specified.

I've noticed the issue was closed and seems the bug has been fixed, I'll see if there's a way to test this later in a new release, have to figure out first which release this has been included

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

No branches or pull requests

2 participants