consensus-shipyard/mir

Serializing empty slices in protobufs

matejpavlovic opened this issue · 0 comments

When serializing and deserializing a protobuf-generated struct using, respectively, proto.Marshal and proto.Unmarshal, empty arrays contained in the struct turn into nil values. This creates inconsistencies between objects that nodes hold locally and the very same objects transmitted to other nodes over the network, as in the former case the serialize-deserialize cycle does not occur. This, in turn, leads to inconsistent state at different nodes.

A proper solution that is not just a workaround is probably only getting rid of protocol buffers altogether.