fetchai/cosmpy

Bug report: validator query fails when using REST endpoint

Opened this issue · 0 comments

Prerequisites

Expected Behavior

ledger.query_validators() should succeed.

Current Behavior

ledger.query_validators() fails with the error logs below.

To Reproduce

>>> from cosmpy.aerial.client import LedgerClient, NetworkConfig
>>> 
>>> mainnet = NetworkConfig.fetchai_mainnet()
>>> mainnet.url = 'rest+https://rest-fetchhub.fetch.ai:443'
>>> ledger = LedgerClient(mainnet)
>>> ledger.query_validators()

Context

Ubuntu 22.04, Python 3.10, CosmPy 5.1

Failure Logs

Traceback (most recent call last):
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 399, in _CreateMessageFromTypeUrl
    message_descriptor = pool.FindMessageTypeByName(type_name)
KeyError: "Couldn't find message cosmos.crypto.ed25519.PubKey"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 646, in _ConvertAnyMessage
    sub_message = _CreateMessageFromTypeUrl(type_url, self.descriptor_pool)
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 401, in _CreateMessageFromTypeUrl
    raise TypeError(
TypeError: Can not find message descriptor by type_url: /cosmos.crypto.ed25519.PubKey

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 615, in _ConvertFieldValuePair
    self.ConvertMessage(value, sub_message, '{0}.{1}'.format(path, name))
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 500, in ConvertMessage
    methodcaller(_WKTJSONMETHODS[full_name][1], value, message, path)(self)
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 597, in _ConvertFieldValuePair
    self.ConvertMessage(item, sub_message,
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 502, in ConvertMessage
    self._ConvertFieldValuePair(value, message, path)
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 627, in _ConvertFieldValuePair
    raise ParseError('Failed to parse {0} field: {1}.'.format(name, e))
google.protobuf.json_format.ParseError: Failed to parse consensus_pubkey field: Can not find message descriptor by type_url: /cosmos.crypto.ed25519.PubKey at QueryValidatorsResponse.validators[0].consensus_pubkey.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/cosmpy/aerial/client/__init__.py", line 267, in query_validators
    resp = self.staking.Validators(req)
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/cosmpy/staking/rest_client.py", line 79, in Validators
    return Parse(json_response, QueryValidatorsResponse())
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 436, in Parse
    return ParseDict(js, message, ignore_unknown_fields, descriptor_pool,
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 461, in ParseDict
    parser.ConvertMessage(js_dict, message, '')
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 502, in ConvertMessage
    self._ConvertFieldValuePair(value, message, path)
  File "/home/james/.cache/pypoetry/virtualenvs/datastore-4T6x-qBl-py3.10/lib/python3.10/site-packages/google/protobuf/json_format.py", line 627, in _ConvertFieldValuePair
    raise ParseError('Failed to parse {0} field: {1}.'.format(name, e))
google.protobuf.json_format.ParseError: Failed to parse validators field: Failed to parse consensus_pubkey field: Can not find message descriptor by type_url: /cosmos.crypto.ed25519.PubKey at QueryValidatorsResponse.validators[0].consensus_pubkey..