Module tezos_smart_rollup::dac

source ·
Expand description

Encoding of DAC payload as a Merkle tree with an arbitrary branching factor greater or equal to 2. The serialization process works as follows:

  • A large sequence of bytes, the payload, is split into several pages of fixed size, each of which is prefixed with a small sequence of bytes (also of fixed size), which is referred to as the preamble of the page. Pages obtained directly from the original payload are referred to as Contents pages. Contents pages constitute the leaves of the Merkle tree being built,

  • Each contents page (each of which is a sequence of bytes consisting of the preamble followed by the actual contents from the original payload) is then hashed. The size of each hash is fixed. The hashes are concatenated together, and the resulting sequence of bytes is split into pages of the same size of Hashes pages, each of which is prefixed with a preamble whose size is the same as in Contents pages. Hashes pages correspond to nodes of the Merkle tree being built, and the children of a hash page are the (either Payload or Hashes) pages whose hash appear into the former,

  • Hashes pages are hashed using the same process described above, leading to a smaller list of hashes pages. To guarantee that the list of hashes pages is actually smaller than the original list of pages being hashed, we require the size of pages to be large enough to contain at least two hashes.

Merkle tree encodings of DAC pages are versioned, to allow for multiple hashing schemes to be used.

Structs

Enums

Constants

Functions