MerkleHasher Trait
TheMerkleHasher trait defines the interface for hash functions used in Merkle trees. Its main function, hash_node, computes the hash of a node from its children and (optionally) column values:
Implementation for BLAKE2s-256
TheMerkleHasher implementation for BLAKE2s-256 uses a wrapper struct Blake2sHash:
Blake2sMerkleHasher:
MerkleOps Trait
TheMerkleOps trait defines Merkle tree operations for a commitment scheme, parameterized by a MerkleHasher. Its main function, commit_on_layer, takes the previous layer’s hashes and the current layer’s column values to generate the hashes for the next layer:
Implementation for BLAKE2s-256
TheMerkleOps<Blake2sMerkleHasher> trait implementation for the CpuBackend is as follows: