diff --git a/contracts/utils/cryptography/MerkleProof.sol b/contracts/utils/cryptography/MerkleProof.sol index 4ba12ab70..5f0d63e01 100644 --- a/contracts/utils/cryptography/MerkleProof.sol +++ b/contracts/utils/cryptography/MerkleProof.sol @@ -6,16 +6,16 @@ pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * - * The proofs can be generated using the JavaScript library - * https://github.com/miguelmota/merkletreejs[merkletreejs]. - * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. - * - * See `test/utils/cryptography/MerkleProof.test.js` for some examples. + * The tree and the proofs can be generated using our + * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. + * You will find a quickstart guide in the readme. * * 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 + * against this attack out of the box. */ library MerkleProof { /** diff --git a/docs/modules/api/pages/utils.adoc b/docs/modules/api/pages/utils.adoc index aed3066f4..23a16d773 100644 --- a/docs/modules/api/pages/utils.adoc +++ b/docs/modules/api/pages/utils.adoc @@ -4193,16 +4193,16 @@ import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; These functions deal with verification of Merkle Tree proofs. -The proofs can be generated using the JavaScript library -https://github.com/miguelmota/merkletreejs[merkletreejs]. -Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. - -See `test/utils/cryptography/MerkleProof.test.js` for some examples. +The tree and the proofs can be generated using our +https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. +You will find a quickstart guide in the readme. 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 +against this attack out of the box. [.contract-index]