proto: Switch 'compress' type on the wire from Optional[int] to bool
This patch aims to switch the compression parameter to the same data type that it had before the introduction of msgpack: boolean [1]. 1. It’s a smaller size on the wire [2]. 2. It simplifies NEO/go code (we don't need to re-implement pythons __bool__ in golang to cast Optional[int] into a boolean). 3. It doesn’t complicate NEO/py code: in fact it doesn’t even need a protocol change because __bool__ keeps the same. 4. It’s more coherent regarding the protocol: compression can really only be either True or False. A compression of any other value than 0 or 1 is meaningless. We now need to explicitly cast compression to bool and not forget this when adding new packets / code, but this is the same what happened to other packet arguments (last argument of AskStoreTransaction needs to be explicitly cast to list after switch to msgpack [3]). --- [1] https://lab.nexedi.com/nexedi/neoppod/-/blob/ee44a3b0/neo/lib/protocol.py#L1113 [2] See msgpack specification: https://github.com/msgpack/msgpack/blob/master/spec.md?plain=1#L166-L178 [3] nexedi/neoppod@9d0bf97a
Showing