Skip to content

Commit

Permalink
Fix typographical errors (#5194)
Browse files Browse the repository at this point in the history
  • Loading branch information
cairoeth authored Sep 13, 2024
1 parent cae60c5 commit 6e22430
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC1363Receiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions contracts/token/ERC1155/utils/ERC1155Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down
8 changes: 4 additions & 4 deletions contracts/utils/cryptography/MerkleProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down
6 changes: 3 additions & 3 deletions contracts/utils/cryptography/RSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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]
*/
Expand All @@ -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.
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/structs/CircularBuffer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions contracts/utils/structs/Heap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate/templates/Heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate/templates/MerkleProof.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
22 changes: 11 additions & 11 deletions test/utils/structs/MerkleTree.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 6e22430

Please sign in to comment.