SimpleSerialize
follows simple byte
conversion, making it effective and efficient for encoding and decodingSerialization
encodes the data into Bytes32
chunks for merkleization.serialize
and deserialize
methods fortype_serializable
,type_serializable
fieds,serializable
typesAn object that can be serialized is of type_serializable
serializable
can be thought of as a trait
Given a type T
, we write T : Serializable
if T
extends (or "inherits" or "is a") Serializable
.
T:Serialiable
should offer two functionalities:serialize<T> : T -> seq<bytes>
type T
deserialize<T> : seq<bytes> ~-> T
type T
when it is possible to deserialize a sequence of bytes in an object of type T
O1:T
and O2:T
where T <: Serializable
, the pair of functions (serialize<T>, deserialize<T>
) should be:deserialize<T>( serialize<T>(O1) ) = O1
serialize<T>(O1) = serialize<T>(O2)
implies that O1 = O2