ginger-lib
ginger-lib copied to clipboard
Uniform endianness of bits/bytes serialization
Currently:
- All the primitive/gadget functions dealing with serialization to/from bytes, will output LE bytes;
- All the primitive/gadget functions dealing with serialization to/from bits, will output BE bits.
This discrepancy is often cause of errors and confusion, especially because function names and comments are generic and don't specify that. We can:
- Assume everything to be in LE. This requires to modify all the primitive/gadget functions dealing with serialization to/from bits and also all the places, in all repositories, in which they are used. Let's also modify primitive/gadgets function taking Boolean or UInt8 gadget arrays, dropping any pre-existing assumption on their endianness and assuming them to always be in LE. This is a breaking change.
- Simply add to the primitive/gadget traits dealing with serialization to/from bits a "to_bits_le()" and "from_bits_le()" variation.