Expand description
Consensus-critical serialization.
This module contains four traits: ZcashSerialize
and ZcashDeserialize
,
analogs of the Serde Serialize
and Deserialize
traits but intended for
consensus-critical Zcash serialization formats, and WriteZcashExt
and
ReadZcashExt
, extension traits for io::Read
and io::Write
with utility functions
for reading and writing data (e.g., the Bitcoin variable-integer format).
Modules§
- arbitrary
- Arbitrary data generation for serialization proptests
- compact_
size 🔒 - Types and serialization for the Bitcoin
CompactSize
format. - constraint 🔒
- Serialization constraint helpers.
- date_
time 🔒 - DateTime types with specific serialization invariants.
- error 🔒
- Errors for Zcash consensus-critical serialization.
- read_
zcash 🔒 - serde_
helpers 🔒 - sha256d
- SHA256d, a.k.a., double SHA2, a.k.a., 2 SHA 2 Furious
- write_
zcash 🔒 - zcash_
deserialize 🔒 - Converting bytes into Zcash consensus-critical data structures.
- zcash_
serialize 🔒 - Converting Zcash consensus-critical data structures into bytes.
Structs§
- AtLeast
One - A
Vec<T>
wrapper that ensures there is at least oneT
in the vector. - Compact
Size64 - An arbitrary CompactSize-encoded field. Used for flags, arbitrary counts, and sizes that span multiple blocks.
- Compact
Size Message - A CompactSize-encoded field that is limited to
MAX_PROTOCOL_MESSAGE_LEN
. Used for sizes or counts of objects that are sent in network messages. - Date
Time32 - A date and time, represented by a 32-bit number of seconds since the UNIX epoch.
- Duration32
- An unsigned time duration, represented by a 32-bit number of seconds.
- Fake
Writer - A fake writer helper used to get object lengths without allocating RAM.
Enums§
- Serialization
Error - A serialization error.
Constants§
- MAX_
PROTOCOL_ MESSAGE_ LEN - The maximum length of a Zcash message, in bytes.
Traits§
- Read
Zcash Ext - Extends
Read
with methods for writing Zcash/Bitcoin types. - Trusted
Preallocate - Blind preallocation of a
Vec<T: TrustedPreallocate>
is based on a bounded length. This is in contrast to blind preallocation of a genericVec<T>
, which is a DOS vector. - Write
Zcash Ext - Extends
Write
with methods for writing Zcash/Bitcoin types. - Zcash
Deserialize - Consensus-critical deserialization for Zcash.
- Zcash
Deserialize Into - Helper for deserializing more succinctly via type inference
- Zcash
Serialize - Consensus-critical serialization for Zcash.
Functions§
- zcash_
deserialize_ bytes_ external_ count zcash_deserialize_external_count
, specialised for raw bytes.- zcash_
deserialize_ external_ count - Deserialize a
Vec
containingexternal_count
items. - zcash_
deserialize_ string_ external_ count zcash_deserialize_external_count
, specialised forString
. The external count is in bytes. (Not UTF-8 characters.)- zcash_
serialize_ bytes - Serialize a byte vector as a CompactSize number of items, then the items.
- zcash_
serialize_ bytes_ external_ count - Serialize a raw byte
Vec
without writing the number of items as a CompactSize. - zcash_
serialize_ empty_ list - Serialize an empty list of items, by writing a zero CompactSize length. (And no items.)
- zcash_
serialize_ external_ count - Serialize a typed
Vec
without writing the number of items as a CompactSize.