CommitmentTree
The CommitmentTree stores all commitments in a Merkle tree and manages root history.
Address: 0xe382a7C7a5CE3B9250D73aE6ab97931E5798e6F7
Constants
| Constant | Value | Meaning |
|---|---|---|
TREE_DEPTH | 20 | Max 1,048,576 commitments |
ROOT_HISTORY_SIZE | 100 | Last 100 roots are valid |
MIN_COMMITMENT_FEE | 0.001 ether | Required commit fee |
MAX_COMMITS_PER_BLOCK | 10 | Per-address rate limit |
Read Functions
leafCount
Returns the number of commitments in the tree.
function leafCount() external view returns (uint256);
currentRoot
Returns the current Merkle root.
function currentRoot() external view returns (bytes32);
isKnownRoot
Check if a root is in the last 100 roots.
function isKnownRoot(bytes32 root) external view returns (bool);
Events
event CommitmentAdded(bytes32 indexed commitment, uint256 indexed leafIndex, uint256 timestamp);
event RootUpdated(bytes32 indexed oldRoot, bytes32 indexed newRoot, uint256 leafCount);
event RootOperatorChanged(address indexed oldOperator, address indexed newOperator);
event FeesWithdrawn(address indexed operator, uint256 amount);
Root History
The tree maintains a rolling history of the last 100 roots. When generating proofs, you must use a root that is in this history.
Stale Roots
If your proof uses a root older than 100 updates ago, the reveal will fail with InvalidRoot. Generate proofs with recent roots.
Useful Commands
# Get current leaf count
cast call 0xe382a7C7a5CE3B9250D73aE6ab97931E5798e6F7 "leafCount()(uint256)" \
--rpc-url https://testnet-rpc.umbraline.com
# Get current root
cast call 0xe382a7C7a5CE3B9250D73aE6ab97931E5798e6F7 "currentRoot()(bytes32)" \
--rpc-url https://testnet-rpc.umbraline.com
# Check if root is valid
cast call 0xe382a7C7a5CE3B9250D73aE6ab97931E5798e6F7 "isKnownRoot(bytes32)(bool)" <root> \
--rpc-url https://testnet-rpc.umbraline.com