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

Bug report: QueryValidatorsResponse ParseError in REST API #284

Closed
4 tasks done
Widlar opened this issue Sep 18, 2022 · 2 comments
Closed
4 tasks done

Bug report: QueryValidatorsResponse ParseError in REST API #284

Widlar opened this issue Sep 18, 2022 · 2 comments

Comments

@Widlar
Copy link

Widlar commented Sep 18, 2022

Prerequisites

Expected Behavior

Using the REST version of the API, I am trying to get a list of Mainnet network validators.

Current Behavior

The server response cannot be turned into the protobuf message QueryValidatorsResponse.
The error occurs in the consensus_pubkey field.
That being said, I tried compiling my proto files for newer versions of Cosmos SDK, but the problem persists.

To Reproduce

This error is shown by the following code:

from cosmpy.aerial.client import LedgerClient, NetworkConfig
cfg = NetworkConfig(
    chain_id='fetchhub-4',
    url='rest+https://rest-fetchhub.fetch.ai',
    fee_minimum_gas_price=0,
    fee_denomination="afet",
    staking_denomination="afet",
    faucet_url=None,
)

ledger_client = LedgerClient(cfg)
validators = ledger_client.query_validators()
print(validators) `

### Context

My OS: Windows 10, I'm using cosmpy==0.5.1 (compiling main from github) and Python 3.8.0.

### Failure Logs

File "C:\Users\Sergey\Anaconda3\envs\sergey\lib\site-packages\google\protobuf\json_format.py", line 648, in _ConvertAnyMessage
raise ParseError('{0} at {1}'.format(e, path))
google.protobuf.json_format.ParseError: Can not find message descriptor by type_url: /cosmos.crypto.ed25519.PubKey at QueryValidatorsResponse.validators[0].consensus_pubkey
`

@Widlar
Copy link
Author

Widlar commented Sep 20, 2022

I thought about it and was able to solve this problem by simply adding to the file:

cosmpy\aerial\client_init_.py

import:

from cosmpy.protos.cosmos.crypto.ed25519.keys_pb2 import PubKey

This import itself is not used directly, but is needed when turning proto messages into a dictionary. I will create Pull requests.

@solarw
Copy link
Contributor

solarw commented Oct 24, 2022

#294 fixed

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