diff --git a/contracts/interfaces/IERC1363Receiver.sol b/contracts/interfaces/IERC1363Receiver.sol index ebcffe24e..279178849 100644 --- a/contracts/interfaces/IERC1363Receiver.sol +++ b/contracts/interfaces/IERC1363Receiver.sol @@ -18,7 +18,7 @@ interface IERC1363Receiver { * (i.e. 0x88a7ca5c, or its own function selector). * * @param operator The address which called `transferAndCall` or `transferFromAndCall` function. - * @param from The address which are tokens transferred from. + * @param from The address which the tokens are transferred from. * @param value The amount of tokens transferred. * @param data Additional data with no specified format. * @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` if transfer is allowed unless throwing. diff --git a/contracts/token/ERC1155/utils/ERC1155Utils.sol b/contracts/token/ERC1155/utils/ERC1155Utils.sol index a07539bd0..1439330e4 100644 --- a/contracts/token/ERC1155/utils/ERC1155Utils.sol +++ b/contracts/token/ERC1155/utils/ERC1155Utils.sol @@ -15,7 +15,7 @@ library ERC1155Utils { * @dev Performs an acceptance check for the provided `operator` by calling {IERC1155-onERC1155Received} * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). * - * The acceptance call is not executed and treated as a no-op if the target address is doesn't contain code (i.e. an EOA). + * The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA). * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept * the transfer. */ @@ -50,7 +50,7 @@ library ERC1155Utils { * @dev Performs a batch acceptance check for the provided `operator` by calling {IERC1155-onERC1155BatchReceived} * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). * - * The acceptance call is not executed and treated as a no-op if the target address is doesn't contain code (i.e. an EOA). + * The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA). * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept * the transfer. */ diff --git a/contracts/utils/cryptography/MerkleProof.sol b/contracts/utils/cryptography/MerkleProof.sol index a2a21adb2..a86580135 100644 --- a/contracts/utils/cryptography/MerkleProof.sol +++ b/contracts/utils/cryptography/MerkleProof.sol @@ -50,7 +50,7 @@ library MerkleProof { * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs - * of leafs & pre-images are assumed to be sorted. + * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in memory with the default hashing function. */ @@ -83,7 +83,7 @@ library MerkleProof { * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs - * of leafs & pre-images are assumed to be sorted. + * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in memory with a custom hashing function. */ @@ -115,7 +115,7 @@ library MerkleProof { * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs - * of leafs & pre-images are assumed to be sorted. + * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in calldata with the default hashing function. */ @@ -148,7 +148,7 @@ library MerkleProof { * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs - * of leafs & pre-images are assumed to be sorted. + * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in calldata with a custom hashing function. */ diff --git a/contracts/utils/cryptography/RSA.sol b/contracts/utils/cryptography/RSA.sol index 105853aae..1b5860c3b 100644 --- a/contracts/utils/cryptography/RSA.sol +++ b/contracts/utils/cryptography/RSA.sol @@ -8,7 +8,7 @@ import {Math} from "../math/Math.sol"; * * This library supports PKCS#1 v1.5 padding to avoid malleability via chosen plaintext attacks in practical implementations. * The padding follows the EMSA-PKCS1-v1_5-ENCODE encoding definition as per section 9.2 of the RFC. This padding makes - * RSA semanticaly secure for signing messages. + * RSA semantically secure for signing messages. * * Inspired by https://github.com/adria0/SolRsaVerify[AdriĆ  Massanet's work] */ @@ -26,7 +26,7 @@ library RSA { } /** - * @dev Verifies a PKCSv1.5 signature given a digest according the verification + * @dev Verifies a PKCSv1.5 signature given a digest according to the verification * method described in https://datatracker.ietf.org/doc/html/rfc8017#section-8.2.2[section 8.2.2 of RFC8017]. * * IMPORTANT: Although this function allows for it, using n of length 1024 bits is considered unsafe. @@ -136,7 +136,7 @@ library RSA { /// @dev Reads a bytes32 from a bytes array without bounds checking. function _unsafeReadBytes32(bytes memory array, uint256 offset) private pure returns (bytes32 result) { - // Memory safetiness is guaranteed as long as the provided `array` is a Solidity-allocated bytes array + // Memory safeness is guaranteed as long as the provided `array` is a Solidity-allocated bytes array // and `offset` is within bounds. This is the case for all calls to this private function from {pkcs1}. assembly ("memory-safe") { result := mload(add(add(array, 0x20), offset)) diff --git a/contracts/utils/structs/CircularBuffer.sol b/contracts/utils/structs/CircularBuffer.sol index be9af9f8c..ae4e08259 100644 --- a/contracts/utils/structs/CircularBuffer.sol +++ b/contracts/utils/structs/CircularBuffer.sol @@ -91,7 +91,7 @@ library CircularBuffer { } /** - * @dev Length of the buffer. This is the maximum number of elements kepts in the buffer. + * @dev Length of the buffer. This is the maximum number of elements kept in the buffer. */ function length(Bytes32CircularBuffer storage self) internal view returns (uint256) { return self._data.length; diff --git a/contracts/utils/structs/Heap.sol b/contracts/utils/structs/Heap.sol index 269c4723f..24d97292f 100644 --- a/contracts/utils/structs/Heap.sol +++ b/contracts/utils/structs/Heap.sol @@ -43,7 +43,7 @@ library Heap { using SafeCast for *; /** - * @dev Binary heap that support values of type uint256. + * @dev Binary heap that supports values of type uint256. * * Each element of that structure uses 2 storage slots. */ @@ -235,7 +235,7 @@ library Heap { /** * @dev Perform heap maintenance on `self`, starting at position `pos` (with the `value`), using `comp` as a - * comparator, and moving toward the leafs of the underlying tree. + * comparator, and moving toward the leaves of the underlying tree. * * NOTE: This is a private function that is called in a trusted context with already cached parameters. `length` * and `value` could be extracted from `self` and `pos`, but that would require redundant storage read. These @@ -309,7 +309,7 @@ library Heap { } /** - * @dev Binary heap that support values of type uint208. + * @dev Binary heap that supports values of type uint208. * * Each element of that structure uses 1 storage slots. */ @@ -501,7 +501,7 @@ library Heap { /** * @dev Perform heap maintenance on `self`, starting at position `pos` (with the `value`), using `comp` as a - * comparator, and moving toward the leafs of the underlying tree. + * comparator, and moving toward the leaves of the underlying tree. * * NOTE: This is a private function that is called in a trusted context with already cached parameters. `length` * and `value` could be extracted from `self` and `pos`, but that would require redundant storage read. These diff --git a/scripts/generate/templates/Heap.js b/scripts/generate/templates/Heap.js index 558ed1b91..aebc42e9e 100644 --- a/scripts/generate/templates/Heap.js +++ b/scripts/generate/templates/Heap.js @@ -45,7 +45,7 @@ import {Panic} from "../Panic.sol"; const generate = ({ struct, node, valueType, indexType, blockSize }) => `\ /** - * @dev Binary heap that support values of type ${valueType}. + * @dev Binary heap that supports values of type ${valueType}. * * Each element of that structure uses ${blockSize} storage slots. */ @@ -237,7 +237,7 @@ function _swap(${struct} storage self, ${indexType} i, ${indexType} j) private { /** * @dev Perform heap maintenance on \`self\`, starting at position \`pos\` (with the \`value\`), using \`comp\` as a - * comparator, and moving toward the leafs of the underlying tree. + * comparator, and moving toward the leaves of the underlying tree. * * NOTE: This is a private function that is called in a trusted context with already cached parameters. \`length\` * and \`value\` could be extracted from \`self\` and \`pos\`, but that would require redundant storage read. These diff --git a/scripts/generate/templates/MerkleProof.js b/scripts/generate/templates/MerkleProof.js index 8f206c880..6711a87e2 100644 --- a/scripts/generate/templates/MerkleProof.js +++ b/scripts/generate/templates/MerkleProof.js @@ -66,7 +66,7 @@ function verify${suffix}(${(hash ? formatArgsMultiline : formatArgsSingleLine)( * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from \`leaf\` using \`proof\`. A \`proof\` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs - * of leafs & pre-images are assumed to be sorted. + * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in ${location} with ${hash ? 'a custom' : 'the default'} hashing function. */ diff --git a/test/utils/structs/MerkleTree.test.js b/test/utils/structs/MerkleTree.test.js index 2603ac289..bec39ceea 100644 --- a/test/utils/structs/MerkleTree.test.js +++ b/test/utils/structs/MerkleTree.test.js @@ -6,9 +6,9 @@ const { StandardMerkleTree } = require('@openzeppelin/merkle-tree'); const { generators } = require('../../helpers/random'); -const makeTree = (leafs = [ethers.ZeroHash]) => +const makeTree = (leaves = [ethers.ZeroHash]) => StandardMerkleTree.of( - leafs.map(leaf => [leaf]), + leaves.map(leaf => [leaf]), ['bytes32'], { sortLeaves: false }, ); @@ -39,15 +39,15 @@ describe('MerkleTree', function () { describe('push', function () { it('tree is correctly updated', async function () { - const leafs = Array.from({ length: 2 ** Number(DEPTH) }, () => ethers.ZeroHash); + const leaves = Array.from({ length: 2 ** Number(DEPTH) }, () => ethers.ZeroHash); // for each leaf slot - for (const i in leafs) { + for (const i in leaves) { // generate random leaf and hash it - const hashedLeaf = hashLeaf((leafs[i] = generators.bytes32())); + const hashedLeaf = hashLeaf((leaves[i] = generators.bytes32())); // update leaf list and rebuild tree. - const tree = makeTree(leafs); + const tree = makeTree(leaves); // push value to tree await expect(this.mock.push(hashedLeaf)).to.emit(this.mock, 'LeafInserted').withArgs(hashedLeaf, i, tree.root); @@ -67,13 +67,13 @@ describe('MerkleTree', function () { it('reset', async function () { // empty tree - const zeroLeafs = Array.from({ length: 2 ** Number(DEPTH) }, () => ethers.ZeroHash); - const zeroTree = makeTree(zeroLeafs); + const zeroLeaves = Array.from({ length: 2 ** Number(DEPTH) }, () => ethers.ZeroHash); + const zeroTree = makeTree(zeroLeaves); // tree with one element - const leafs = Array.from({ length: 2 ** Number(DEPTH) }, () => ethers.ZeroHash); - const hashedLeaf = hashLeaf((leafs[0] = generators.bytes32())); // fill first leaf and hash it - const tree = makeTree(leafs); + const leaves = Array.from({ length: 2 ** Number(DEPTH) }, () => ethers.ZeroHash); + const hashedLeaf = hashLeaf((leaves[0] = generators.bytes32())); // fill first leaf and hash it + const tree = makeTree(leaves); // root should be that of a zero tree expect(await this.mock.root()).to.equal(zeroTree.root);