Hi Ghadi, As Ian points out, there is a specification for canonicalization, and this spec is implemented at least in the C++ library. But, you have to invoke it explicitly.
The details of determinism is Cap'n Proto are completely different from Protobuf, due to differences in the encoding. Cap'n Proto does not serialize fields as key/value pairs -- the fields of a struct are always in the same order -- and it does not currently support maps. However, Cap'n Proto uses pointers, which means that whole objects can be ordered arbitrarily with respect to each other; protobuf has nothing like that. -Kenton On Thu, Jul 20, 2017 at 7:41 AM, Ghadi Shayban <[email protected]> wrote: > Does Cap'n Proto guarantee that generated payloads are byte-for-byte > identical when generated from different systems? > > A prerequisite for this is ensuring that key serialization order is > consistent when serializing map/dicts. There are other sources of > nondeterminism though. [1] My use case is storing payloads in a Merkle > tree, where each node is SHA2'd, and may be generated from different > languages. > > > [1] protobuf determinism https://stackoverflow.com/questions/31208725/is- > protocol-buffer-serialization-output-fully-deterministic > > -- > You received this message because you are subscribed to the Google Groups > "Cap'n Proto" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > Visit this group at https://groups.google.com/group/capnproto. > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/capnproto.
