Skip to content

Commit

Permalink
rename initialize → setUp
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Feb 7, 2024
1 parent d4ced94 commit a3a813c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion contracts/mocks/MerkleTreeMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract MerkleTreeMock {
MerkleTree.TreeWithHistory private _tree;

constructor(uint256 _depth, uint256 _length, bytes32 _zero) {
_tree.initialize(_depth, _length, _zero);
_tree.setUp(_depth, _length, _zero);
}

function insert(bytes32 leaf) public returns (uint256) {
Expand Down
16 changes: 7 additions & 9 deletions contracts/utils/structs/MerkleTree.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import {Panic} from "../Panic.sol";
* - zero values (for "empty" leaves)
* - hash function
*
* WARNING:
* WARNING: By design, the tree include zero leaves. Customizing the "zero value" might be necessary to ensure that
* empty leaves being provably part of the tree is not a security issue.
*
* By design, the tree include zero leaves. Customizing the "zero value" might be necessary to ensure that empty leaves
* being provably part of the tree is not a security issue.
*
* _Available since v4.x._
* _Available since v5.1._
*/
library MerkleTree {
/**
Expand All @@ -35,7 +33,7 @@ library MerkleTree {
uint256 private constant MAX_DEPTH = 255;

/**
* @dev Merkle tree cannot be initialized because requested depth is to large.
* @dev Merkle tree cannot be set-up because requested depth is to large.
*/
error MerkleTreeInvalidDepth(uint256 depth, uint256 maxDepth);

Expand All @@ -60,8 +58,8 @@ library MerkleTree {
/**
* @dev Initialize using the default hash
*/
function initialize(TreeWithHistory storage self, uint256 depth, uint256 length, bytes32 zero) internal {
return initialize(self, depth, length, zero, MerkleProof.hashPair);
function setUp(TreeWithHistory storage self, uint256 depth, uint256 length, bytes32 zero) internal {
return setUp(self, depth, length, zero, MerkleProof.hashPair);
}

/**
Expand All @@ -71,7 +69,7 @@ library MerkleTree {
* - Hashing function for a pair of leaves is fnHash
* and keep a root history of length `length` when leaves are inserted.
*/
function initialize(
function setUp(
TreeWithHistory storage self,
uint256 depth,
uint256 length,
Expand Down

0 comments on commit a3a813c

Please sign in to comment.