Hi!
I’m writing client library in Python and I can’t decode Celestia specific MsgPayForBlobs message. Other (cosmos) messages seems to decode just fine.
...
import src.celestia_proto.ibc.core.channel.v1.tx_pb2
import src.celestia_proto.ibc.lightclients.tendermint.v1.tendermint_pb2
import src.celestia_proto.cosmos.staking.v1beta1.tx_pb2
from src.celestia_proto.cosmos.base.tendermint.v1beta1 import query_pb2
from src.celestia_proto.cosmos.base.tendermint.v1beta1 import query_pb2_grpc
...
candidate_messages = [
cosmos_tx_tx_pb2.Tx,
celestia_blob_tx_pb2.MsgPayForBlobs,
]
for msg in candidate_messages:
try:
tx = msg()
tx.ParseFromString(tx_bytes)
logger.info(f"Decoded transaction with message type: {msg.DESCRIPTOR.name}")
break
except DecodeError:
logger.warning(f"Failed to decode transaction with message type: {msg.DESCRIPTOR.name}", exc_info=True)
continue
else:
raise DecodeError(f"Failed to decode transaction: {tx_bytes}")
# Output: google.protobuf.message.DecodeError: Failed to decode transaction: b'\n\x94\x03\n\xe5\x01\n\xe2\x01\n /celestia.blob.v1.MsgPayForBlobs\x12\xbd...'
Here are the latest version of package I’m building on.
I’ve tried to use /cosmos/tx/v1beta1/service.proto.Service:GetBlockWithTxs at first, which was suppose to return already decoded transactions, but it can’t handle celestia specific MsgPayForBlobs type.
So I’ve switched to cosmos.base.tendermint.v1beta1.query_pb2_grpc.ServiceStub:GetBlockByHeight
which returns response just fine, but with encoded transactions.
Then, in the code, I’m iterating through each tx in attempt to decode it.
Cosmos transactions are being decoded with no problem, but
/celestia.blob.v1.MsgPayForBlobs
raises an exception “google.protobuf.message.DecodeError”
I’m guessing that approach should be to decode MsgPayForBlobs transaction with other message type first and after that parse it with MsgPayForBlobs type?
I just don’t know which message type I should use to parse it with. “Any” type seems to not work as well for some reason.