Zapix / mtpylon

Library to build backend with MTProto's protocol
MIT License
10 stars 0 forks source link

Fix Load/Dumps RPC Result Error #101

Closed Zapix closed 3 years ago

Zapix commented 3 years ago

RPC result with server salt couldn't been dumped:

Traceback (most recent call last):
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/message_handler/strategies/handle_rpc_query_message.py", line 62, in run_rpc_query
    await sender.send_encrypted_message(
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/message_sender.py", line 90, in send_encrypted_message
    await self._send_message(request, message)
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/message_sender.py", line 42, in _send_message
    message_bytes = await pack_message(
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/messages/mtproto_message.py", line 37, in pack_message
    return await pack_encrypted(schema, value)
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/messages/encrypted_message.py", line 196, in pack_message
    dumped_message = await dump_message(schema, message)
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/messages/encrypted_message.py", line 108, in dump_message
    data_bytes = await asyncio.to_thread(
  File "/Users/aleksandraibulatov/.pyenv/versions/3.9.0/lib/python3.9/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
  File "/Users/aleksandraibulatov/.pyenv/versions/3.9.0/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/messages/encrypted_message.py", line 79, in dump_data
    dumped_data = dump_by_service_schema(data)
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/service_schema/serialization/service_schema.py", line 20, in dump
    return dump_schema(
  File "/Users/aleksandraibulatov/projects/mtpylon/mtpylon/serialization/schema.py", line 197, in dump
    dumped = b''.join(
TypeError: sequence item 3: expected a bytes-like object, BadServerSalt found

Also probably we couldn't load/dump customer schema replies.

So we need: