|
@@ -13,8 +13,8 @@ pragma solidity ^0.8.20;
|
|
|
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
|
|
|
* hashing, or use a hash function other than keccak256 for hashing leaves.
|
|
|
* This is because the concatenation of a sorted pair of internal nodes in
|
|
|
- * the merkle tree could be reinterpreted as a leaf value.
|
|
|
- * OpenZeppelin's JavaScript library generates merkle trees that are safe
|
|
|
+ * the Merkle tree could be reinterpreted as a leaf value.
|
|
|
+ * OpenZeppelin's JavaScript library generates Merkle trees that are safe
|
|
|
* against this attack out of the box.
|
|
|
*/
|
|
|
library MerkleProof {
|
|
@@ -66,10 +66,10 @@ library MerkleProof {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
|
|
|
+ * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
|
|
|
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
|
|
|
*
|
|
|
- * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
|
|
|
+ * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
|
|
|
*/
|
|
|
function multiProofVerify(
|
|
|
bytes32[] memory proof,
|
|
@@ -83,7 +83,7 @@ library MerkleProof {
|
|
|
/**
|
|
|
* @dev Calldata version of {multiProofVerify}
|
|
|
*
|
|
|
- * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
|
|
|
+ * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
|
|
|
*/
|
|
|
function multiProofVerifyCalldata(
|
|
|
bytes32[] calldata proof,
|
|
@@ -100,7 +100,7 @@ library MerkleProof {
|
|
|
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
|
|
|
* respectively.
|
|
|
*
|
|
|
- * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
|
|
|
+ * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
|
|
|
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
|
|
|
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
|
|
|
*/
|
|
@@ -112,7 +112,7 @@ library MerkleProof {
|
|
|
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
|
|
|
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
|
|
|
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
|
|
|
- // the merkle tree.
|
|
|
+ // the Merkle tree.
|
|
|
uint256 leavesLen = leaves.length;
|
|
|
uint256 proofLen = proof.length;
|
|
|
uint256 totalHashes = proofFlags.length;
|
|
@@ -158,7 +158,7 @@ library MerkleProof {
|
|
|
/**
|
|
|
* @dev Calldata version of {processMultiProof}.
|
|
|
*
|
|
|
- * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
|
|
|
+ * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
|
|
|
*/
|
|
|
function processMultiProofCalldata(
|
|
|
bytes32[] calldata proof,
|
|
@@ -168,7 +168,7 @@ library MerkleProof {
|
|
|
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
|
|
|
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
|
|
|
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
|
|
|
- // the merkle tree.
|
|
|
+ // the Merkle tree.
|
|
|
uint256 leavesLen = leaves.length;
|
|
|
uint256 proofLen = proof.length;
|
|
|
uint256 totalHashes = proofFlags.length;
|