RewardMerkleTreeVerifier
Title: RewardMerkleTreeVerifier
Solidity verifier for RewardMerkleTreeV2 compatible with Espresso’s reward system
- Arity: 2 (binary tree)
- Depth: 160 levels
- Key length: 20 bytes (160 bits) - Ethereum addresses
- EVM native keccak hash
- Double hashing of leaves as cheap domain separator
State Variables
TREE_DEPTH
uint256 public constant TREE_DEPTH = 160
Functions
_hashLeaf
function _hashLeaf(uint256 value) internal pure returns (bytes32);
_hashInternal
function _hashInternal(bytes32 left, bytes32 right) internal pure returns (bytes32 hash);
computeRoot
Compute reward commitment from a key-value pair and proof.
Designed to authenticate non-zero values for non-zero keys; caller must ensure neither key nor value is zero.
function computeRoot(address key, uint256 value, bytes32[TREE_DEPTH] memory proof)
internal
pure
returns (bytes32);
Parameters
| Name | Type | Description |
|---|---|---|
key | address | The key to prove - Ethereum address |
value | uint256 | The value to prove - lifetime earned rewards amount |
proof | bytes32[TREE_DEPTH] | The membership proof containing sibling hashes and numLeaves |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | The computed reward commitment |