-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(3450): complete contracts recommendation (#65)
* Feat/3450 Complete contracts recommendation V2 * fix: linting issue in CoordinatorConfigTest file --------- Co-authored-by: count-sum <[email protected]> Co-authored-by: thedarkjester <[email protected]>
- Loading branch information
1 parent
77f58eb
commit 961ac9b
Showing
15 changed files
with
114 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity 0.8.26; | ||
|
||
import { Utils } from "../../lib/Utils.sol"; | ||
|
||
/** | ||
* @title Library to verify sparse merkle proofs and to get the leaf hash value | ||
* @author ConsenSys Software Inc. | ||
* @custom:security-contact [email protected] | ||
*/ | ||
library SparseMerkleTreeVerifier { | ||
using Utils for *; | ||
|
||
/** | ||
* @dev Custom error for when the leaf index is out of bounds. | ||
*/ | ||
|
@@ -35,24 +39,11 @@ library SparseMerkleTreeVerifier { | |
|
||
for (uint256 height; height < _proof.length; ++height) { | ||
if (((_leafIndex >> height) & 1) == 1) { | ||
node = _efficientKeccak(_proof[height], node); | ||
node = Utils._efficientKeccak(_proof[height], node); | ||
} else { | ||
node = _efficientKeccak(node, _proof[height]); | ||
node = Utils._efficientKeccak(node, _proof[height]); | ||
} | ||
} | ||
return node == _root; | ||
} | ||
|
||
/** | ||
* @notice Performs a gas optimized keccak hash | ||
* @param _left Left value. | ||
* @param _right Right value. | ||
*/ | ||
function _efficientKeccak(bytes32 _left, bytes32 _right) internal pure returns (bytes32 value) { | ||
assembly { | ||
mstore(0x00, _left) | ||
mstore(0x20, _right) | ||
value := keccak256(0x00, 0x40) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters