The core serialization logic is now in zebra-chain and consists of two pairs of traits: These are analogues of the Serde `Serialize` and `Deserialize` traits, but explicitly intended for consensus-critical serialization formats. Thus some struct `Foo` may have derived `Serialize` and `Deserialize` implementations for (internal) use with Serde, and explicitly-written `ZcashSerialize` and `ZcashDeserialize` implementations for use in consensus-critical contexts. The consensus-critical implementations provide `zcash`-prefixed `zcash_serialize` and `zcash_deserialize` methods to make it clear in client contexts that the serialization is consensus-critical. These are utility traits, analogous to the `ReadBytesExt` and `WriteBytesExt` traits provided by `byteorder`. A generic implementation is provided for any `io::Read` or `io::Write`, so that bringing the traits into scope adds additional Zcash-specific traits to generic readers and writers -- for instance, writing a `u64` in the Bitcoin "CompactSize" format. |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||