Support more efficient merkle proofs through calldata (#3200)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com> Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -13,23 +13,35 @@ contract MerkleProofWrapper {
|
||||
return MerkleProof.verify(proof, root, leaf);
|
||||
}
|
||||
|
||||
function verifyCalldata(
|
||||
bytes32[] calldata proof,
|
||||
bytes32 root,
|
||||
bytes32 leaf
|
||||
) public pure returns (bool) {
|
||||
return MerkleProof.verifyCalldata(proof, root, leaf);
|
||||
}
|
||||
|
||||
function processProof(bytes32[] memory proof, bytes32 leaf) public pure returns (bytes32) {
|
||||
return MerkleProof.processProof(proof, leaf);
|
||||
}
|
||||
|
||||
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) public pure returns (bytes32) {
|
||||
return MerkleProof.processProofCalldata(proof, leaf);
|
||||
}
|
||||
|
||||
function multiProofVerify(
|
||||
bytes32 root,
|
||||
bytes32[] memory leafs,
|
||||
bytes32[] memory proofs,
|
||||
bool[] memory proofFlag
|
||||
bytes32[] calldata leafs,
|
||||
bytes32[] calldata proofs,
|
||||
bool[] calldata proofFlag
|
||||
) public pure returns (bool) {
|
||||
return MerkleProof.multiProofVerify(root, leafs, proofs, proofFlag);
|
||||
}
|
||||
|
||||
function processMultiProof(
|
||||
bytes32[] memory leafs,
|
||||
bytes32[] memory proofs,
|
||||
bool[] memory proofFlag
|
||||
bytes32[] calldata leafs,
|
||||
bytes32[] calldata proofs,
|
||||
bool[] calldata proofFlag
|
||||
) public pure returns (bytes32) {
|
||||
return MerkleProof.processMultiProof(leafs, proofs, proofFlag);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user