SparseMerkleTreeVerifier
SafeCastOverflowedUintDowncast​
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value)
Value doesn't fit in a uint of bits
size.
This is based on OpenZeppelin's SafeCast library.
LeafIndexOutOfBounds​
error LeafIndexOutOfBounds(uint32 leafIndex, uint32 maxAllowedIndex)
Custom error for when the leaf index is out of bounds.
_verifyMerkleProof​
function _verifyMerkleProof(bytes32 _leafHash, bytes32[] _proof, uint32 _leafIndex, bytes32 _root) internal pure returns (bool proofIsValid)
Verify merkle proof
The depth of the tree is expected to be validated elsewhere beforehand.
Parameters​
Name | Type | Description |
---|---|---|
_leafHash | bytes32 | Leaf hash. |
_proof | bytes32[] | Sparse merkle tree proof. |
_leafIndex | uint32 | Index of the leaf. |
_root | bytes32 | Merkle root. |
Return Values​
Name | Type | Description |
---|---|---|
proofIsValid | bool | Returns if the proof is valid or not. |
safeCastToUint32​
function safeCastToUint32(uint256 _value) internal pure returns (uint32 castUint32)
Tries to safely cast to uint32.
This is based on OpenZeppelin's SafeCast library.
Parameters​
Name | Type | Description |
---|---|---|
_value | uint256 | The value being cast to uint32. |
Return Values​
Name | Type | Description |
---|---|---|
castUint32 | uint32 | Returns a uint32 safely cast. |
Contributions not accepted
These reference pages are automatically generated based on Linea's smart contracts. To ensure they accurately match the deployed smart contracts, we cannot accept any contributions that edit these pages.