diff --git a/README.md b/README.md index 2f92281b3bf..2cb5e35ce70 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ To keep your system secure, you should **always** use the installed code as-is, The guides in the [documentation site](https://docs.openzeppelin.com/contracts) will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides: * [Access Control](https://docs.openzeppelin.com/contracts/access-control): decide who can perform each of the actions on your system. -* [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales). +* [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives. * [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools including non-overflowing math, signature verification, and trustless paying systems. The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts' development in the [community forum](https://forum.openzeppelin.com). diff --git a/contracts/account/extensions/draft-ERC7821.sol b/contracts/account/extensions/draft-ERC7821.sol index a8f22361f8f..9db9b4bb0f0 100644 --- a/contracts/account/extensions/draft-ERC7821.sol +++ b/contracts/account/extensions/draft-ERC7821.sol @@ -10,7 +10,7 @@ import {Account} from "../Account.sol"; /** * @dev Minimal batch executor following ERC-7821. * - * Only supports supports single batch mode (`0x01000000000000000000`). Does not support optional "opData". + * Only supports single batch mode (`0x01000000000000000000`). Does not support optional "opData". * * @custom:stateless */ diff --git a/contracts/governance/extensions/GovernorTimelockControl.sol b/contracts/governance/extensions/GovernorTimelockControl.sol index b3f3b26c9ea..fdf83367212 100644 --- a/contracts/governance/extensions/GovernorTimelockControl.sol +++ b/contracts/governance/extensions/GovernorTimelockControl.sol @@ -47,10 +47,10 @@ abstract contract GovernorTimelockControl is Governor { return currentState; } - bytes32 queueid = _timelockIds[proposalId]; - if (_timelock.isOperationPending(queueid)) { + bytes32 queueId = _timelockIds[proposalId]; + if (_timelock.isOperationPending(queueId)) { return ProposalState.Queued; - } else if (_timelock.isOperationDone(queueid)) { + } else if (_timelock.isOperationDone(queueId)) { // This can happen if the proposal is executed directly on the timelock. return ProposalState.Executed; } else { diff --git a/contracts/mocks/TimelockReentrant.sol b/contracts/mocks/TimelockReentrant.sol index aab676a500e..c78ca0de712 100644 --- a/contracts/mocks/TimelockReentrant.sol +++ b/contracts/mocks/TimelockReentrant.sol @@ -12,7 +12,7 @@ contract TimelockReentrant { _reentered = true; } - function enableRentrancy(address target, bytes calldata data) external { + function enableReentrancy(address target, bytes calldata data) external { _reenterTarget = target; _reenterData = data; } diff --git a/contracts/utils/Base64.sol b/contracts/utils/Base64.sol index d9b09ec0dd1..cdd4d65de9c 100644 --- a/contracts/utils/Base64.sol +++ b/contracts/utils/Base64.sol @@ -34,7 +34,7 @@ library Base64 { */ function _encode(bytes memory data, string memory table, bool withPadding) private pure returns (string memory) { /** - * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence + * Inspired by Brecht Devos (Brechtpd) implementation - MIT license * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; diff --git a/contracts/utils/SlotDerivation.sol b/contracts/utils/SlotDerivation.sol index df23efa284a..74dfbbded44 100644 --- a/contracts/utils/SlotDerivation.sol +++ b/contracts/utils/SlotDerivation.sol @@ -16,7 +16,7 @@ pragma solidity ^0.8.20; * contract Example { * // Add the library methods * using StorageSlot for bytes32; - * using SlotDerivation for bytes32; + * using SlotDerivation for *; * * // Declare a namespace * string private constant _NAMESPACE = ""; // eg. OpenZeppelin.Slot diff --git a/contracts/utils/Strings.sol b/contracts/utils/Strings.sol index 50fa286578b..69f0f5e2b10 100644 --- a/contracts/utils/Strings.sol +++ b/contracts/utils/Strings.sol @@ -466,7 +466,7 @@ library Strings { bytes memory output = new bytes(2 * buffer.length); // worst case scenario uint256 outputLength = 0; - for (uint256 i; i < buffer.length; ++i) { + for (uint256 i = 0; i < buffer.length; ++i) { bytes1 char = bytes1(_unsafeReadBytesOffset(buffer, i)); if (((SPECIAL_CHARS_LOOKUP & (1 << uint8(char))) != 0)) { output[outputLength++] = "\\"; diff --git a/contracts/utils/cryptography/ECDSA.sol b/contracts/utils/cryptography/ECDSA.sol index 22544c4a66b..cec4e839711 100644 --- a/contracts/utils/cryptography/ECDSA.sol +++ b/contracts/utils/cryptography/ECDSA.sol @@ -54,6 +54,7 @@ library ECDSA { * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: + * * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ diff --git a/contracts/utils/cryptography/README.adoc b/contracts/utils/cryptography/README.adoc index 6c222d7c6ba..270306f65ed 100644 --- a/contracts/utils/cryptography/README.adoc +++ b/contracts/utils/cryptography/README.adoc @@ -1,7 +1,7 @@ = Cryptography [.readme-notice] -NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils/cryptography +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils#cryptography A collection of contracts and libraries that implement various signature validation schemes and cryptographic primitives. These utilities enable secure authentication, multisignature operations, and advanced cryptographic operations in smart contracts. diff --git a/contracts/utils/cryptography/draft-ERC7739Utils.sol b/contracts/utils/cryptography/draft-ERC7739Utils.sol index e47f20b4114..368c801eb3a 100644 --- a/contracts/utils/cryptography/draft-ERC7739Utils.sol +++ b/contracts/utils/cryptography/draft-ERC7739Utils.sol @@ -58,7 +58,7 @@ library ERC7739Utils { * - `APP_DOMAIN_SEPARATOR` is the EIP-712 {EIP712-_domainSeparatorV4} of the application smart contract that is * requesting the signature verification (though ERC-1271). * - `contentsHash` is the hash of the underlying data structure or message. - * - `contentsDescr` is a descriptor of the "contents" part of the the EIP-712 type of the nested signature. + * - `contentsDescr` is a descriptor of the "contents" part of the EIP-712 type of the nested signature. * * NOTE: This function returns empty if the input format is invalid instead of reverting. * data instead. diff --git a/contracts/utils/math/Math.sol b/contracts/utils/math/Math.sol index bd52cba644e..d7fd2f64d15 100644 --- a/contracts/utils/math/Math.sol +++ b/contracts/utils/math/Math.sol @@ -134,10 +134,10 @@ library Math { } /** - * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant. + * @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant. * * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone. - * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute + * However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute * one branch when needed, making this function more expensive. */ function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) { diff --git a/docs/modules/ROOT/pages/access-control.adoc b/docs/modules/ROOT/pages/access-control.adoc index 57d26bc0814..9bfc9af10dc 100644 --- a/docs/modules/ROOT/pages/access-control.adoc +++ b/docs/modules/ROOT/pages/access-control.adoc @@ -123,7 +123,7 @@ There is an additional feature built on top of `AccessControl`: giving the execu At this point, with both a proposer and an executor assigned, the timelock can perform operations. -An optional next step is for the deployer to renounce its administrative privileges and leave the timelock self-administered. If the deployer decides to do so, all further maintenance, including assigning new proposers/schedulers or changing the timelock duration will have to follow the timelock workflow. This links the governance of the timelock to the governance of contracts attached to the timelock, and enforce a delay on timelock maintenance operations. +An optional next step is for the deployer to renounce its administrative privileges and leave the timelock self-administered. If the deployer decides to do so, all further maintenance, including assigning new proposers/schedulers or changing the timelock duration will have to follow the timelock workflow. This links the governance of the timelock to the governance of contracts attached to the timelock, and enforces a delay on timelock maintenance operations. WARNING: If the deployer renounces administrative rights in favour of timelock itself, assigning new proposers or executors will require a timelocked operation. This means that if the accounts in charge of any of these two roles become unavailable, then the entire contract (and any contract it controls) becomes locked indefinitely. diff --git a/docs/modules/ROOT/pages/account-abstraction.adoc b/docs/modules/ROOT/pages/account-abstraction.adoc index 82fc65e295a..83b5f67db84 100644 --- a/docs/modules/ROOT/pages/account-abstraction.adoc +++ b/docs/modules/ROOT/pages/account-abstraction.adoc @@ -28,7 +28,7 @@ struct PackedUserOperation { This process of bundling user operations involves several costs that the bundler must cover, including base transaction fees, calldata serialization, entrypoint execution, and paymaster context costs. To compensate for these expenses, bundlers use the `preVerificationGas` and `gasFees` fields to charge users appropriately. -NOTE: Estimating `preVerificationGas` is not standardized as it varies based on network conditions such as gas prices and the size of the operation bundle. +NOTE: Estimating `preVerificationGas` is not standardized as it varies based on factors like calldata size, signature complexity, and bundler-specific serialization costs. TIP: Use xref:api:account.adoc#ERC4337Utils[`ERC4337Utils`] to manipulate the `UserOperation` struct and other ERC-4337 related values. @@ -36,7 +36,7 @@ TIP: Use xref:api:account.adoc#ERC4337Utils[`ERC4337Utils`] to manipulate the `U Each `UserOperation` is executed through a contract known as the https://etherscan.io/address/0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108#code[`EntryPoint`]. This contract is a singleton deployed across multiple networks at the same address although other custom implementations may be used. -The Entrypoint contracts is considered a trusted entity by the account. +The Entrypoint contract is considered a trusted entity by the account. === Bundlers @@ -83,7 +83,7 @@ To build your own factory, see xref:accounts.adoc#accounts_factory[account facto === Paymaster Contract -A Paymaster is an optional entity that can sponsor gas fees for Accounts, or allow them to pay for those fees in ERC-20 instead of native currency. This abstracts gas away of the user experience in the same way that computational costs of cloud servers are abstracted away from end-users. +A Paymaster is an optional entity that can sponsor gas fees for Accounts, or allow them to pay for those fees in ERC-20 instead of native currency. This abstracts gas away from the user experience in the same way that computational costs of cloud servers are abstracted away from end-users. To build your own paymaster, see https://docs.openzeppelin.com/community-contracts/0.0.1/paymasters[paymasters]. @@ -95,6 +95,6 @@ To process a bundle of `UserOperations`, bundlers call xref:api:account.adoc#Acc These rules outline the requirements for operations to be processed by the canonical mempool. -Accounts can access its own storage during the validation phase, they might easily violate ERC-7562 storage access rules in undirect ways. For example, most accounts access their public keys from storage when validating a signature, limiting the ability of having accounts that validate operations for other accounts (e.g. via ERC-1271) +Accounts can access their own storage during the validation phase, they might easily violate ERC-7562 storage access rules in indirect ways. For example, most accounts access their public keys from storage when validating a signature, limiting the ability of having accounts that validate operations for other accounts (e.g. via https://eips.ethereum.org/EIPS/eip-1271[ERC-1271])) TIP: Although any Account that breaks such rules may still be processed by a private bundler, developers should keep in mind the centralization tradeoffs of relying on private infrastructure instead of _permissionless_ execution. diff --git a/docs/modules/ROOT/pages/utilities.adoc b/docs/modules/ROOT/pages/utilities.adoc index f0114726f2f..e2c8772fa2a 100644 --- a/docs/modules/ROOT/pages/utilities.adoc +++ b/docs/modules/ROOT/pages/utilities.adoc @@ -263,7 +263,7 @@ Some use cases require more powerful data structures than arrays and mappings of - xref:api:utils.adoc#EnumerableSet[`EnumerableSet`]: A https://en.wikipedia.org/wiki/Set_(abstract_data_type)[set] with enumeration capabilities. - xref:api:utils.adoc#EnumerableMap[`EnumerableMap`]: A `mapping` variant with enumeration capabilities. - xref:api:utils.adoc#MerkleTree[`MerkleTree`]: An on-chain https://wikipedia.org/wiki/Merkle_Tree[Merkle Tree] with helper functions. -- xref:api:utils.adoc#Heap.sol[`Heap`]: A https://en.wikipedia.org/wiki/Binary_heap[binary heap] to store elements with priority defined by a compartor function. +- xref:api:utils.adoc#Heap.sol[`Heap`]: A https://en.wikipedia.org/wiki/Binary_heap[binary heap] to store elements with priority defined by a comparator function. The `Enumerable*` structures are similar to mappings in that they store and remove elements in constant time and don't allow for repeated entries, but they also support _enumeration_, which means you can easily query all stored entries both on and off-chain. diff --git a/scripts/generate/templates/SlotDerivation.js b/scripts/generate/templates/SlotDerivation.js index a00e98167f6..931c9fc25e8 100644 --- a/scripts/generate/templates/SlotDerivation.js +++ b/scripts/generate/templates/SlotDerivation.js @@ -17,7 +17,7 @@ pragma solidity ^0.8.20; * contract Example { * // Add the library methods * using StorageSlot for bytes32; - * using SlotDerivation for bytes32; + * using SlotDerivation for *; * * // Declare a namespace * string private constant _NAMESPACE = ""; // eg. OpenZeppelin.Slot diff --git a/test/governance/TimelockController.test.js b/test/governance/TimelockController.test.js index 08410d46081..f58240e5047 100644 --- a/test/governance/TimelockController.test.js +++ b/test/governance/TimelockController.test.js @@ -418,7 +418,7 @@ describe('TimelockController', function () { reentrantOperation.predecessor, reentrantOperation.salt, ]); - await reentrant.enableRentrancy(this.mock, data); + await reentrant.enableReentrancy(this.mock, data); // Expect to fail await expect( @@ -811,7 +811,7 @@ describe('TimelockController', function () { reentrantBatchOperation.predecessor, reentrantBatchOperation.salt, ]); - await reentrant.enableRentrancy(this.mock, data); + await reentrant.enableReentrancy(this.mock, data); // Expect to fail await expect(