You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For sure this situation is highly confusing and error prone, so I propose the following changes:
While ToBits/FromBits/ToCompressedBits/FromCompressedBits may still have some utility, ToBytes/FromBytes/FromBytesChecked are more or less duplications of CanonicalSerialize/CanonicalDeserialize traits so I would remove them. ToBytes and FromBytes can be directly replaced with CanonicalSerialize/CanonicalDeserialize; regarding FromBytesChecked we should modify deserialize and deserialize_uncompressed functions of CanonicalDeserialize trait to contextually perform validity checks (as defined by SemanticallyValid trait impl for a given struct, possibly in an optimized way enabling to perform early return in case of failures);
serde derive macros are very useful to get representation of structs in different formats (like JSON) so it may make sense to keep them; would be nice to find a way to integrate in them the compression capabilities of CanonicalSerialize/CanonicalDeserialize(WithFlags), possibly privatizing the latters and exposing as public APIs only the serde functions and macros (or even viceversa)
The text was updated successfully, but these errors were encountered:
Currently we have 3 ways of serializing/deserializing structs in ginger-lib:
For sure this situation is highly confusing and error prone, so I propose the following changes:
deserialize
anddeserialize_uncompressed
functions of CanonicalDeserialize trait to contextually perform validity checks (as defined bySemanticallyValid
trait impl for a given struct, possibly in an optimized way enabling to perform early return in case of failures);The text was updated successfully, but these errors were encountered: