Skip to content

Commit

Permalink
Merge branch 'master' into modular-exponentiation-precompile-wrapper-O…
Browse files Browse the repository at this point in the history
  • Loading branch information
mw2000 authored Dec 24, 2023
2 parents 98f7994 + abcf9dd commit f634aab
Show file tree
Hide file tree
Showing 243 changed files with 12,553 additions and 13,564 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-dodos-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---

`Math`: Optimized gas cost of `ceilDiv` by using `unchecked`.
6 changes: 0 additions & 6 deletions .changeset/dull-ghosts-sip.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/grumpy-poets-rush.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/purple-squids-attend.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/thirty-drinks-happen.md

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog


## 5.0.1 (2023-12-07)

- `ERC2771Context` and `Context`: Introduce a `_contextPrefixLength()` getter, used to trim extra information appended to `msg.data`.
- `Multicall`: Make aware of non-canonical context (i.e. `msg.sender` is not `_msgSender()`), allowing compatibility with `ERC2771Context`.

## 5.0.0 (2023-10-05)

### Additions Summary
Expand Down
7 changes: 7 additions & 0 deletions FUNDING.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"drips": {
"ethereum": {
"ownedBy": "0xAeb37910f93486C85A1F8F994b67E8187554d664"
}
}
}
2 changes: 1 addition & 1 deletion GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ In addition to the official Solidity Style Guide we have a number of other conve
}
```

Some standards (e.g. ERC20) use present tense, and in those cases the
Some standards (e.g. ERC-20) use present tense, and in those cases the
standard specification is used.

* Interface names should have a capital I prefix.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

:mage: **Not sure how to get started?** Check out [Contracts Wizard](https://wizard.openzeppelin.com/) — an interactive smart contract generator.

:building_construction: **Want to scale your decentralized application?** Check out [OpenZeppelin Defender](https://openzeppelin.com/defender) — a secure platform for automating and monitoring your operations.
:building_construction: **Want to scale your decentralized application?** Check out [OpenZeppelin Defender](https://openzeppelin.com/defender) — a mission-critical developer security platform to code, audit, deploy, monitor, and operate with confidence.

> [!IMPORTANT]
> OpenZeppelin Contracts uses semantic versioning to communicate backwards compatibility of its API and storage layout. For upgradeable contracts, the storage layout of different major versions should be assumed incompatible, for example, it is unsafe to upgrade from 4.9.3 to 5.0.0. Learn more at [Backwards Compatibility](https://docs.openzeppelin.com/contracts/backwards-compatibility).
Expand Down
9 changes: 5 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Security vulnerabilities should be disclosed to the project maintainers through

Responsible disclosure of security vulnerabilities is rewarded through a bug bounty program on [Immunefi].

There is a bonus reward for issues introduced in release candidates that are reported before making it into a stable release.
There is a bonus reward for issues introduced in release candidates that are reported before making it into a stable release. Learn more about release candidates at [`RELEASING.md`](./RELEASING.md).

## Security Patches

Expand All @@ -30,13 +30,14 @@ Only critical severity bug fixes will be backported to past major releases.

| Version | Critical security fixes | Other security fixes |
| ------- | ----------------------- | -------------------- |
| 4.x | :white_check_mark: | :white_check_mark: |
| 5.x | :white_check_mark: | :white_check_mark: |
| 4.9 | :white_check_mark: | :x: |
| 3.4 | :white_check_mark: | :x: |
| 2.5 | :white_check_mark: | :x: |
| 2.5 | :x: | :x: |
| < 2.0 | :x: | :x: |

Note as well that the Solidity language itself only guarantees security updates for the latest release.

## Legal

Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. Your use of the project is also governed by the terms found at www.openzeppelin.com/tos (the "Terms"). As set out in the Terms, you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an on-going duty by any contributor, including OpenZeppelin, to correct any flaws or alert you to all or any of the potential risks of utilizing the project.
Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. Your use of the project is also governed by the terms found at www.openzeppelin.com/tos (the "Terms"). As set out in the Terms, you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an on-going duty by any contributor, including OpenZeppelin, to correct any flaws or alert you to all or any of the potential risks of utilizing the project.
2 changes: 1 addition & 1 deletion certora/specs/ERC20FlashMint.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "methods/IERC3156FlashLender.spec";
import "methods/IERC3156FlashBorrower.spec";

methods {
// non standard ERC3156 functions
// non standard ERC-3156 functions
function flashFeeReceiver() external returns (address) envfree;

// function summaries below
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/IAccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pragma solidity ^0.8.20;

/**
* @dev External interface of AccessControl declared to support ERC165 detection.
* @dev External interface of AccessControl declared to support ERC-165 detection.
*/
interface IAccessControl {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma solidity ^0.8.20;
import {IAccessControl} from "../IAccessControl.sol";

/**
* @dev External interface of AccessControlDefaultAdminRules declared to support ERC165 detection.
* @dev External interface of AccessControlDefaultAdminRules declared to support ERC-165 detection.
*/
interface IAccessControlDefaultAdminRules is IAccessControl {
/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/extensions/IAccessControlEnumerable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma solidity ^0.8.20;
import {IAccessControl} from "../IAccessControl.sol";

/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
* @dev External interface of AccessControlEnumerable declared to support ERC-165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/finance/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/

This directory includes primitives for financial systems:

- {VestingWallet} handles the vesting of Ether and ERC20 tokens for a given beneficiary. Custody of multiple tokens can
- {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.
Expand Down
4 changes: 2 additions & 2 deletions contracts/finance/VestingWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Context} from "../utils/Context.sol";
import {Ownable} from "../access/Ownable.sol";

/**
* @dev A vesting wallet is an ownable contract that can receive native currency and ERC20 tokens, and release these
* @dev A vesting wallet is an ownable contract that can receive native currency and ERC-20 tokens, and release these
* assets to the wallet owner, also referred to as "beneficiary", according to a vesting schedule.
*
* Any assets transferred to this contract will follow the vesting schedule as if they were locked from the beginning.
Expand Down Expand Up @@ -94,7 +94,7 @@ contract VestingWallet is Context, Ownable {

/**
* @dev Getter for the amount of releasable `token` tokens. `token` should be the address of an
* IERC20 contract.
* {IERC20} contract.
*/
function releasable(address token) public view virtual returns (uint256) {
return vestedAmount(token, uint64(block.timestamp)) - released(token);
Expand Down
14 changes: 10 additions & 4 deletions contracts/governance/IGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ interface IGovernor is IERC165, IERC6372 {

/**
* @notice module:core
* @dev Name of the governor instance (used in building the ERC712 domain separator).
* @dev Name of the governor instance (used in building the EIP-712 domain separator).
*/
function name() external view returns (string memory);

/**
* @notice module:core
* @dev Version of the governor instance (used in building the ERC712 domain separator). Default: "1"
* @dev Version of the governor instance (used in building the EIP-712 domain separator). Default: "1"
*/
function version() external view returns (string memory);

Expand Down Expand Up @@ -254,7 +254,7 @@ interface IGovernor is IERC165, IERC6372 {
/**
* @notice module:user-config
* @dev Delay, between the proposal is created and the vote starts. The unit this duration is expressed in depends
* on the clock (see EIP-6372) this contract uses.
* on the clock (see ERC-6372) this contract uses.
*
* This can be increased to leave time for users to buy voting power, or delegate it, before the voting of a
* proposal starts.
Expand All @@ -267,7 +267,7 @@ interface IGovernor is IERC165, IERC6372 {
/**
* @notice module:user-config
* @dev Delay between the vote start and vote end. The unit this duration is expressed in depends on the clock
* (see EIP-6372) this contract uses.
* (see ERC-6372) this contract uses.
*
* NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting
* duration compared to the voting delay.
Expand Down Expand Up @@ -317,6 +317,12 @@ interface IGovernor is IERC165, IERC6372 {
* duration specified by {IGovernor-votingPeriod}.
*
* Emits a {ProposalCreated} event.
*
* NOTE: The state of the Governor and `targets` may change between the proposal creation and its execution.
* This may be the result of third party actions on the targeted contracts, or other governor proposals.
* For example, the balance of this contract could be updated or its access control permissions may be modified,
* possibly compromising the proposal's ability to execute successfully (e.g. the governor doesn't have enough
* value to cover a proposal with multiple transfers).
*/
function propose(
address[] memory targets,
Expand Down
6 changes: 3 additions & 3 deletions contracts/governance/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Other extensions can customize the behavior or interface in multiple ways.

In addition to modules and extensions, the core contract requires a few virtual functions to be implemented to your particular specifications:

* <<Governor-votingDelay-,`votingDelay()`>>: Delay (in EIP-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.
* <<Governor-votingPeriod-,`votingPeriod()`>>: Delay (in EIP-6372 clock) since the proposal starts until voting ends.
* <<Governor-quorum-uint256-,`quorum(uint256 timepoint)`>>: Quorum required for a proposal to be successful. This function includes a `timepoint` argument (see EIP-6372) so the quorum can adapt through time, for example, to follow a token's `totalSupply`.
* <<Governor-votingDelay-,`votingDelay()`>>: 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.
* <<Governor-votingPeriod-,`votingPeriod()`>>: Delay (in ERC-6372 clock) since the proposal starts until voting ends.
* <<Governor-quorum-uint256-,`quorum(uint256 timepoint)`>>: Quorum required for a proposal to be successful. This function includes a `timepoint` argument (see ERC-6372) so the quorum can adapt through time, for example, to follow a token's `totalSupply`.

NOTE: Functions of the `Governor` contract do not include access control. If you want to restrict access, you should add these checks by overloading the particular functions. Among these, {Governor-_cancel} is internal by default, and you will have to expose it (with the right access control mechanism) yourself if this function is needed.

Expand Down
6 changes: 3 additions & 3 deletions contracts/governance/extensions/GovernorVotes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ abstract contract GovernorVotes is Governor {
}

/**
* @dev Clock (as specified in EIP-6372) is set to match the token's clock. Fallback to block numbers if the token
* does not implement EIP-6372.
* @dev Clock (as specified in ERC-6372) is set to match the token's clock. Fallback to block numbers if the token
* does not implement ERC-6372.
*/
function clock() public view virtual override returns (uint48) {
try token().clock() returns (uint48 timepoint) {
Expand All @@ -40,7 +40,7 @@ abstract contract GovernorVotes is Governor {
}

/**
* @dev Machine-readable description of the clock as specified in EIP-6372.
* @dev Machine-readable description of the clock as specified in ERC-6372.
*/
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public view virtual override returns (string memory) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/utils/Votes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ abstract contract Votes is Context, EIP712, Nonces, IERC5805 {
}

/**
* @dev Machine-readable description of the clock as specified in EIP-6372.
* @dev Machine-readable description of the clock as specified in ERC-6372.
*/
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public view virtual returns (string memory) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC1271.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pragma solidity ^0.8.20;

/**
* @dev Interface of the ERC1271 standard signature validation method for
* @dev Interface of the ERC-1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*/
interface IERC1271 {
Expand Down
6 changes: 3 additions & 3 deletions contracts/interfaces/IERC1363.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
* @dev Interface of an ERC1363 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1363[EIP].
* @dev Interface of an ERC-1363 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1363[ERC].
*
* Defines a interface for ERC20 tokens that supports executing recipient
* Defines a interface for ERC-20 tokens that supports executing recipient
* code after `transfer` or `transferFrom`, or spender code after `approve`.
*/
interface IERC1363 is IERC165, IERC20 {
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IERC1363Receiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ interface IERC1363Receiver {
*/

/**
* @notice Handle the receipt of ERC1363 tokens
* @dev Any ERC1363 smart contract calls this function on the recipient
* @notice Handle the receipt of ERC-1363 tokens
* @dev Any ERC-1363 smart contract calls this function on the recipient
* after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the
* transfer. Return of other than the magic value MUST result in the
* transaction being reverted.
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IERC1363Spender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ interface IERC1363Spender {
*/

/**
* @notice Handle the approval of ERC1363 tokens
* @dev Any ERC1363 smart contract calls this function on the recipient
* @notice Handle the approval of ERC-1363 tokens
* @dev Any ERC-1363 smart contract calls this function on the recipient
* after an `approve`. This function MAY throw to revert and reject the
* approval. Return of other than the magic value MUST result in the
* transaction being reverted.
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IERC1820Implementer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pragma solidity ^0.8.20;

/**
* @dev Interface for an ERC1820 implementer, as defined in the
* https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP].
* @dev Interface for an ERC-1820 implementer, as defined in the
* https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[ERC].
* Used by contracts that will be registered as implementers in the
* {IERC1820Registry}.
*/
Expand Down
20 changes: 10 additions & 10 deletions contracts/interfaces/IERC1820Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pragma solidity ^0.8.20;

/**
* @dev Interface of the global ERC1820 Registry, as defined in the
* https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register
* @dev Interface of the global ERC-1820 Registry, as defined in the
* https://eips.ethereum.org/EIPS/eip-1820[ERC]. Accounts may register
* implementers for interfaces in this registry, as well as query support.
*
* Implementers may be shared by multiple accounts, and can also implement more
Expand All @@ -15,7 +15,7 @@ pragma solidity ^0.8.20;
*
* {IERC165} interfaces can also be queried via the registry.
*
* For an in-depth explanation and source code analysis, see the EIP text.
* For an in-depth explanation and source code analysis, see the ERC text.
*/
interface IERC1820Registry {
event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);
Expand Down Expand Up @@ -80,32 +80,32 @@ interface IERC1820Registry {
/**
* @dev Returns the interface hash for an `interfaceName`, as defined in the
* corresponding
* https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].
* https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the ERC].
*/
function interfaceHash(string calldata interfaceName) external pure returns (bytes32);

/**
* @notice Updates the cache with whether the contract implements an ERC165 interface or not.
* @notice Updates the cache with whether the contract implements an ERC-165 interface or not.
* @param account Address of the contract for which to update the cache.
* @param interfaceId ERC165 interface for which to update the cache.
* @param interfaceId ERC-165 interface for which to update the cache.
*/
function updateERC165Cache(address account, bytes4 interfaceId) external;

/**
* @notice Checks whether a contract implements an ERC165 interface or not.
* @notice Checks whether a contract implements an ERC-165 interface or not.
* If the result is not cached a direct lookup on the contract address is performed.
* If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling
* {updateERC165Cache} with the contract address.
* @param account Address of the contract to check.
* @param interfaceId ERC165 interface to check.
* @param interfaceId ERC-165 interface to check.
* @return True if `account` implements `interfaceId`, false otherwise.
*/
function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);

/**
* @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache.
* @notice Checks whether a contract implements an ERC-165 interface or not without using or updating the cache.
* @param account Address of the contract to check.
* @param interfaceId ERC165 interface to check.
* @param interfaceId ERC-165 interface to check.
* @return True if `account` implements `interfaceId`, false otherwise.
*/
function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC3156FlashBorrower.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pragma solidity ^0.8.20;

/**
* @dev Interface of the ERC3156 FlashBorrower, as defined in
* @dev Interface of the ERC-3156 FlashBorrower, as defined in
* https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
*/
interface IERC3156FlashBorrower {
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC3156FlashLender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma solidity ^0.8.20;
import {IERC3156FlashBorrower} from "./IERC3156FlashBorrower.sol";

/**
* @dev Interface of the ERC3156 FlashLender, as defined in
* @dev Interface of the ERC-3156 FlashLender, as defined in
* https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
*/
interface IERC3156FlashLender {
Expand Down
Loading

0 comments on commit f634aab

Please sign in to comment.