Module tallytree::proof::util[][src]

Expand description

Helper functions for creating merkle tree proofs.

Enums

Set constraints on how branch is allowed to collapse the branches.

The direction traversed when parsing a merkle proof branch

Functions

Given two vote references and merkle tally proof of their inclusion, check if they are next to each other in the tree (neighbors). They do not need to share same parent.

Collapse merkle proof branches into a single hash and tally.

Given a path to a node, create a merkle proof.

Given the deepest proof branch, derive the above wrapper nodes.

Given a leaf hash and tally, calculate the hash of its wrapper node in a merkle tally tree.

Calculate a index to a node given traverse directions to it in the merkle tree.

Find the index of a vote in a merkle tree using the merkle proof for the vote. Use collapse_branches on the proof to get the directions parameter. leaf_branch is the zero-indexed branch in the merkle proof.

Check if vote reference is in proof

Get the tally and hash for parent node of two sibling nodes.