MerkleLib
Author: Illusory Systems Inc.
An incremental merkle tree modeled on the eth2 deposit contract.
State Variables
TREE_DEPTH
uint256 internal constant TREE_DEPTH = 32;
MAX_LEAVES
uint256 internal constant MAX_LEAVES = 2 ** TREE_DEPTH - 1;
Z_0
Z_i represent the hash values at different heights for a binary tree with leaf values equal to 0
.
(e.g. Z_1 is the keccak256 hash of (0x0, 0x0), Z_2 is the keccak256 hash of (Z_1, Z_1), etc...)
Z_0 is the bottom of the 33-layer tree, Z_32 is the top (i.e. root).
Used to shortcut calculation in root calculation methods below.
bytes32 internal constant Z_0 = hex"0000000000000000000000000000000000000000000000000000000000000000";