diff --git a/.changeset/brave-islands-sparkle.md b/.changeset/brave-islands-sparkle.md deleted file mode 100644 index 54cd6fb3a..000000000 --- a/.changeset/brave-islands-sparkle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`GovernorSequentialProposalId`: Adds a `Governor` extension that sequentially numbers proposal ids instead of using the hash. diff --git a/.changeset/brown-seals-sing.md b/.changeset/brown-seals-sing.md deleted file mode 100644 index 7f4cff3dc..000000000 --- a/.changeset/brown-seals-sing.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`SafeERC20`: Add `trySafeTransfer` and `trySafeTransferFrom` that do not revert and return false if the transfer is not successful. diff --git a/.changeset/brown-turkeys-marry.md b/.changeset/brown-turkeys-marry.md deleted file mode 100644 index e44826d7c..000000000 --- a/.changeset/brown-turkeys-marry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`ERC6909TokenSupply`: Add an extension of ERC6909 which tracks total supply for each token id. diff --git a/.changeset/cyan-taxis-travel.md b/.changeset/cyan-taxis-travel.md deleted file mode 100644 index bd90e07f3..000000000 --- a/.changeset/cyan-taxis-travel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`Address`: bubble up revert data on `sendValue` failed call diff --git a/.changeset/dirty-bananas-shake.md b/.changeset/dirty-bananas-shake.md deleted file mode 100644 index 4e10a427c..000000000 --- a/.changeset/dirty-bananas-shake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`ERC6909ContentURI`: Add an extension of ERC6909 which adds content URI functionality. diff --git a/.changeset/famous-timers-compare.md b/.changeset/famous-timers-compare.md deleted file mode 100644 index 2c8d18487..000000000 --- a/.changeset/famous-timers-compare.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`ERC2771Forwarder`: Expose the `_isTrustedByTarget` internal function to check whether a target trusts the forwarder. diff --git a/.changeset/good-cameras-rush.md b/.changeset/good-cameras-rush.md deleted file mode 100644 index ebe663c7a..000000000 --- a/.changeset/good-cameras-rush.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`EnumerableMap`: Add `clear` function to EnumerableMaps which deletes all entries in the map. diff --git a/.changeset/good-cameras-serve.md b/.changeset/good-cameras-serve.md deleted file mode 100644 index 1f1895504..000000000 --- a/.changeset/good-cameras-serve.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openzeppelin-solidity": minor ---- - -`Calldata`: Library with `emptyBytes` and `emptyString` functions to generate empty `bytes` and `string` calldata types. diff --git a/.changeset/green-drinks-report.md b/.changeset/green-drinks-report.md deleted file mode 100644 index 983062cbb..000000000 --- a/.changeset/green-drinks-report.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"openzeppelin-solidity": minor ---- - -`Pausable`: Stop explicitly setting `paused` to `false` during construction. diff --git a/.changeset/long-walls-draw.md b/.changeset/long-walls-draw.md deleted file mode 100644 index 724515210..000000000 --- a/.changeset/long-walls-draw.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`IERC6909`: Add the interface for ERC-6909. diff --git a/.changeset/pretty-lobsters-tan.md b/.changeset/pretty-lobsters-tan.md deleted file mode 100644 index d3b8644ff..000000000 --- a/.changeset/pretty-lobsters-tan.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`GovernorProposalGuardian`: Add a governance extension that defines a proposal guardian who can cancel proposals at any stage in their lifecycle. diff --git a/.changeset/proud-cooks-do.md b/.changeset/proud-cooks-do.md deleted file mode 100644 index e3d4331ae..000000000 --- a/.changeset/proud-cooks-do.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`ERC6909Metadata`: Add an extension of ERC6909 which adds metadata functionality. diff --git a/.changeset/seven-insects-taste.md b/.changeset/seven-insects-taste.md deleted file mode 100644 index bfa8737d7..000000000 --- a/.changeset/seven-insects-taste.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': patch ---- - -`ERC7579Utils`: Add ABI decoding checks on calldata bounds within `decodeBatch` diff --git a/.changeset/sixty-tips-wink.md b/.changeset/sixty-tips-wink.md deleted file mode 100644 index 35c14cb89..000000000 --- a/.changeset/sixty-tips-wink.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`EnumerableSet`: Add `clear` function to EnumerableSets which deletes all values in the set. diff --git a/.changeset/ten-fishes-fold.md b/.changeset/ten-fishes-fold.md deleted file mode 100644 index 5c87ff363..000000000 --- a/.changeset/ten-fishes-fold.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`IGovernor`: Add the `getProposalId` function to the governor interface. diff --git a/.changeset/ten-hats-begin.md b/.changeset/ten-hats-begin.md deleted file mode 100644 index bb7ab77e2..000000000 --- a/.changeset/ten-hats-begin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`ERC6909`: Add a standard implementation of ERC6909. diff --git a/.changeset/ten-peas-mix.md b/.changeset/ten-peas-mix.md deleted file mode 100644 index 4e7ae24b0..000000000 --- a/.changeset/ten-peas-mix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': minor ---- - -`Hashes`: Expose `efficientKeccak256` for hashing non-commutative pairs of bytes32 without allocating extra memory. diff --git a/.changeset/thin-eels-cross.md b/.changeset/thin-eels-cross.md deleted file mode 100644 index 7993d7d64..000000000 --- a/.changeset/thin-eels-cross.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'openzeppelin-solidity': patch ---- - -`ERC4626`: Use the `asset` getter in `totalAssets`, `_deposit` and `_withdraw`. diff --git a/CHANGELOG.md b/CHANGELOG.md index b30b61e5a..0d6e04e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,63 @@ # Changelog +## 5.3.0 (2025-04-09) + ### Breaking Changes - Replace `GovernorCountingOverridable.VoteReceipt` struct parameter member names `hasOverriden` and `overridenWeight` for `hasOverridden` and `overriddenWeight` respectively. #### Custom error changes -- Replace `GovernorAlreadyOverridenVote` with `GovernorAlreadyOverriddenVote`. - Replace `AccessControlNonRevokable` with `AccessControlNonRevocable`. +- Replace `GovernorAlreadyOverridenVote` with `GovernorAlreadyOverriddenVote`. +- Replace `GovernorOnlyProposer` with `GovernorUnableToCancel`. + +### Changes by category + +#### Account + +- `ERC4337Utils`: Update the `hash` function to call `getUserOpHash` on the specified entrypoint and add an `ENTRYPOINT_V08` constant. ([#5614](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5614)) +- `ERC7579Utils`: Add ABI decoding checks on calldata bounds within `decodeBatch`. ([#5371](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5371)) +- `ERC7579Utils`: Replace `address(0)` with `address(this)` during execution for calldata compression efficiency. ([#5614](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5614)) + +#### Governance + +- `IGovernor`: Add the `getProposalId` function to the governor interface. ([#5290](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5290)) +- `GovernorProposalGuardian`: Add a governance extension that defines a proposal guardian who can cancel proposals at any stage in their lifecycle. ([#5303](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5303)) +- `GovernorSequentialProposalId`: Adds a `Governor` extension that sequentially numbers proposal ids instead of using the hash. ([#5290](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5290)) +- `GovernorSuperQuorum`: Add a governance extension to support 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. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) +- `GovernorVotesSuperQuorumFraction`: Add a variant of the `GovernorSuperQuorum` extensions where the super quorum is expressed as a fraction of the total supply. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) +- `TimelockController`: Receive function is now virtual. ([#5509](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5509)) + +#### Structures + +- `EnumerableSet`: Add `clear` function to EnumerableSets which deletes all values in the set. ([#5486](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5486)) +- `EnumerableMap`: Add `clear` function to EnumerableMaps which deletes all entries in the map. ([#5486](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5486)) +- `MerkleTree`: Add an update function that replaces a previously inserted leaf with a new value, updating the tree root along the way. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) + +#### Tokens + +- `ERC4626`: Use the `asset` getter in `totalAssets`, `_deposit` and `_withdraw`. ([#5322](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5322)) +- `IERC6909`: Add the interface for ERC-6909. ([#5343](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5343)) +- `ERC6909`: Add a standard implementation of ERC6909. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394)) +- `ERC6909TokenSupply`: Add an extension of ERC6909 which tracks total supply for each token id. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394)) +- `ERC6909Metadata`: Add an extension of ERC6909 which adds metadata functionality. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394)) +- `ERC6909ContentURI`: Add an extension of ERC6909 which adds content URI functionality. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394)) +- `SafeERC20`: Add `trySafeTransfer` and `trySafeTransferFrom` that do not revert and return false if the transfer is not successful. ([#5483](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5483)) + +#### Other + +- `Address`: bubble up revert data on `sendValue` failed call. ([#5379](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5379)) +- `Calldata`: Library with `emptyBytes` and `emptyString` functions to generate empty `bytes` and `string` calldata types. ([#5422](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5422)) +- `ERC2771Forwarder`: Expose the `_isTrustedByTarget` internal function to check whether a target trusts the forwarder. ([#5416](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5416)) +- `Hashes`: Expose `efficientKeccak256` for hashing non-commutative pairs of bytes32 without allocating extra memory. ([#5442](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5442)) +- `Initializable`: Add `_initializableStorageSlot` function that returns a pointer to the storage struct. The function allows customizing with a custom storage slot with an `override`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) +- `Math`: Add `add512`, `mul512` and `mulShr`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) +- `Math`: Add saturating arithmetic operations `saturatingAdd`, `saturatingSub` and `saturatingMul`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) +- `MessageHashUtils`: Add `toDataWithIntendedValidatorHash(address, bytes32)`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) +- `P256`: Adjust precompile detection in `verifyNative` to consider empty `returndata` on invalid verification. Previously, invalid signatures would've reverted with a `MissingPrecompile` error in chains with RIP-7212 support. ([#5620](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5620)) +- `Pausable`: Stop explicitly setting `paused` to `false` during construction. ([#5448](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5448)) +- `Strings`: Add `espaceJSON` that escapes special characters in JSON strings. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526)) ## 5.2.0 (2025-01-08) diff --git a/contracts/access/AccessControl.sol b/contracts/access/AccessControl.sol index 1c3807bc5..aa6645532 100644 --- a/contracts/access/AccessControl.sol +++ b/contracts/access/AccessControl.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (access/AccessControl.sol) pragma solidity ^0.8.20; diff --git a/contracts/access/IAccessControl.sol b/contracts/access/IAccessControl.sol index df3e7e747..f6dc00d61 100644 --- a/contracts/access/IAccessControl.sol +++ b/contracts/access/IAccessControl.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; diff --git a/contracts/access/manager/AuthorityUtils.sol b/contracts/access/manager/AuthorityUtils.sol index 61cf0407c..8b0470968 100644 --- a/contracts/access/manager/AuthorityUtils.sol +++ b/contracts/access/manager/AuthorityUtils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/AuthorityUtils.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (access/manager/AuthorityUtils.sol) pragma solidity ^0.8.20; @@ -26,6 +26,10 @@ library AuthorityUtils { if staticcall(gas(), authority, add(data, 0x20), mload(data), 0x00, 0x40) { immediate := mload(0x00) delay := mload(0x20) + + // If delay does not fit in a uint32, return 0 (no delay) + // equivalent to: if gt(delay, 0xFFFFFFFF) { delay := 0 } + delay := mul(delay, iszero(shr(32, delay))) } } } diff --git a/contracts/account/utils/draft-ERC4337Utils.sol b/contracts/account/utils/draft-ERC4337Utils.sol index fda29dc83..6d2c8ccca 100644 --- a/contracts/account/utils/draft-ERC4337Utils.sol +++ b/contracts/account/utils/draft-ERC4337Utils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (account/utils/draft-ERC4337Utils.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (account/utils/draft-ERC4337Utils.sol) pragma solidity ^0.8.20; diff --git a/contracts/account/utils/draft-ERC7579Utils.sol b/contracts/account/utils/draft-ERC7579Utils.sol index c0b02edb3..027d00df4 100644 --- a/contracts/account/utils/draft-ERC7579Utils.sol +++ b/contracts/account/utils/draft-ERC7579Utils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (account/utils/draft-ERC7579Utils.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (account/utils/draft-ERC7579Utils.sol) pragma solidity ^0.8.20; diff --git a/contracts/finance/VestingWallet.sol b/contracts/finance/VestingWallet.sol index 314ddd7d9..03024fae7 100644 --- a/contracts/finance/VestingWallet.sol +++ b/contracts/finance/VestingWallet.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (finance/VestingWallet.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (finance/VestingWallet.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol"; diff --git a/contracts/governance/Governor.sol b/contracts/governance/Governor.sol index e89e749ad..c0f7a8b48 100644 --- a/contracts/governance/Governor.sol +++ b/contracts/governance/Governor.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (governance/Governor.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/Governor.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/IGovernor.sol b/contracts/governance/IGovernor.sol index 702d2beb7..d51e7deb2 100644 --- a/contracts/governance/IGovernor.sol +++ b/contracts/governance/IGovernor.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (governance/IGovernor.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/IGovernor.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/TimelockController.sol b/contracts/governance/TimelockController.sol index d2ba17016..b8e4bfae6 100644 --- a/contracts/governance/TimelockController.sol +++ b/contracts/governance/TimelockController.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (governance/TimelockController.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/TimelockController.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorCountingFractional.sol b/contracts/governance/extensions/GovernorCountingFractional.sol index 743098494..2462227a0 100644 --- a/contracts/governance/extensions/GovernorCountingFractional.sol +++ b/contracts/governance/extensions/GovernorCountingFractional.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (governance/extensions/GovernorCountingFractional.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorCountingFractional.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorCountingOverridable.sol b/contracts/governance/extensions/GovernorCountingOverridable.sol index 43d1401db..bc06de96d 100644 --- a/contracts/governance/extensions/GovernorCountingOverridable.sol +++ b/contracts/governance/extensions/GovernorCountingOverridable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (governance/extensions/GovernorCountingOverridable.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorCountingOverridable.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorProposalGuardian.sol b/contracts/governance/extensions/GovernorProposalGuardian.sol index 339024a45..10821ff41 100644 --- a/contracts/governance/extensions/GovernorProposalGuardian.sol +++ b/contracts/governance/extensions/GovernorProposalGuardian.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorProposalGuardian.sol) pragma solidity ^0.8.20; import {Governor} from "../Governor.sol"; diff --git a/contracts/governance/extensions/GovernorSequentialProposalId.sol b/contracts/governance/extensions/GovernorSequentialProposalId.sol index 36e8698ba..8cfa5aa46 100644 --- a/contracts/governance/extensions/GovernorSequentialProposalId.sol +++ b/contracts/governance/extensions/GovernorSequentialProposalId.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorSequentialProposalId.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorStorage.sol b/contracts/governance/extensions/GovernorStorage.sol index 23d84ac52..914b77d9d 100644 --- a/contracts/governance/extensions/GovernorStorage.sol +++ b/contracts/governance/extensions/GovernorStorage.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (governance/extensions/GovernorStorage.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorStorage.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorSuperQuorum.sol b/contracts/governance/extensions/GovernorSuperQuorum.sol index b9a7c68e7..f10e8e13f 100644 --- a/contracts/governance/extensions/GovernorSuperQuorum.sol +++ b/contracts/governance/extensions/GovernorSuperQuorum.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorSuperQuorum.sol) pragma solidity ^0.8.20; import {Governor} from "../Governor.sol"; diff --git a/contracts/governance/extensions/GovernorTimelockAccess.sol b/contracts/governance/extensions/GovernorTimelockAccess.sol index 347b0f5af..c208c5a36 100644 --- a/contracts/governance/extensions/GovernorTimelockAccess.sol +++ b/contracts/governance/extensions/GovernorTimelockAccess.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (governance/extensions/GovernorTimelockAccess.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorTimelockAccess.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorTimelockCompound.sol b/contracts/governance/extensions/GovernorTimelockCompound.sol index f98edc836..e0f4f5571 100644 --- a/contracts/governance/extensions/GovernorTimelockCompound.sol +++ b/contracts/governance/extensions/GovernorTimelockCompound.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (governance/extensions/GovernorTimelockCompound.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorTimelockCompound.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorTimelockControl.sol b/contracts/governance/extensions/GovernorTimelockControl.sol index 56bd77ab3..02262cef7 100644 --- a/contracts/governance/extensions/GovernorTimelockControl.sol +++ b/contracts/governance/extensions/GovernorTimelockControl.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (governance/extensions/GovernorTimelockControl.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorTimelockControl.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorVotesQuorumFraction.sol b/contracts/governance/extensions/GovernorVotesQuorumFraction.sol index ddaf64f07..a72d9de2a 100644 --- a/contracts/governance/extensions/GovernorVotesQuorumFraction.sol +++ b/contracts/governance/extensions/GovernorVotesQuorumFraction.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (governance/extensions/GovernorVotesQuorumFraction.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorVotesQuorumFraction.sol) pragma solidity ^0.8.20; diff --git a/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol b/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol index 426738951..6686210e5 100644 --- a/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol +++ b/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (governance/extensions/GovernorVotesSuperQuorumFraction.sol) pragma solidity ^0.8.20; import {Governor} from "../Governor.sol"; @@ -61,6 +62,7 @@ abstract contract GovernorVotesSuperQuorumFraction is GovernorVotesQuorumFractio /** * @dev Returns the super quorum for a `timepoint`, in terms of number of votes: `supply * numerator / denominator`. + * See {GovernorSuperQuorum-superQuorum} for more details. */ function superQuorum(uint256 timepoint) public view virtual override returns (uint256) { return Math.mulDiv(token().getPastTotalSupply(timepoint), superQuorumNumerator(timepoint), quorumDenominator()); diff --git a/contracts/interfaces/IERC1271.sol b/contracts/interfaces/IERC1271.sol index 0111be61c..71e0b72b6 100644 --- a/contracts/interfaces/IERC1271.sol +++ b/contracts/interfaces/IERC1271.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1271.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (interfaces/IERC1271.sol) pragma solidity ^0.8.20; diff --git a/contracts/interfaces/IERC4626.sol b/contracts/interfaces/IERC4626.sol index 59b37715d..ce55f72e1 100644 --- a/contracts/interfaces/IERC4626.sol +++ b/contracts/interfaces/IERC4626.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC4626.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.20; diff --git a/contracts/interfaces/draft-IERC4337.sol b/contracts/interfaces/draft-IERC4337.sol index 1ccbfe469..62fbe4b64 100644 --- a/contracts/interfaces/draft-IERC4337.sol +++ b/contracts/interfaces/draft-IERC4337.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (interfaces/draft-IERC4337.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (interfaces/draft-IERC4337.sol) pragma solidity ^0.8.20; diff --git a/contracts/interfaces/draft-IERC6909.sol b/contracts/interfaces/draft-IERC6909.sol index 12151e886..c6d550d65 100644 --- a/contracts/interfaces/draft-IERC6909.sol +++ b/contracts/interfaces/draft-IERC6909.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (interfaces/draft-IERC6909.sol) pragma solidity ^0.8.20; @@ -49,7 +50,8 @@ interface IERC6909 is IERC165 { function isOperator(address owner, address spender) external view returns (bool); /** - * @dev Sets an approval to `spender` for `amount` tokens of type `id` from the caller's tokens. + * @dev Sets an approval to `spender` for `amount` of tokens of type `id` from the caller's tokens. An `amount` of + * `type(uint256).max` signifies an unlimited approval. * * Must return true. */ diff --git a/contracts/interfaces/draft-IERC7579.sol b/contracts/interfaces/draft-IERC7579.sol index ccb5bf88c..dbe991542 100644 --- a/contracts/interfaces/draft-IERC7579.sol +++ b/contracts/interfaces/draft-IERC7579.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (interfaces/draft-IERC7579.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (interfaces/draft-IERC7579.sol) pragma solidity ^0.8.20; import {PackedUserOperation} from "./draft-IERC4337.sol"; diff --git a/contracts/metatx/ERC2771Forwarder.sol b/contracts/metatx/ERC2771Forwarder.sol index 107878a50..a463e70e0 100644 --- a/contracts/metatx/ERC2771Forwarder.sol +++ b/contracts/metatx/ERC2771Forwarder.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (metatx/ERC2771Forwarder.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (metatx/ERC2771Forwarder.sol) pragma solidity ^0.8.20; diff --git a/contracts/mocks/AuthorityMock.sol b/contracts/mocks/AuthorityMock.sol index 4f3e1de3a..cd2356ec1 100644 --- a/contracts/mocks/AuthorityMock.sol +++ b/contracts/mocks/AuthorityMock.sol @@ -12,7 +12,7 @@ contract NotAuthorityMock is IAuthority { } contract AuthorityNoDelayMock is IAuthority { - bool _immediate; + bool private _immediate; function canCall( address /* caller */, @@ -28,14 +28,14 @@ contract AuthorityNoDelayMock is IAuthority { } contract AuthorityDelayMock { - bool _immediate; - uint32 _delay; + bool private _immediate; + uint256 private _delay; function canCall( address /* caller */, address /* target */, bytes4 /* selector */ - ) external view returns (bool immediate, uint32 delay) { + ) external view returns (bool immediate, uint256 delay) { return (_immediate, _delay); } @@ -43,7 +43,7 @@ contract AuthorityDelayMock { _immediate = immediate; } - function _setDelay(uint32 delay) external { + function _setDelay(uint256 delay) external { _delay = delay; } } diff --git a/contracts/package.json b/contracts/package.json index 3682eadeb..70ae73bc2 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -1,7 +1,7 @@ { "name": "@openzeppelin/contracts", "description": "Secure Smart Contract library for Solidity", - "version": "5.2.0", + "version": "5.3.0", "files": [ "**/*.sol", "/build/contracts/*.json", diff --git a/contracts/proxy/Clones.sol b/contracts/proxy/Clones.sol index 4050e2cc9..9bddf5116 100644 --- a/contracts/proxy/Clones.sol +++ b/contracts/proxy/Clones.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (proxy/Clones.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (proxy/Clones.sol) pragma solidity ^0.8.20; diff --git a/contracts/proxy/utils/Initializable.sol b/contracts/proxy/utils/Initializable.sol index c69e3ec97..0d05fdb0e 100644 --- a/contracts/proxy/utils/Initializable.sol +++ b/contracts/proxy/utils/Initializable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; diff --git a/contracts/proxy/utils/UUPSUpgradeable.sol b/contracts/proxy/utils/UUPSUpgradeable.sol index 8be137d8d..d0f58427f 100644 --- a/contracts/proxy/utils/UUPSUpgradeable.sol +++ b/contracts/proxy/utils/UUPSUpgradeable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (proxy/utils/UUPSUpgradeable.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.22; diff --git a/contracts/token/ERC1155/IERC1155.sol b/contracts/token/ERC1155/IERC1155.sol index 8b4fcb5bc..ea1c0daba 100644 --- a/contracts/token/ERC1155/IERC1155.sol +++ b/contracts/token/ERC1155/IERC1155.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/IERC1155.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC1155/utils/ERC1155Utils.sol b/contracts/token/ERC1155/utils/ERC1155Utils.sol index cac0d5a0e..346579393 100644 --- a/contracts/token/ERC1155/utils/ERC1155Utils.sol +++ b/contracts/token/ERC1155/utils/ERC1155Utils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/utils/ERC1155Utils.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC1155/utils/ERC1155Utils.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC20/ERC20.sol b/contracts/token/ERC20/ERC20.sol index 4cc6fcb28..13137bcf6 100644 --- a/contracts/token/ERC20/ERC20.sol +++ b/contracts/token/ERC20/ERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/ERC20.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC20/extensions/ERC4626.sol b/contracts/token/ERC20/extensions/ERC4626.sol index 569d54d8b..2dc89e988 100644 --- a/contracts/token/ERC20/extensions/ERC4626.sol +++ b/contracts/token/ERC20/extensions/ERC4626.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC4626.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/extensions/ERC4626.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol b/contracts/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol index 0d1b35723..357daa937 100644 --- a/contracts/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol +++ b/contracts/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/draft-ERC20TemporaryApproval.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/extensions/draft-ERC20TemporaryApproval.sol) pragma solidity ^0.8.24; diff --git a/contracts/token/ERC20/utils/SafeERC20.sol b/contracts/token/ERC20/utils/SafeERC20.sol index 347e2aa8b..883e8d30c 100644 --- a/contracts/token/ERC20/utils/SafeERC20.sol +++ b/contracts/token/ERC20/utils/SafeERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC6909/draft-ERC6909.sol b/contracts/token/ERC6909/draft-ERC6909.sol index e821d4b3b..6f5cdd6a8 100644 --- a/contracts/token/ERC6909/draft-ERC6909.sol +++ b/contracts/token/ERC6909/draft-ERC6909.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC6909/draft-ERC6909.sol) pragma solidity ^0.8.20; @@ -79,7 +80,7 @@ contract ERC6909 is Context, ERC165, IERC6909 { /** * @dev Creates `amount` of token `id` and assigns them to `account`, by transferring it from address(0). - * Relies on the `_update` mechanism + * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `from` set to the zero address. * @@ -93,10 +94,9 @@ contract ERC6909 is Context, ERC165, IERC6909 { } /** - * @dev Moves `amount` of token `id` from `from` to `to` without checking for approvals. - * - * This internal function is equivalent to {transfer}, and can be used to - * e.g. implement automatic token fees, slashing mechanisms, etc. + * @dev Moves `amount` of token `id` from `from` to `to` without checking for approvals. This function verifies + * that neither the sender nor the receiver are address(0), which means it cannot mint or burn tokens. + * Relies on the `_update` mechanism. * * Emits a {Transfer} event. * diff --git a/contracts/token/ERC6909/extensions/draft-ERC6909ContentURI.sol b/contracts/token/ERC6909/extensions/draft-ERC6909ContentURI.sol index 883994793..9d082c066 100644 --- a/contracts/token/ERC6909/extensions/draft-ERC6909ContentURI.sol +++ b/contracts/token/ERC6909/extensions/draft-ERC6909ContentURI.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC6909/extensions/draft-ERC6909ContentURI.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC6909/extensions/draft-ERC6909Metadata.sol b/contracts/token/ERC6909/extensions/draft-ERC6909Metadata.sol index 413286386..31efebe88 100644 --- a/contracts/token/ERC6909/extensions/draft-ERC6909Metadata.sol +++ b/contracts/token/ERC6909/extensions/draft-ERC6909Metadata.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC6909/extensions/draft-ERC6909Metadata.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC6909/extensions/draft-ERC6909TokenSupply.sol b/contracts/token/ERC6909/extensions/draft-ERC6909TokenSupply.sol index 476935f8f..0fd4c224a 100644 --- a/contracts/token/ERC6909/extensions/draft-ERC6909TokenSupply.sol +++ b/contracts/token/ERC6909/extensions/draft-ERC6909TokenSupply.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC6909/extensions/draft-ERC6909TokenSupply.sol) pragma solidity ^0.8.20; @@ -26,7 +27,7 @@ contract ERC6909TokenSupply is ERC6909, IERC6909TokenSupply { } if (to == address(0)) { unchecked { - // amount <= _balances[id][from] <= _totalSupplies[id] + // amount <= _balances[from][id] <= _totalSupplies[id] _totalSupplies[id] -= amount; } } diff --git a/contracts/token/ERC721/extensions/ERC721Consecutive.sol b/contracts/token/ERC721/extensions/ERC721Consecutive.sol index 4f2657744..0f3267364 100644 --- a/contracts/token/ERC721/extensions/ERC721Consecutive.sol +++ b/contracts/token/ERC721/extensions/ERC721Consecutive.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/extensions/ERC721Consecutive.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC721/extensions/ERC721Consecutive.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC721/extensions/ERC721URIStorage.sol b/contracts/token/ERC721/extensions/ERC721URIStorage.sol index 45fb7e529..bbb0d4c53 100644 --- a/contracts/token/ERC721/extensions/ERC721URIStorage.sol +++ b/contracts/token/ERC721/extensions/ERC721URIStorage.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/extensions/ERC721URIStorage.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/ERC721/utils/ERC721Utils.sol b/contracts/token/ERC721/utils/ERC721Utils.sol index c94b690c3..1ae7a600b 100644 --- a/contracts/token/ERC721/utils/ERC721Utils.sol +++ b/contracts/token/ERC721/utils/ERC721Utils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/utils/ERC721Utils.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC721/utils/ERC721Utils.sol) pragma solidity ^0.8.20; diff --git a/contracts/token/common/ERC2981.sol b/contracts/token/common/ERC2981.sol index 0c49a8527..9c25e9b37 100644 --- a/contracts/token/common/ERC2981.sol +++ b/contracts/token/common/ERC2981.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/common/ERC2981.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (token/common/ERC2981.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/Arrays.sol b/contracts/utils/Arrays.sol index d9db08c27..173331886 100644 --- a/contracts/utils/Arrays.sol +++ b/contracts/utils/Arrays.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/Arrays.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/Arrays.sol) // This file was procedurally generated from scripts/generate/templates/Arrays.js. pragma solidity ^0.8.20; diff --git a/contracts/utils/Calldata.sol b/contracts/utils/Calldata.sol index 60e0b08b0..41860b29f 100644 --- a/contracts/utils/Calldata.sol +++ b/contracts/utils/Calldata.sol @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.3.0) (utils/Calldata.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/Multicall.sol b/contracts/utils/Multicall.sol index c34c243e1..94222feb0 100644 --- a/contracts/utils/Multicall.sol +++ b/contracts/utils/Multicall.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.1) (utils/Multicall.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/Multicall.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/Pausable.sol b/contracts/utils/Pausable.sol index ffeab759f..68e7d2681 100644 --- a/contracts/utils/Pausable.sol +++ b/contracts/utils/Pausable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/ReentrancyGuardTransient.sol b/contracts/utils/ReentrancyGuardTransient.sol index 08cdbee53..a1318c86f 100644 --- a/contracts/utils/ReentrancyGuardTransient.sol +++ b/contracts/utils/ReentrancyGuardTransient.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuardTransient.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/ReentrancyGuardTransient.sol) pragma solidity ^0.8.24; diff --git a/contracts/utils/ShortStrings.sol b/contracts/utils/ShortStrings.sol index 2d61870cb..81d713d4b 100644 --- a/contracts/utils/ShortStrings.sol +++ b/contracts/utils/ShortStrings.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/ShortStrings.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/ShortStrings.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/SlotDerivation.sol b/contracts/utils/SlotDerivation.sol index 3507639e4..df23efa28 100644 --- a/contracts/utils/SlotDerivation.sol +++ b/contracts/utils/SlotDerivation.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/SlotDerivation.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/SlotDerivation.sol) // This file was procedurally generated from scripts/generate/templates/SlotDerivation.js. pragma solidity ^0.8.20; diff --git a/contracts/utils/Strings.sol b/contracts/utils/Strings.sol index 13d6e7b39..e5aa2c550 100644 --- a/contracts/utils/Strings.sol +++ b/contracts/utils/Strings.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.2.0) (utils/Strings.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/Strings.sol) pragma solidity ^0.8.20; @@ -438,6 +438,10 @@ library Strings { * @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata. * * WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped. + * + * NOTE: This function escapes all unicode characters, and not just the ones in ranges defined in section 2.5 of + * RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). ECMAScript's `JSON.parse` does recover escaped unicode + * characters that are not in this range, but other tooling may provide different results. */ function escapeJSON(string memory input) internal pure returns (string memory) { bytes memory buffer = bytes(input); diff --git a/contracts/utils/TransientSlot.sol b/contracts/utils/TransientSlot.sol index 9620eaa8f..f0caea13d 100644 --- a/contracts/utils/TransientSlot.sol +++ b/contracts/utils/TransientSlot.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/TransientSlot.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/TransientSlot.sol) // This file was procedurally generated from scripts/generate/templates/TransientSlot.js. pragma solidity ^0.8.24; diff --git a/contracts/utils/cryptography/EIP712.sol b/contracts/utils/cryptography/EIP712.sol index bcb67c87a..8ac545a8f 100644 --- a/contracts/utils/cryptography/EIP712.sol +++ b/contracts/utils/cryptography/EIP712.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/EIP712.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/cryptography/Hashes.sol b/contracts/utils/cryptography/Hashes.sol index 6b7168e87..48c9bbe2d 100644 --- a/contracts/utils/cryptography/Hashes.sol +++ b/contracts/utils/cryptography/Hashes.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/Hashes.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/Hashes.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/cryptography/MessageHashUtils.sol b/contracts/utils/cryptography/MessageHashUtils.sol index 99ec150d9..37e92395f 100644 --- a/contracts/utils/cryptography/MessageHashUtils.sol +++ b/contracts/utils/cryptography/MessageHashUtils.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MessageHashUtils.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/cryptography/P256.sol b/contracts/utils/cryptography/P256.sol index 8ec031238..81d79adc4 100644 --- a/contracts/utils/cryptography/P256.sol +++ b/contracts/utils/cryptography/P256.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/P256.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/P256.sol) pragma solidity ^0.8.20; import {Math} from "../math/Math.sol"; diff --git a/contracts/utils/math/Math.sol b/contracts/utils/math/Math.sol index 765549785..f0d608a2d 100644 --- a/contracts/utils/math/Math.sol +++ b/contracts/utils/math/Math.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol) pragma solidity ^0.8.20; diff --git a/contracts/utils/structs/Checkpoints.sol b/contracts/utils/structs/Checkpoints.sol index 5250c8385..8ad3c5ab5 100644 --- a/contracts/utils/structs/Checkpoints.sol +++ b/contracts/utils/structs/Checkpoints.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/Checkpoints.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/structs/Checkpoints.sol) // This file was procedurally generated from scripts/generate/templates/Checkpoints.js. pragma solidity ^0.8.20; diff --git a/contracts/utils/structs/CircularBuffer.sol b/contracts/utils/structs/CircularBuffer.sol index 0799dd175..43ce89be7 100644 --- a/contracts/utils/structs/CircularBuffer.sol +++ b/contracts/utils/structs/CircularBuffer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/CircularBuffer.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/structs/CircularBuffer.sol) pragma solidity ^0.8.20; import {Math} from "../math/Math.sol"; diff --git a/contracts/utils/structs/EnumerableMap.sol b/contracts/utils/structs/EnumerableMap.sol index d455c4d48..09fa498fc 100644 --- a/contracts/utils/structs/EnumerableMap.sol +++ b/contracts/utils/structs/EnumerableMap.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/EnumerableMap.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/structs/EnumerableMap.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableMap.js. pragma solidity ^0.8.20; diff --git a/contracts/utils/structs/EnumerableSet.sol b/contracts/utils/structs/EnumerableSet.sol index 31829df9a..ec8bb3779 100644 --- a/contracts/utils/structs/EnumerableSet.sol +++ b/contracts/utils/structs/EnumerableSet.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/EnumerableSet.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; diff --git a/contracts/utils/structs/MerkleTree.sol b/contracts/utils/structs/MerkleTree.sol index c48a1247a..010ccfe8b 100644 --- a/contracts/utils/structs/MerkleTree.sol +++ b/contracts/utils/structs/MerkleTree.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/MerkleTree.sol) +// OpenZeppelin Contracts (last updated v5.3.0) (utils/structs/MerkleTree.sol) pragma solidity ^0.8.20; @@ -178,7 +178,7 @@ library MerkleTree { * root (before the update) and "new" root (after the update). The caller must verify that the reconstructed old * root is the last known one. * - * The `proof` must be an up-to-date inclusion proof for the leaf being update. This means that this function is + * The `proof` must be an up-to-date inclusion proof for the leaf being updated. This means that this function is * vulnerable to front-running. Any {push} or {update} operation (that changes the root of the tree) would render * all "in flight" updates invalid. * diff --git a/package-lock.json b/package-lock.json index 2b2d87fae..759adde2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "openzeppelin-solidity", - "version": "5.2.0", + "version": "5.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openzeppelin-solidity", - "version": "5.2.0", + "version": "5.3.0", "license": "MIT", "devDependencies": { "@changesets/changelog-github": "^0.5.0", diff --git a/package.json b/package.json index 8282c3843..80b1543a2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "openzeppelin-solidity", "description": "Secure Smart Contract library for Solidity", - "version": "5.2.0", + "version": "5.3.0", "private": true, "files": [ "/contracts/**/*.sol", diff --git a/test/access/manager/AuthorityUtils.test.js b/test/access/manager/AuthorityUtils.test.js index 905913f14..465f617ad 100644 --- a/test/access/manager/AuthorityUtils.test.js +++ b/test/access/manager/AuthorityUtils.test.js @@ -2,6 +2,8 @@ const { ethers } = require('hardhat'); const { expect } = require('chai'); const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers'); +const { MAX_UINT32, MAX_UINT64 } = require('../../helpers/constants'); + async function fixture() { const [user, other] = await ethers.getSigners(); @@ -70,7 +72,7 @@ describe('AuthorityUtils', function () { }); for (const immediate of [true, false]) { - for (const delay of [0n, 42n]) { + for (const delay of [0n, 42n, MAX_UINT32]) { it(`returns (immediate=${immediate}, delay=${delay})`, async function () { await this.authority._setImmediate(immediate); await this.authority._setDelay(delay); @@ -80,6 +82,14 @@ describe('AuthorityUtils', function () { }); } } + + it('out of bound delay', async function () { + await this.authority._setImmediate(false); + await this.authority._setDelay(MAX_UINT64); // bigger than the expected uint32 + const result = await this.mock.$canCallWithDelay(this.authority, this.user, this.other, '0x12345678'); + expect(result.immediate).to.equal(false); + expect(result.delay).to.equal(0n); + }); }); describe('when authority replies with empty data', function () { diff --git a/test/helpers/constants.js b/test/helpers/constants.js index 4dfda5eab..eb9b43e55 100644 --- a/test/helpers/constants.js +++ b/test/helpers/constants.js @@ -1,4 +1,5 @@ module.exports = { + MAX_UINT32: 2n ** 32n - 1n, MAX_UINT48: 2n ** 48n - 1n, MAX_UINT64: 2n ** 64n - 1n, };