diff --git a/contracts/access/AccessControl.sol b/contracts/access/AccessControl.sol index 1c4aeb9fb2a..03de0057ed3 100644 --- a/contracts/access/AccessControl.sol +++ b/contracts/access/AccessControl.sol @@ -143,8 +143,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 { * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * - * If the calling account had been revoked `role`, emits a {RoleRevoked} - * event. + * Emits a {RoleRevoked} event if the calling account had `role` and this call successfully revoked it. * * Requirements: * diff --git a/contracts/access/manager/AccessManager.sol b/contracts/access/manager/AccessManager.sol index e52a62a481e..233c352f3f7 100644 --- a/contracts/access/manager/AccessManager.sol +++ b/contracts/access/manager/AccessManager.sol @@ -329,7 +329,7 @@ contract AccessManager is Context, Multicall, IAccessManager { * Emits a {RoleAdminChanged} event. * * NOTE: Setting the admin role as the `PUBLIC_ROLE` is allowed, but it will effectively allow - * anyone to set grant or revoke such role. + * anyone to grant or revoke such role. */ function _setRoleAdmin(uint64 roleId, uint64 admin) internal virtual { if (roleId == ADMIN_ROLE || roleId == PUBLIC_ROLE) { diff --git a/contracts/account/Account.sol b/contracts/account/Account.sol index ae5dd79e116..674d47fd1d6 100644 --- a/contracts/account/Account.sol +++ b/contracts/account/Account.sol @@ -15,7 +15,7 @@ import {LowLevelCall} from "../utils/LowLevelCall.sol"; * Developers must implement the {AbstractSigner-_rawSignatureValidation} function to define the account's validation logic. * * NOTE: This core account doesn't include any mechanism for performing arbitrary external calls. This is an essential - * feature that all Account should have. We leave it up to the developers to implement the mechanism of their choice. + * feature that all Accounts should have. We leave it up to the developers to implement the mechanism of their choice. * Common choices include ERC-6900, ERC-7579 and ERC-7821 (among others). * * IMPORTANT: Implementing a mechanism to validate signatures is a security-sensitive operation as it may allow an @@ -104,7 +104,7 @@ abstract contract Account is AbstractSigner, IAccount { } /** - * @dev Virtual function that returns the signable hash for a user operations. Since v0.8.0 of the entrypoint, + * @dev Virtual function that returns the signable hash for a user operation. Since v0.8.0 of the entrypoint, * `userOpHash` is an EIP-712 hash that can be signed directly. */ function _signableUserOpHash( diff --git a/contracts/account/utils/ERC4337Utils.sol b/contracts/account/utils/ERC4337Utils.sol index 2a76ea32774..f85f673d6d5 100644 --- a/contracts/account/utils/ERC4337Utils.sol +++ b/contracts/account/utils/ERC4337Utils.sol @@ -175,7 +175,7 @@ library ERC4337Utils { // // Prior to v0.8.0, this was easy to replicate for any entrypoint and chainId. Since v0.8.0 of the // entrypoint, this depends on the Entrypoint's domain separator, which cannot be hardcoded and is complex - // to recompute. Domain separator could be fetch using the `getDomainSeparatorV4` getter, or recomputed from + // to recompute. Domain separator could be fetched using the `getDomainSeparatorV4` getter, or recomputed from // the ERC-5267 getter, but both operation would require doing a view call to the entrypoint. Overall it feels // simpler and less error prone to get that functionality from the entrypoint directly. return IEntryPointExtra(entrypoint).getUserOpHash(self); diff --git a/contracts/crosschain/ERC7786Recipient.sol b/contracts/crosschain/ERC7786Recipient.sol index 2b8670cf35e..0343322f651 100644 --- a/contracts/crosschain/ERC7786Recipient.sol +++ b/contracts/crosschain/ERC7786Recipient.sol @@ -12,7 +12,7 @@ import {IERC7786Recipient} from "../interfaces/draft-IERC7786.sol"; * destination gateways. This contract leaves two functions unimplemented: * * * {_isAuthorizedGateway}, an internal getter used to verify whether an address is recognised by the contract as a - * valid ERC-7786 destination gateway. One or multiple gateway can be supported. Note that any malicious address for + * valid ERC-7786 destination gateway. One or multiple gateways can be supported. Note that any malicious address for * which this function returns true would be able to impersonate any account on any other chain sending any message. * * * {_processMessage}, the internal function that will be called with any message that has been validated. diff --git a/contracts/crosschain/bridges/abstract/BridgeMultiToken.sol b/contracts/crosschain/bridges/abstract/BridgeMultiToken.sol index 1e322f36d69..793208087e9 100644 --- a/contracts/crosschain/bridges/abstract/BridgeMultiToken.sol +++ b/contracts/crosschain/bridges/abstract/BridgeMultiToken.sol @@ -17,8 +17,8 @@ import {CrosschainLinked} from "../../CrosschainLinked.sol"; * This base contract is used by the {BridgeERC1155}, which interfaces with legacy ERC-1155 tokens. It is also used by * the {ERC1155Crosschain} extension, which embeds the bridge logic directly in the token contract. * - * This base contract implements the crosschain transfer operation though internal functions. It is for the the "child - * contracts" that inherit from this to implement the external interfaces and make this functions accessible. + * This base contract implements the crosschain transfer operation through internal functions. It is for the "child + * contracts" that inherit from this to implement the external interfaces and make these functions accessible. */ abstract contract BridgeMultiToken is Context, CrosschainLinked { using InteroperableAddress for bytes; diff --git a/contracts/finance/README.adoc b/contracts/finance/README.adoc index c855cbb6a99..efa63126ef1 100644 --- a/contracts/finance/README.adoc +++ b/contracts/finance/README.adoc @@ -8,7 +8,10 @@ This directory includes primitives for financial systems: - {VestingWallet} handles the vesting of Ether and ERC-20 tokens for a given beneficiary. Custody of multiple tokens can be given to this contract, which will release the token to the beneficiary following a given, customizable, vesting schedule. +- {VestingWalletCliff} is an extension of {VestingWallet} that adds a cliff to the vesting schedule. == Contracts {{VestingWallet}} + +{{VestingWalletCliff}} diff --git a/contracts/finance/VestingWalletCliff.sol b/contracts/finance/VestingWalletCliff.sol index dd1da6580bd..29ff3f4e98a 100644 --- a/contracts/finance/VestingWalletCliff.sol +++ b/contracts/finance/VestingWalletCliff.sol @@ -24,8 +24,9 @@ abstract contract VestingWalletCliff is VestingWallet { * constructor) and ends `cliffSeconds` later. */ constructor(uint64 cliffSeconds) { - if (cliffSeconds > duration()) { - revert InvalidCliffDuration(cliffSeconds, duration().toUint64()); + uint256 vestingDuration = duration(); + if (cliffSeconds > vestingDuration) { + revert InvalidCliffDuration(cliffSeconds, vestingDuration.toUint64()); } _cliff = start().toUint64() + cliffSeconds; } diff --git a/contracts/governance/README.adoc b/contracts/governance/README.adoc index a782de6ac95..a4e8b80712c 100644 --- a/contracts/governance/README.adoc +++ b/contracts/governance/README.adoc @@ -7,7 +7,7 @@ This directory includes primitives for on-chain governance. == Governor -This modular system of Governor contracts allows the deployment on-chain voting protocols similar to https://compound.finance/docs/governance[Compound's Governor Alpha & Bravo] and beyond, through the ability to easily customize multiple aspects of the protocol. +This modular system of Governor contracts allows the deployment of on-chain voting protocols similar to https://compound.finance/docs/governance[Compound's Governor Alpha & Bravo] and beyond, through the ability to easily customize multiple aspects of the protocol. [TIP] ==== @@ -58,6 +58,8 @@ Other extensions can customize the behavior or interface in multiple ways. * {GovernorSuperQuorum}: Extension of {Governor} with a super quorum. Proposals that meet the super quorum (and have a majority of for votes) advance to the `Succeeded` state before the proposal deadline. +* {GovernorSequentialProposalId}: An extension of {Governor} that changes the numbering of proposal ids from the default hash-based approach to sequential ids. + In addition to modules and extensions, the core contract requires a few virtual functions to be implemented to your particular specifications: * <>: Delay (in ERC-6372 clock) since the proposal is submitted until voting power is fixed and voting starts. This can be used to enforce a delay after a proposal is published for users to buy tokens, or delegate their votes. @@ -108,8 +110,12 @@ NOTE: Functions of the `Governor` contract do not include access control. If you {{GovernorSuperQuorum}} +{{GovernorSequentialProposalId}} + == Utils +{{IVotes}} + {{Votes}} {{VotesExtended}} diff --git a/contracts/governance/extensions/GovernorTimelockCompound.sol b/contracts/governance/extensions/GovernorTimelockCompound.sol index c3225f19865..d0bdd807f53 100644 --- a/contracts/governance/extensions/GovernorTimelockCompound.sol +++ b/contracts/governance/extensions/GovernorTimelockCompound.sol @@ -14,15 +14,15 @@ import {SafeCast} from "../../utils/math/SafeCast.sol"; * the admin of the timelock for any operation to be performed. A public, unrestricted, * {GovernorTimelockCompound-__acceptAdmin} is available to accept ownership of the timelock. * - * Using this model means the proposal will be operated by the {TimelockController} and not by the {Governor}. Thus, - * the assets and permissions must be attached to the {TimelockController}. Any asset sent to the {Governor} will be + * Using this model means the proposal will be operated by the {ICompoundTimelock} and not by the {Governor}. Thus, + * the assets and permissions must be attached to the {ICompoundTimelock}. Any asset sent to the {Governor} will be * inaccessible from a proposal, unless executed via {Governor-relay}. */ abstract contract GovernorTimelockCompound is Governor { ICompoundTimelock private _timelock; /** - * @dev Emitted when the timelock controller used for proposal execution is modified. + * @dev Emitted when the timelock used for proposal execution is modified. */ event TimelockChange(address oldTimelock, address newTimelock); diff --git a/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol b/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol index 53a7049a637..2035da01dff 100644 --- a/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol +++ b/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol @@ -28,7 +28,7 @@ abstract contract GovernorVotesSuperQuorumFraction is GovernorVotesQuorumFractio error GovernorInvalidSuperQuorumFraction(uint256 superQuorumNumerator, uint256 denominator); /** - * @dev The super quorum set is not valid as it is smaller or equal to the quorum. + * @dev The super quorum set is not valid as it is smaller than the quorum. */ error GovernorInvalidSuperQuorumTooSmall(uint256 superQuorumNumerator, uint256 quorumNumerator); @@ -41,7 +41,7 @@ abstract contract GovernorVotesSuperQuorumFraction is GovernorVotesQuorumFractio * @dev Initialize super quorum as a fraction of the token's total supply. * * The super quorum is specified as a fraction of the token's total supply and has to - * be greater than the quorum. + * be greater than or equal to the quorum. */ constructor(uint256 superQuorumNumeratorValue) { _updateSuperQuorumNumerator(superQuorumNumeratorValue); diff --git a/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol b/contracts/mocks/docs/token/ERC1155/MyERC1155HolderContract.sol similarity index 59% rename from contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol rename to contracts/mocks/docs/token/ERC1155/MyERC1155HolderContract.sol index 742a53ba4a6..2c837c97d20 100644 --- a/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +++ b/contracts/mocks/docs/token/ERC1155/MyERC1155HolderContract.sol @@ -1,7 +1,7 @@ -// contracts/MyERC115HolderContract.sol +// contracts/MyERC1155HolderContract.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {ERC1155Holder} from "../../../../token/ERC1155/utils/ERC1155Holder.sol"; -contract MyERC115HolderContract is ERC1155Holder {} +contract MyERC1155HolderContract is ERC1155Holder {} diff --git a/contracts/token/ERC1155/utils/ERC1155Utils.sol b/contracts/token/ERC1155/utils/ERC1155Utils.sol index 03cb0f0b953..9cdc9557e1e 100644 --- a/contracts/token/ERC1155/utils/ERC1155Utils.sol +++ b/contracts/token/ERC1155/utils/ERC1155Utils.sol @@ -54,7 +54,7 @@ library ERC1155Utils { * 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 doesn't contain code (i.e. an EOA). - * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept + * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value to accept * the transfer. */ function checkOnERC1155BatchReceived( diff --git a/contracts/token/ERC20/extensions/ERC20Burnable.sol b/contracts/token/ERC20/extensions/ERC20Burnable.sol index 4d482d8ec83..3dffe6a6ab2 100644 --- a/contracts/token/ERC20/extensions/ERC20Burnable.sol +++ b/contracts/token/ERC20/extensions/ERC20Burnable.sol @@ -4,14 +4,13 @@ pragma solidity ^0.8.20; import {ERC20} from "../ERC20.sol"; -import {Context} from "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ -abstract contract ERC20Burnable is Context, ERC20 { +abstract contract ERC20Burnable is ERC20 { /** * @dev Destroys a `value` amount of tokens from the caller. * @@ -29,7 +28,7 @@ abstract contract ERC20Burnable is Context, ERC20 { * * Requirements: * - * - the caller must have allowance for ``accounts``'s tokens of at least + * - the caller must have allowance for `account`'s tokens of at least * `value`. */ function burnFrom(address account, uint256 value) public virtual { diff --git a/contracts/token/ERC20/extensions/ERC20FlashMint.sol b/contracts/token/ERC20/extensions/ERC20FlashMint.sol index f3ed94f3aa7..79c6e8bbb08 100644 --- a/contracts/token/ERC20/extensions/ERC20FlashMint.sol +++ b/contracts/token/ERC20/extensions/ERC20FlashMint.sol @@ -67,7 +67,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender { /** * @dev Returns the fee applied when doing flash loans. By default this - * implementation has 0 fees. This function can be overloaded to make + * implementation has 0 fees. This function can be overridden to make * the flash loan mechanism deflationary. * @return The fees applied to the corresponding flash loan. */ @@ -78,7 +78,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender { /** * @dev Returns the receiver address of the flash fee. By default this * implementation returns the address(0) which means the fee amount will be burnt. - * This function can be overloaded to change the fee receiver. + * This function can be overridden to change the fee receiver. * @return The address for which the flash fee will be sent to. */ function _flashFeeReceiver() internal view virtual returns (address) { diff --git a/contracts/token/ERC20/utils/SafeERC20.sol b/contracts/token/ERC20/utils/SafeERC20.sol index 4d5e45fde83..1213d0b1e26 100644 --- a/contracts/token/ERC20/utils/SafeERC20.sol +++ b/contracts/token/ERC20/utils/SafeERC20.sol @@ -261,8 +261,8 @@ library SafeERC20 { * * @param token The token targeted by the call. * @param spender The spender of the tokens - * @param value The amount of token to transfer - * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean. + * @param value The amount of token to approve + * @param bubble Behavior switch if the approve call reverts: bubble the revert reason or return a false boolean. */ function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) { bytes4 selector = IERC20.approve.selector; diff --git a/contracts/token/ERC721/extensions/ERC721Consecutive.sol b/contracts/token/ERC721/extensions/ERC721Consecutive.sol index a391923e8dc..3058595263b 100644 --- a/contracts/token/ERC721/extensions/ERC721Consecutive.sol +++ b/contracts/token/ERC721/extensions/ERC721Consecutive.sol @@ -87,7 +87,7 @@ abstract contract ERC721Consecutive is IERC2309, ERC721 { /** * @dev Mint a batch of tokens of length `batchSize` for `to`. Returns the token id of the first token minted in the - * batch; if `batchSize` is 0, returns the number of consecutive ids minted so far. + * batch; if `batchSize` is 0, returns the next token id to be minted consecutively. * * Requirements: * diff --git a/contracts/utils/Create3.sol b/contracts/utils/Create3.sol index eea07e83281..8b150d5324a 100644 --- a/contracts/utils/Create3.sol +++ b/contracts/utils/Create3.sol @@ -120,7 +120,7 @@ library Create3 { return _computeCreateAddress(Create2.computeAddress(salt, PROXY_INITCODE_HASH, deployer)); } - /// @dev Compute the address of the first contract that `creator` would deployed using CREATE (nonce 1). + /// @dev Compute the address of the first contract that `creator` would deploy using CREATE (nonce 1). function _computeCreateAddress(address creator) private pure returns (address addr) { assembly ("memory-safe") { mstore(0x15, 0x01) diff --git a/contracts/utils/Memory.sol b/contracts/utils/Memory.sol index 9b8cb8961b9..31252cbb727 100644 --- a/contracts/utils/Memory.sol +++ b/contracts/utils/Memory.sol @@ -97,7 +97,7 @@ library Memory { /// @dev Extract the data corresponding to a Slice (allocate new memory) function toBytes(Slice self) internal pure returns (bytes memory result) { uint256 len = length(self); - Memory.Pointer ptr = _pointer(self); + Pointer ptr = _pointer(self); assembly ("memory-safe") { result := mload(0x40) mstore(result, len) @@ -108,8 +108,8 @@ library Memory { /// @dev Returns true if the two slices contain the same data. function equal(Slice a, Slice b) internal pure returns (bool result) { - Memory.Pointer ptrA = _pointer(a); - Memory.Pointer ptrB = _pointer(b); + Pointer ptrA = _pointer(a); + Pointer ptrB = _pointer(b); uint256 lenA = length(a); uint256 lenB = length(b); assembly ("memory-safe") { @@ -134,14 +134,14 @@ library Memory { * (`slice(Slice,uint256)` and `slice(Slice,uint256, uint256)`) should not cause this issue if the parent slice is * correct. */ - function _asSlice(uint256 len, Memory.Pointer ptr) private pure returns (Slice result) { + function _asSlice(uint256 len, Pointer ptr) private pure returns (Slice result) { assembly ("memory-safe") { result := or(shl(128, len), ptr) } } /// @dev Returns the memory location of a given slice (equiv to self.offset for calldata slices) - function _pointer(Slice self) private pure returns (Memory.Pointer result) { + function _pointer(Slice self) private pure returns (Pointer result) { assembly ("memory-safe") { result := and(self, shr(128, not(0))) } diff --git a/contracts/utils/NoncesKeyed.sol b/contracts/utils/NoncesKeyed.sol index df9c5704bc9..c0c87ae877d 100644 --- a/contracts/utils/NoncesKeyed.sol +++ b/contracts/utils/NoncesKeyed.sol @@ -24,7 +24,7 @@ abstract contract NoncesKeyed is Nonces { /** * @dev Consumes the next unused nonce for an address and key. * - * Returns the current value without the key prefix. Consumed nonce is increased, so calling this function twice + * Returns the current value with the key prefix (i.e. the packed keyNonce). Consumed nonce is increased, so calling this function twice * with the same arguments will return different (sequential) results. */ function _useNonce(address owner, uint192 key) internal virtual returns (uint256) { diff --git a/contracts/utils/RLP.sol b/contracts/utils/RLP.sol index f9d18945dd6..945aa5492cc 100644 --- a/contracts/utils/RLP.sol +++ b/contracts/utils/RLP.sol @@ -154,7 +154,7 @@ library RLP { * @dev Encode an address as an RLP item of fixed size (20 bytes). * * The address is encoded with its leading zeros (if it has any). If someone wants to encode the address as a scalar, - * they can cast it to an uint256 and then call the corresponding {encode} function. + * they can cast it to a uint256 and then call the corresponding {encode} function. */ function encode(address input) internal pure returns (bytes memory result) { assembly ("memory-safe") { @@ -166,7 +166,7 @@ library RLP { } /** - * @dev Encode an uint256 as an RLP scalar. + * @dev Encode a uint256 as an RLP scalar. * * Unlike {encode-bytes32-}, this function uses scalar encoding that removes the prefix zeros. */ diff --git a/contracts/utils/ShortStrings.sol b/contracts/utils/ShortStrings.sol index 79332317aad..f8675d2f889 100644 --- a/contracts/utils/ShortStrings.sol +++ b/contracts/utils/ShortStrings.sol @@ -47,7 +47,7 @@ library ShortStrings { /** * @dev Encode a string of at most 31 chars into a `ShortString`. * - * This will trigger a `StringTooLong` error is the input string is too long. + * This will trigger a `StringTooLong` error if the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); diff --git a/contracts/utils/cryptography/P256.sol b/contracts/utils/cryptography/P256.sol index 81d79adc427..8aae6db1226 100644 --- a/contracts/utils/cryptography/P256.sol +++ b/contracts/utils/cryptography/P256.sol @@ -89,7 +89,7 @@ library P256 { bytes32 qy ) private view returns (bool valid, bool supported) { if (!_isProperSignature(r, s) || !isValidPublicKey(qx, qy)) { - return (false, true); // signature is invalid, and its not because the precompile is missing + return (false, true); // signature is invalid, and it's not because the precompile is missing } else if (_rip7212(h, r, s, qx, qy)) { return (true, true); // precompile is present, signature is valid } else if ( diff --git a/contracts/utils/cryptography/README.adoc b/contracts/utils/cryptography/README.adoc index 66c47d12675..706ec45f7de 100644 --- a/contracts/utils/cryptography/README.adoc +++ b/contracts/utils/cryptography/README.adoc @@ -61,6 +61,8 @@ A collection of contracts and libraries that implement various signature validat {{SignerEIP7702}} +{{SignerWebAuthn}} + {{SignerERC7913}} {{MultiSignerERC7913}} diff --git a/contracts/utils/cryptography/TrieProof.sol b/contracts/utils/cryptography/TrieProof.sol index fbf7a0b3c81..ec2a2f5486a 100644 --- a/contracts/utils/cryptography/TrieProof.sol +++ b/contracts/utils/cryptography/TrieProof.sol @@ -15,7 +15,7 @@ import {RLP} from "../RLP.sol"; * * Transaction against the transactionsRoot of a block. * * Event against receiptsRoot of a block. * * Account details (RLP encoding of [nonce, balance, storageRoot, codeHash]) against the stateRoot of a block. - * * Storage slot (RLP encoding of the value) against the storageRoot of a account. + * * Storage slot (RLP encoding of the value) against the storageRoot of an account. * * Proving a storage slot is usually done in 3 steps: * @@ -67,7 +67,7 @@ library TrieProof { /// @dev Number of items in leaf or extension nodes (always 2) uint256 internal constant LEAF_OR_EXTENSION_NODE_LENGTH = 2; - /// @dev Verifies a `proof` against a given `key`, `value`, `and root` hash. + /// @dev Verifies a `proof` against a given `key`, `value`, and `root` hash. function verify( bytes memory value, bytes32 root, diff --git a/contracts/utils/cryptography/draft-ERC7739Utils.sol b/contracts/utils/cryptography/draft-ERC7739Utils.sol index 2035d331d8c..60139796bd7 100644 --- a/contracts/utils/cryptography/draft-ERC7739Utils.sol +++ b/contracts/utils/cryptography/draft-ERC7739Utils.sol @@ -162,7 +162,7 @@ library ERC7739Utils { * Following ERC-7739 specifications, a `contentsName` is considered invalid if it's empty or it contains * any of the following bytes , )\x00 * - * If the `contentsType` is invalid, this returns an empty string. Otherwise, the return string has non-zero + * If the `contentsDescr` is invalid, this returns empty strings. Otherwise, the return strings have non-zero * length. */ function decodeContentsDescr( diff --git a/contracts/utils/cryptography/signers/SignerECDSA.sol b/contracts/utils/cryptography/signers/SignerECDSA.sol index 69a62216f45..e40b3b1b1fc 100644 --- a/contracts/utils/cryptography/signers/SignerECDSA.sol +++ b/contracts/utils/cryptography/signers/SignerECDSA.sol @@ -51,6 +51,6 @@ abstract contract SignerECDSA is AbstractSigner { bytes calldata signature ) internal view virtual override returns (bool) { (address recovered, ECDSA.RecoverError err, ) = ECDSA.tryRecoverCalldata(hash, signature); - return signer() == recovered && err == ECDSA.RecoverError.NoError; + return err == ECDSA.RecoverError.NoError && signer() == recovered; } } diff --git a/contracts/utils/draft-InteroperableAddress.sol b/contracts/utils/draft-InteroperableAddress.sol index 10b4e426adf..37595c84a86 100644 --- a/contracts/utils/draft-InteroperableAddress.sol +++ b/contracts/utils/draft-InteroperableAddress.sol @@ -66,7 +66,7 @@ library InteroperableAddress { } /** - * @dev Parse a ERC-7930 interoperable address (version 1) into its different components. Reverts if the input is + * @dev Parse an ERC-7930 interoperable address (version 1) into its different components. Reverts if the input is * not following a version 1 of ERC-7930. * * NOTE: Trailing bytes after a valid v1 encoding are ignored. The same decoded address may therefore correspond @@ -149,7 +149,7 @@ library InteroperableAddress { } /** - * @dev Parse a ERC-7930 interoperable address (version 1) corresponding to an EIP-155 chain. The `chainId` and + * @dev Parse an ERC-7930 interoperable address (version 1) corresponding to an EIP-155 chain. The `chainId` and * `addr` return values will be zero if the input doesn't include a chainReference or an address, respectively. * * NOTE: Trailing bytes after a valid v1 encoding are ignored. The same decoded (chainId, addr) may therefore diff --git a/contracts/utils/structs/Heap.sol b/contracts/utils/structs/Heap.sol index 352f1cb3810..f313f813250 100644 --- a/contracts/utils/structs/Heap.sol +++ b/contracts/utils/structs/Heap.sol @@ -211,7 +211,7 @@ library Heap { uint256 rIndex = 2 * index + 2; // Three cases: - // 1. Both children exist: sifting may continue on one of the branch (selection required) + // 1. Both children exist: sifting may continue on one of the branches (selection required) // 2. Only left child exist: sifting may continue on the left branch (no selection required) // 3. Neither child exist: sifting is done if (rIndex < size) { diff --git a/docs/modules/ROOT/pages/erc1155.adoc b/docs/modules/ROOT/pages/erc1155.adoc index 9d3dea8272f..13cdafbee4c 100644 --- a/docs/modules/ROOT/pages/erc1155.adoc +++ b/docs/modules/ROOT/pages/erc1155.adoc @@ -112,7 +112,7 @@ In order for our contract to receive ERC-1155 tokens we can inherit from the con [source,solidity] ---- -include::api:example$token/ERC1155/MyERC115HolderContract.sol[] +include::api:example$token/ERC1155/MyERC1155HolderContract.sol[] ---- We can also implement more complex scenarios using the xref:api:token/ERC1155.adoc#IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-[`onERC1155Received`] and xref:api:token/ERC1155.adoc#IERC1155Receiver-onERC1155BatchReceived-address-address-uint256---uint256---bytes-[`onERC1155BatchReceived`] functions. diff --git a/docs/modules/ROOT/pages/governance.adoc b/docs/modules/ROOT/pages/governance.adoc index e44702a4b97..89a62464b29 100644 --- a/docs/modules/ROOT/pages/governance.adoc +++ b/docs/modules/ROOT/pages/governance.adoc @@ -152,7 +152,7 @@ If a timelock was set up, the first step to execution is queueing. You will noti To queue, we call the queue function: ```javascript -const descriptionHash = ethers.utils.id(“Proposal #1: Give grant to team”); +const descriptionHash = ethers.id(“Proposal #1: Give grant to team”); await governor.queue( [tokenAddress], diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index d47510cd773..7b725d03bd0 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -59,7 +59,7 @@ WARNING: Foundry installs the latest version initially, but subsequent `forge up $ forge install OpenZeppelin/openzeppelin-contracts ``` -Add `@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/` in `remappings.txt.` +Add `@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/` in `remappings.txt`. [[usage]] === Usage diff --git a/docs/modules/ROOT/pages/upgradeable.adoc b/docs/modules/ROOT/pages/upgradeable.adoc index ff395e9f5f9..46ed3d69565 100644 --- a/docs/modules/ROOT/pages/upgradeable.adoc +++ b/docs/modules/ROOT/pages/upgradeable.adoc @@ -31,7 +31,7 @@ NOTE: Interfaces and libraries are not included in the Upgradeable package, but Constructors are replaced by internal initializer functions following the naming convention `+__{ContractName}_init+`. Since these are internal, you must always define your own public initializer function and call the parent initializer of the contract you extend. ```diff -- constructor() ERC721("MyCollectible", "MCO") public { +- constructor() ERC721("MyCollectible", "MCO") { + function initialize() initializer public { + __ERC721_init("MyCollectible", "MCO"); } @@ -72,4 +72,4 @@ You may notice that contracts use a struct with the `@custom:storage-location er Without namespaced storage, it isn't safe to simply add a state variable because it "shifts down" all of the state variables below in the inheritance chain. This makes the storage layouts incompatible, as explained in xref:upgrades-plugins::writing-upgradeable.adoc#modifying-your-contracts[Writing Upgradeable Contracts]. -The namespaced storage pattern used in the Upgradeable package allows us to freely add new state variables in the future without compromising the storage compatibility with existing deployments. It also allows changing the inheritance order with no impact on the resulting storage layout, as long as all inherited contracts use namespaced storage. \ No newline at end of file +The namespaced storage pattern used in the Upgradeable package allows us to freely add new state variables in the future without compromising the storage compatibility with existing deployments. It also allows changing the inheritance order with no impact on the resulting storage layout, as long as all inherited contracts use namespaced storage. diff --git a/docs/modules/ROOT/pages/utilities.adoc b/docs/modules/ROOT/pages/utilities.adoc index cefe9feff0f..faeb839c09b 100644 --- a/docs/modules/ROOT/pages/utilities.adoc +++ b/docs/modules/ROOT/pages/utilities.adoc @@ -234,10 +234,10 @@ contract MyContract { using SignedMath for int256; function tryOperations(uint256 a, uint256 b) internal pure { - (bool succeededAdd, uint256 resultAdd) = x.tryAdd(y); - (bool succeededSub, uint256 resultSub) = x.trySub(y); - (bool succeededMul, uint256 resultMul) = x.tryMul(y); - (bool succeededDiv, uint256 resultDiv) = x.tryDiv(y); + (bool succeededAdd, uint256 resultAdd) = a.tryAdd(b); + (bool succeededSub, uint256 resultSub) = a.trySub(b); + (bool succeededMul, uint256 resultMul) = a.tryMul(b); + (bool succeededDiv, uint256 resultDiv) = a.tryDiv(b); // ... } diff --git a/fv/README.md b/fv/README.md index fe582fe39f9..6709b838696 100644 --- a/fv/README.md +++ b/fv/README.md @@ -9,7 +9,7 @@ Documentation for CVT and the specification language is available [here](https:/ Follow the [Certora installation guide](https://docs.certora.com/en/latest/docs/user-guide/getting-started/install.html) in order to get the Certora Prover Package and the `solc` executable folder in your path. > **Note** -> An API Key is required for local testing. Although the prover will run on a GitHub Actions' CI environment on selected Pull Requests. +> An API Key is required for local testing. Although the prover will run in a GitHub Actions' CI environment on selected Pull Requests. ## Running the verification diff --git a/fv/specs/AccessControlDefaultAdminRules.spec b/fv/specs/AccessControlDefaultAdminRules.spec index bda5a7a0b31..3b52fe32cf1 100644 --- a/fv/specs/AccessControlDefaultAdminRules.spec +++ b/fv/specs/AccessControlDefaultAdminRules.spec @@ -71,7 +71,7 @@ invariant defaultAdminRoleAdminConsistency() └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ */ // Writing this as an invariant would be flagged by Certora as trivial. Writing it as a rule is just as valid: we -// verify the is true for any state of the storage +// verify this is true for any state of the storage rule ownerConsistency() { assert defaultAdmin() == owner(); } diff --git a/fv/specs/ERC20Wrapper.spec b/fv/specs/ERC20Wrapper.spec index 1535144a7ef..8716a944e67 100644 --- a/fv/specs/ERC20Wrapper.spec +++ b/fv/specs/ERC20Wrapper.spec @@ -65,7 +65,7 @@ invariant totalSupplyIsSmallerThanUnderlyingBalance() require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(from, to); } preserved ERC20PermitHarness.burn(address from, uint256 amount) with (env e) { - // If someone can burn from the wrapper, than the invariant obviously doesn't hold. + // If someone can burn from the wrapper, then the invariant obviously doesn't hold. require from != currentContract; require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(from, currentContract); } diff --git a/fv/specs/EnumerableMap.spec b/fv/specs/EnumerableMap.spec index 99183e9ca7b..b171f5299a2 100644 --- a/fv/specs/EnumerableMap.spec +++ b/fv/specs/EnumerableMap.spec @@ -53,7 +53,7 @@ invariant indexedContained(uint256 index) /* ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Invariant: A value can only be stored at a single location │ +│ Invariant: A key can only be stored at a single location │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ */ invariant atUniqueness(uint256 index1, uint256 index2) @@ -72,9 +72,9 @@ invariant atUniqueness(uint256 index1, uint256 index2) /* ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Invariant: index <> value relationship is consistent │ +│ Invariant: index <> key relationship is consistent │ │ │ -│ Note that the two consistencyXxx invariants, put together, prove that at_ and _positionOf are inverse of one │ +│ Note that the two consistencyXxx invariants, put together, prove that key_at and _positionOf are inverse of one │ │ another. This proves that we have a bijection between indices (the enumerability part) and keys (the entries that │ │ are set and removed from the EnumerableMap). │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ diff --git a/fv/specs/TimelockController.spec b/fv/specs/TimelockController.spec index 739fe976b0c..42df83d804d 100644 --- a/fv/specs/TimelockController.spec +++ b/fv/specs/TimelockController.spec @@ -251,7 +251,7 @@ rule execute(env e, method f, bytes32 id, bytes32 predecessor) filtered { f -> // The underlying transaction can revert, and that would cause the execution to revert. We can check that all non // reverting calls meet the requirements in terms of proposal readiness, access control and predecessor dependency. - // We can't however guarantee that these requirements being meet ensure liveness of the proposal, because the + // We can't however guarantee that these requirements being met ensure liveness of the proposal, because the // proposal can revert for reasons beyond our control. // liveness, should be `<=>` but can only check `=>` (see comment above) diff --git a/test/token/ERC721/ERC721.behavior.js b/test/token/ERC721/ERC721.behavior.js index 63b4e19bece..22ad6dfef39 100644 --- a/test/token/ERC721/ERC721.behavior.js +++ b/test/token/ERC721/ERC721.behavior.js @@ -480,15 +480,13 @@ function shouldBehaveLikeERC721() { const itApproves = function () { it('sets the approval for the target address', async function () { - expect(await this.token.getApproved(tokenId)).to.equal(this.approved ?? this.approved); + expect(await this.token.getApproved(tokenId)).to.equal(this.approved); }); }; const itEmitsApprovalEvent = function () { it('emits an approval event', async function () { - await expect(this.tx) - .to.emit(this.token, 'Approval') - .withArgs(this.owner, this.approved ?? this.approved, tokenId); + await expect(this.tx).to.emit(this.token, 'Approval').withArgs(this.owner, this.approved, tokenId); }); }; diff --git a/test/utils/Address.test.js b/test/utils/Address.test.js index 2335c223722..7bb7e7ab7f7 100644 --- a/test/utils/Address.test.js +++ b/test/utils/Address.test.js @@ -26,7 +26,7 @@ describe('Address', function () { describe('sendValue', function () { describe('when sender contract has no funds', function () { it('sends 0 wei', async function () { - await expect(this.mock.$sendValue(this.other, 0n)).to.changeEtherBalance(this.recipient, 0n); + await expect(this.mock.$sendValue(this.recipient, 0n)).to.changeEtherBalance(this.recipient, 0n); }); it('reverts when sending non-zero amounts', async function () {