Open gatoWololo opened 4 months ago
@krs85 Since you asked here is an example of a type AuxinfoPrivate which does not implement serialize. Instead there are method into_bytes and try_from_bytes
Thank you for pointing me to this example. I agree that just implementing serialize is the right way to do it, having these "workarounds" is more confusing than helpful.
We currently have some "output" types which are the outputs of running our sub-protocols, e.g.
keygen::Output
andauxinfo::Output
. These types do no currently implement theSerialize
andDeserialize
traits. It is still possible to serialize/deserialize these types.For example:
This
keygen::Output
type does not implementSerialize
, but the sub-typeKeySharePublic
does. MeanwhileKeySharePrivate
can be serialized by calling theinto_bytes
method.While this works, it is quite painful to work with these types. It would be a lot more convenient to implement serialize/deserialize for these types.
It seems not implementing serialize/deserialize was done on purpose for this type. I believe the argument is: Developers should explicitly call the serialize method (into_bytes) as a type of misuse resistance. I don't believe this buys us much though...