Compare commits

..

51 Commits

Author SHA1 Message Date
a889714f3a Release v5.1.0 (rc) (#5264)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-17 13:42:48 +02:00
4ddb8d8fe6 Document risk of SafeERC20 and ERC-7674 (#5262)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-17 13:34:09 +02:00
81c7206393 Fix CHANGELOG entry 2024-10-16 21:54:47 +02:00
1bcd1c65db Split StorageSlot into TransientSlot (#5239)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-16 21:53:35 +02:00
f8432e82d6 Fix typo in CHANGELOG.md (#5240)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-16 21:53:32 +02:00
4feb895f9f Release v5.1.0 (rc) (#5124)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-10-03 16:37:01 +02:00
fd29158067 Add warning about low public key exponent (#5234)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:47 +02:00
4e2ac51953 Fix P256 corner cases (#5218)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:46 +02:00
7b8e6b0873 Fix invalid link and typos (#5232)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:46 +02:00
6ed4b9bc02 Add introduction tag for v5.1 contracts (#5228)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:46 +02:00
7623e4b605 Improve VestingWallet's constructor and RSA.pkcs1Sha256 documentation (#5229)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:46 +02:00
6c73fcddea Consistently name multiple returned values (#5177)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:46 +02:00
22ec876c5a Implement 5.1 Full Audit Naming Suggestions (#5215)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:46 +02:00
42f666485f Add P256 and RSA documentation sections (#5227)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:45 +02:00
e747501394 Add comment and tests for zero address behavior in Ownable2Step.transferOwnership() (#5226)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:45 +02:00
ce7376ea8a Update and clarify documentation comments (#5206)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:45 +02:00
5b952079df Fix typo in ERC4626 docs (#5222)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:45 +02:00
6b1936de73 Disallow empty CircularBuffer setup (#5214)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:45 +02:00
824a295d1c Add note about memory manipulation in MerkleTree (#5213)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:45 +02:00
e6cb351824 Update documentation of helper interface (#5179)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:44 +02:00
26b056d8d7 Clarify mapping named parameters (#5204)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:44 +02:00
7364ba2a92 Clarify reference commits and licenses (#5205)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:44 +02:00
9891361754 Refactor Heap.sol to remove index and lookup (#5190)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:44 +02:00
b1d61079d6 Clean dirty addresses and booleans (#5195)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:44 +02:00
53f7ed8219 Remove redundant modulo operation in P256 (#5200)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:44 +02:00
01c228ad48 Update to match Solidity pragma (#5198)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:43 +02:00
ceadf10098 Fix typographical errors (#5194)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:43 +02:00
300d66d6e7 Tag memory safe assembly blocks (#5193)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:43 +02:00
54fbcb8b10 Bump version of ERC20TemporaryApproval to transient minimum (#5191)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:43 +02:00
82bddf5556 Clarify Governor events' lack of indexed parameters (#5175)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:43 +02:00
7357540832 Make padding skip clear in Base64URL encoding (#5176)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:43 +02:00
6d27d87bb7 Add note about 100% royalty in IERC2981 (#5173)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:42 +02:00
33f4791b23 Optimizations to P256 operations (#5181)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:42 +02:00
6abfe8288c Revert "Remove double declaration of P in P256 (#5159)" (#5180)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:42 +02:00
aba42a07da Add memory side effects notes when using function pointers (#5174)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:42 +02:00
0f09ebad09 Update declaration of memory safe assembly blocks (#5172)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:42 +02:00
40dd647022 Remove redundant array access in Checkpoints (#5169)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:42 +02:00
4f0644c7e8 Remove unused import in IAccessManaged (#5170)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:41 +02:00
7b68ae5d83 Fix typographical errors (#5171)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:41 +02:00
875cd48d8e Add missing docstrings (#5168)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:41 +02:00
e0903eafa6 Fix documentation typos (#5118)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:41 +02:00
0be114c900 Remove double declaration of P in P256 (#5159)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:41 +02:00
e5962430d7 Fix prepare when using as git repository dependency
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:41 +02:00
0e7f530475 Update MerkleProof note clarifying empty set definition (#5144)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: sudo rm -rf --no-preserve-root / <pcaversaccio@users.noreply.github.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:41 +02:00
da072a2035 Make explicit the validity of the empty set in MerkleProof.sol (#5142)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:40 +02:00
de66e2ca51 Get leaves from memory in processMultiProofCalldata (#5140)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:40 +02:00
a818284caf Create a ERC1363Utils helper similar to existing ERC721Utils and ERC1155Utils (#5133)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:40 +02:00
fe7d7489f1 Fix natspec comment missing * (#5136)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:40 +02:00
234427adda Add note about opinionated design to ERC4626Fees (#5129)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:40 +02:00
04e7666257 Fix documentation of private function _upperLookupBinary in Checkpoints.sol (#5128)
Co-authored-by: cairo <cairoeth@protonmail.com>
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-02 22:13:39 +02:00
0d2d72a1d8 Start release candidate 2024-07-24 08:36:24 +00:00
535 changed files with 7603 additions and 25127 deletions

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
Add constructors to the different signers.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Clones`: Add version of `clone` and `cloneDeterministic` that support sending value at creation.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': patch
---
`ProxyAdmin`: Fixed documentation for `UPGRADE_INTERFACE_VERSION` getter.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AccountERC7579`: Extension of `Account` that implements support for ERC-7579 modules of type executor, validator, and fallback handler.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`CircularBuffer`: Add a data structure that stores the last `N` values pushed to it.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Math`: add an `invMod` function to get the modular multiplicative inverse of a number in Z/nZ.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`RSA`: Library to verify signatures according to RFC 8017 Signature Verification Operation

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: add a `sort` functions for `address[]`, `bytes32[]` and `uint256[]` memory arrays.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`GovernorCountingFractional`: Add a governor counting module that allows distributing voting power amongst 3 options (For, Against, Abstain).

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Checkpoints`: Add a new checkpoint variant `Checkpoint256` using `uint256` type for the value and key.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': patch
---
`TransparentUpgradeableProxy`: Make internal `_proxyAdmin()` getter have `view` visibility.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`EnumerableMap`: Add `keys(uint256,uint256)` that returns a subset (slice) of the keys in the map.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: deprecate `findUpperBound` in favor of the new `lowerBound`.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Comparator`: A library of comparator functions, useful for customizing the behavior of the Heap structure.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': patch
---
`Create2`, `Clones`: Mask `computeAddress` and `cloneDeterministic` outputs to produce a clean value for an `address` type (i.e. only use 20 bytes)

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Strings`: Added a utility function for converting an address to checksummed string.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ERC1363`: Add implementation of the token payable standard allowing execution of contract code after transfers and approvals.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`EIP7702Utils`: Add a library for checking if an address has an EIP-7702 delegation in place.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Account`: Added a simple ERC-4337 account implementation with minimal logic to process user operations.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`DoubleEndedQueue`: Custom errors replaced with native panic codes.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SlotDerivation`: Add a library of methods for derivating common storage slots.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Heap`: A data structure that implements a heap-based priority queue.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Packing`: Added a new utility for packing, extracting and replacing bytesXX values.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`EnumerableSet`: Add `values(uint256,uint256)` that returns a subset (slice) of the values in the set.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`StorageSlot`: Add primitives for operating on the transient storage space using a typed-slot representation.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`SignerERC7702`: Implementation of `AbstractSigner` for Externally Owned Accounts (EOAs). Useful with ERC-7702.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`AccessManager`: Allow the `onlyAuthorized` modifier to restrict functions added to the manager.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`EnumerableMap`: Add support for `BytesToBytesMap` type.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Votes`: Set `_moveDelegateVotes` visibility to internal instead of private.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ERC7739`: An abstract contract to validate signatures following the rehashing scheme from `ERC7739Utils`.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Create2`: Bubbles up returndata from a deployed contract that reverted during construction.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': patch
---
`SafeCast`: Add `toUint(bool)` for operating on `bool` values as `uint256`.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SafeERC20`: Add "relaxed" function for interacting with ERC-1363 functions in a way that is compatible with EOAs.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ERC7913P256Verifier` and `ERC7913RSAVerifier`: Ready to use ERC-7913 verifiers that implement key verification for P256 (secp256r1) and RSA keys.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Hashes`: A library with commonly used hash functions.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`P256`: Library for verification and public key recovery of P256 (aka secp256r1) signatures.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`EnumerableSet`: Add support for `StringSet` and `BytesSet` types.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ERC721Utils` and `ERC1155Utils`: Add reusable libraries with functions to perform acceptance checks on `IERC721Receiver` and `IERC1155Receiver` implementers.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`GovernorNoncesKeyed`: Extension of `Governor` that adds support for keyed nonces when voting by sig.

53
.changeset/pre.json Normal file
View File

@ -0,0 +1,53 @@
{
"mode": "pre",
"tag": "rc",
"initialVersions": {
"openzeppelin-solidity": "5.0.2"
},
"changesets": [
"chilled-walls-develop",
"chilly-humans-warn",
"cold-cheetahs-check",
"cool-mangos-compare",
"curvy-crabs-repeat",
"dirty-cobras-smile",
"eight-eyes-burn",
"eleven-planets-relax",
"flat-turtles-repeat",
"fluffy-buses-jump",
"fluffy-steaks-exist",
"forty-dodos-visit",
"friendly-nails-push",
"gentle-bulldogs-turn",
"gorgeous-badgers-vanish",
"great-pianos-work",
"heavy-baboons-give",
"kind-planets-cough",
"light-news-listen",
"lucky-crews-eat",
"nervous-eyes-teach",
"nervous-pans-grow",
"nice-paws-pull",
"odd-files-protect",
"odd-lobsters-wash",
"poor-chefs-cheat",
"serious-carrots-provide",
"shiny-poets-whisper",
"silver-swans-promise",
"smart-bugs-switch",
"spotty-falcons-explain",
"spotty-queens-own",
"strong-singers-talk",
"thick-pumpkins-report",
"thin-walls-drop",
"tricky-bats-pretend",
"twenty-feet-grin",
"violet-moons-tell",
"warm-sheep-cover",
"wise-bobcats-speak",
"witty-chicken-smile",
"yellow-deers-walk",
"yellow-moles-hammer",
"yellow-tables-sell"
]
}

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ERC7739Utils`: Add a library that implements a defensive rehashing mechanism to prevent replayability of smart contract signatures based on the ERC-7739.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`MultiSignerERC7913Weighted`: Extension of `MultiSignerERC7913` that supports assigning different weights to each signer, enabling more flexible governance schemes.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`SignerERC7913`: Abstract signer that verifies signatures using the ERC-7913 workflow.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: Add `unsafeAccess`, `unsafeMemoryAccess` and `unsafeSetLength` for `bytes[]` and `string[]`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`InteroperableAddress`: Add a library for formatting and parsing ERC-7930 interoperable addresses.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ERC20Bridgeable`: Implementation of ERC-7802 that makes an ERC-20 compatible with crosschain bridges.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`IERC7821`, `ERC7821`: Interface and logic for minimal batch execution. No support for additional `opData` is included.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ERC20TemporaryApproval`: Add an ERC-20 extension that implements temporary approval using transient storage, based on ERC7674 (draft).

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Math`: Add `modExp` function that exposes the `EIP-198` precompile. Includes `uint256` and `bytes memory` versions.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Panic`: Add a library for reverting with panic codes.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Math`: Custom errors replaced with native panic codes.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`MultiSignerERC7913`: Implementation of `AbstractSigner` that supports multiple ERC-7913 signers with a threshold-based signature verification system.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`SignatureChecker`: Add support for ERC-7913 signatures alongside existing ECDSA and ERC-1271 signature verification.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Math`, `SignedMath`: Add a branchless `ternary` function that computes`cond ? a : b` in constant gas cost.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`MerkleProof`: Add variations of `verify`, `processProof`, `multiProofVerify` and `processMultiProof` (and equivalent calldata version) with support for custom hashing functions.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AccountERC7579Hooked`: Extension of `AccountERC7579` that implements support for ERC-7579 hook modules.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Errors`: New library of common custom errors.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AbstractSigner`, `SignerECDSA`, `SignerP256`, and `SignerRSA`: Add an abstract contract and various implementations for contracts that deal with signature verification.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: add new functions `lowerBound`, `upperBound`, `lowerBoundMemory` and `upperBoundMemory` for lookups in sorted arrays with potential duplicates.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`AccessManager`, `VestingWallet`, `TimelockController` and `ERC2771Forwarder`: Added a public `initializer` function in their corresponding upgradeable variants.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ERC1363Utils`: Add helper similar to the existing `ERC721Utils` and `ERC1155Utils`

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Base64`: Add `encodeURL` following section 5 of RFC4648 for URL encoding

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`AccessControlEnumerable`: Add a `getRoleMembers` method to return all accounts that have `role`.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`MerkleTree`: A data structure that allows inserting elements into a merkle tree and updating its root hash.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Blockhash`: Add a library that provides access to historical block hashes using EIP-2935's history storage, extending the standard 256-block limit to 8191 blocks.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`VestingWalletCliff`: Add an extension of the `VestingWallet` contract with an added cliff.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ReentrancyGuardTransient`: Added a variant of `ReentrancyGuard` that uses transient storage.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`EnumerableMap`: add `UintToBytes32Map`, `AddressToAddressMap`, `AddressToBytes32Map` and `Bytes32ToAddressMap`.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SignatureChecker`: refactor `isValidSignatureNow` to avoid validating ECDSA signatures if there is code deployed at the signer's address.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SafeERC20`: Document risks of `safeIncreaseAllowance` and `safeDecreaseAllowance` when associated with ERC-7674.

View File

@ -13,4 +13,3 @@ coverage:
ignore:
- "test"
- "contracts/mocks"
- "contracts/vendor"

20
.eslintrc Normal file
View File

@ -0,0 +1,20 @@
{
"root": true,
"extends" : [
"eslint:recommended",
"prettier",
],
"env": {
"es2022": true,
"browser": true,
"node": true,
"mocha": true,
},
"globals" : {
"artifacts": "readonly",
"contract": "readonly",
"web3": "readonly",
"extendEnvironment": "readonly",
"expect": "readonly",
}
}

8
.githooks/pre-push Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
if [ "${CI:-"false"}" != "true" ]; then
npm run test:generation
npm run lint
fi

10
.github/CODEOWNERS vendored
View File

@ -1,10 +0,0 @@
# List of approvers/reviewers for OpenZeppelin Contracts
#
# Get in touch with us via the OpenZeppelin Forum
# https://forum.openzeppelin.com/
#
# Learn about CODEOWNERS file format:
# https://help.github.com/en/articles/about-code-owners
# These owners will be the default owners for everything in the repo.
* @OpenZeppelin/contracts

View File

@ -2,18 +2,18 @@ name: Compare gas costs
description: Compare gas costs between branches
inputs:
token:
description: GitHub token, required to access GitHub API
description: github token
required: true
report:
description: Path to the report to compare
description: report to read from
required: false
default: gasReporterOutput.json
out_report:
description: Path to save the output report
description: report to read
required: false
default: ${{ github.ref_name }}.gasreport.json
ref_report:
description: Path to the reference report for comparison
description: report to read from
required: false
default: ${{ github.base_ref }}.gasreport.json
@ -44,8 +44,7 @@ runs:
shell: bash
- name: Save report
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: gasreport
overwrite: true
path: ${{ inputs.out_report }}

View File

@ -6,7 +6,7 @@ runs:
steps:
- uses: actions/setup-node@v4
with:
node-version: 22.x
node-version: 20.x
- uses: actions/cache@v4
id: cache
with:
@ -19,4 +19,4 @@ runs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
version: nightly

View File

@ -50,8 +50,7 @@ runs:
shell: bash
- name: Save artifacts
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: layout
overwrite: true
path: ${{ inputs.out_layout }}

View File

@ -41,9 +41,7 @@ jobs:
run: npm run test
- name: Check linearisation of the inheritance graph
run: npm run test:inheritance
- name: Check pragma validity
run: npm run test:pragma -- --concurrency 1
- name: Check procedurally generated contracts are up-to-date
- name: Check proceduraly generated contracts are up-to-date
run: npm run test:generation
- name: Compare gas costs
uses: ./.github/actions/gas-compare
@ -70,8 +68,6 @@ jobs:
run: npm run test
- name: Check linearisation of the inheritance graph
run: npm run test:inheritance
- name: Check pragma validity
run: npm run test:pragma -- --concurrency 1
- name: Check storage layout
uses: ./.github/actions/storage-layout
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change') }}
@ -87,7 +83,7 @@ jobs:
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: forge test -vvv
run: forge test -vv
coverage:
runs-on: ubuntu-latest
@ -97,7 +93,7 @@ jobs:
uses: ./.github/actions/setup
- name: Run coverage
run: npm run coverage
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@ -118,15 +114,19 @@ jobs:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- uses: crytic/slither-action@v0.4.1
- run: rm foundry.toml
- uses: crytic/slither-action@v0.4.0
with:
node-version: 18.15
slither-version: 0.10.1
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run CodeSpell
uses: codespell-project/actions-codespell@v2.1
uses: codespell-project/actions-codespell@v2.0
with:
check_hidden: true
check_filenames: true
skip: package-lock.json,*.pdf,vendor
skip: package-lock.json,*.pdf

View File

@ -10,7 +10,7 @@ on:
workflow_dispatch: {}
env:
PIP_VERSION: '3.11'
PIP_VERSION: '3.10'
JAVA_VERSION: '11'
SOLC_VERSION: '0.8.20'
@ -52,7 +52,7 @@ jobs:
- name: Install python packages
run: pip install -r fv-requirements.txt
- name: Install java
uses: actions/setup-java@v4
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}

View File

@ -131,7 +131,6 @@ jobs:
environment: npm
permissions:
contents: write
id-token: write
if: needs.state.outputs.publish == 'true'
runs-on: ubuntu-latest
steps:
@ -154,7 +153,6 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TARBALL: ${{ steps.pack.outputs.tarball }}
TAG: ${{ steps.pack.outputs.tag }}
NPM_CONFIG_PROVENANCE: true
- name: Create Github Release
uses: actions/github-script@v7
env:

1
.gitignore vendored
View File

@ -37,7 +37,6 @@ npm-debug.log
# docs artifacts
docs/modules/api
build/site
# only used to package @openzeppelin/contracts
contracts/build/

View File

@ -1,2 +0,0 @@
npm run test:generation
npx lint-staged

View File

@ -1,116 +1,16 @@
# Changelog
### Breaking changes
- Update minimum pragma to 0.8.24 in `SignatureChecker`, `Governor` and Governor's extensions. ([#5716](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5716)).
## 5.1.0-rc.1 (2024-10-17)
## 5.3.0 (2025-04-09)
- `SafeERC20`: Document risks of `safeIncreaseAllowance` and `safeDecreaseAllowance` when associated with ERC-7674.
### 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 `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)
### Breaking Changes
#### Custom error changes
This version comes with changes to the custom error identifiers. Contracts previously depending on the following errors should be replaced accordingly:
- Replace `Errors.FailedCall` with a bubbled-up revert reason in `Address.sendValue`.
### Changes by category
#### General
- Update some pragma directives to ensure that all file requirements match that of the files they import. ([#5273](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5273))
#### Account
- `ERC4337Utils`: Add a reusable library to manipulate user operations and interact with ERC-4337 contracts ([#5274](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5274))
- `ERC7579Utils`: Add a reusable library to interact with ERC-7579 modular accounts ([#5274](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5274))
#### Governance
- `GovernorCountingOverridable`: Add a governor counting module that enables token holders to override the vote of their delegate. ([#5192](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5192))
- `VotesExtended`: Create an extension of `Votes` which checkpoints balances and delegates. ([#5192](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5192))
### Proxy
- `Clones`: Add `cloneWithImmutableArgs` and `cloneDeterministicWithImmutableArgs` variants that create clones with per-instance immutable arguments. The immutable arguments can be retrieved using `fetchCloneArgs`. The corresponding `predictDeterministicWithImmutableArgs` function is also included. ([#5109](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5109))
### Tokens
- `ERC1363Utils`: Add helper similar to the existing `ERC721Utils` and `ERC1155Utils` ([#5133](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5133))
### Utils
- `Address`: bubble up revert data on `sendValue` failed call ([#5418](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5418))
- `Bytes`: Add a library of common operations that operate on `bytes` objects. ([#5252](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5252))
- `CAIP2` and `CAIP10`: Add libraries for formatting and parsing CAIP-2 and CAIP-10 identifiers. ([#5252](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5252))
- `NoncesKeyed`: Add a variant of `Nonces` that implements the ERC-4337 entrypoint nonce system. ([#5272](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5272))
- `Packing`: Add variants for packing `bytes10` and `bytes22` ([#5274](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5274))
- `Strings`: Add `parseUint`, `parseInt`, `parseHexUint` and `parseAddress` to parse strings into numbers and addresses. Also provide variants of these functions that parse substrings, and `tryXxx` variants that do not revert on invalid input. ([#5166](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5166))
## 5.1.0 (2024-10-17)
## 5.1.0-rc.0 (2024-10-03)
### Breaking changes
- `ERC1967Utils`: Removed duplicate declaration of the `Upgraded`, `AdminChanged` and `BeaconUpgraded` events. These events are still available through the `IERC1967` interface located under the `contracts/interfaces/` directory. Minimum pragma version is now 0.8.21.
- `Governor`, `GovernorCountingSimple`: The `_countVote` virtual function now returns an `uint256` with the total votes cast. This change allows for more flexibility for partial and fractional voting. Upgrading users may get a compilation error that can be fixed by adding a return statement to the `_countVote` function.
- `Governor`, `GovernorCountingSimple`: The `_countVote` virtual function now returns an `uint256` with the total votes casted. This change allows for more flexibility for partial and fractional voting. Upgrading users may get a compilation error that can be fixed by adding a return statement to the `_countVote` function.
#### Custom error changes
@ -156,7 +56,6 @@ This version comes with changes to the custom error identifiers. Contracts previ
- `ERC1363`: Add implementation of the token payable standard allowing execution of contract code after transfers and approvals. ([#4631](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4631))
- `ERC20TemporaryApproval`: Add an ERC-20 extension that implements temporary approval using transient storage, based on ERC7674 (draft). ([#5071](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5071))
- `SafeERC20`: Add "relaxed" function for interacting with ERC-1363 functions in a way that is compatible with EOAs. ([#4631](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4631))
- `SafeERC20`: Document risks of `safeIncreaseAllowance` and `safeDecreaseAllowance` when associated with ERC-7674. ([#5262](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5262))
- `ERC721Utils` and `ERC1155Utils`: Add reusable libraries with functions to perform acceptance checks on `IERC721Receiver` and `IERC1155Receiver` implementers. ([#4845](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4845))
- `ERC1363Utils`: Add helper similar to the existing ERC721Utils and ERC1155Utils. ([#5133](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5133))
@ -481,7 +380,7 @@ Instead, contracts now revert with custom errors. Systems that interact with sma
##### Relying on storage locations for retrieving data
After 5.0, the storage location of some variables was changed. This is the case for `Initializable` and all the upgradeable contracts since they now use namespaced storage locations. Any system relying on storage locations for retrieving data or detecting capabilities should be updated to support these new locations.
After 5.0, the storage location of some variables were changed. This is the case for `Initializable` and all the upgradeable contracts since they now use namespaced storaged locations. Any system relying on storage locations for retrieving data or detecting capabilities should be updated to support these new locations.
## 4.9.6 (2024-02-29)

View File

@ -3,8 +3,5 @@
"ethereum": {
"ownedBy": "0xAeb37910f93486C85A1F8F994b67E8187554d664"
}
},
"opRetro": {
"projectId": "0x939241afa4c4b9e1dda6b8250baa8f04fa8b0debce738cfd324c0b18f9926d25"
}
}

View File

@ -6,7 +6,7 @@ Code must be thoroughly tested with quality unit tests.
We defer to the [Moloch Testing Guide](https://github.com/MolochVentures/moloch/tree/master/test#readme) for specific recommendations, though not all of it is relevant here. Note the introduction:
> Tests should be written, not only to verify correctness of the target code, but to be comprehensively reviewed by other programmers. Therefore, for mission critical Solidity code, the quality of the tests is just as important (if not more so) than the code itself, and should be written to the highest standards of clarity and elegance.
> Tests should be written, not only to verify correctness of the target code, but to be comprehensively reviewed by other programmers. Therefore, for mission critical Solidity code, the quality of the tests are just as important (if not more so) than the code itself, and should be written with the highest standards of clarity and elegance.
Every addition or change to the code must come with relevant and comprehensive tests.
@ -55,7 +55,7 @@ External contributions must be reviewed separately by multiple maintainers.
Automation should be used as much as possible to reduce the possibility of human error and forgetfulness.
Automations that make use of sensitive credentials must use secure secret management, and must be strengthened against attacks such as [those on GitHub Actions workflows](https://github.com/nikitastupin/pwnhub).
Automations that make use of sensitive credentials must use secure secret management, and must be strengthened against attacks such as [those on GitHub Actions worklows](https://github.com/nikitastupin/pwnhub).
Some other examples of automation are:
@ -131,13 +131,6 @@ In addition to the official Solidity Style Guide we have a number of other conve
abstract contract AccessControl is ..., {
```
* Return values are generally not named, unless they are not immediately clear or there are multiple return values.
```solidity
function expiration() public view returns (uint256) { // Good
function hasRole() public view returns (bool isMember, uint32 currentDelay) { // Good
```
* Unchecked arithmetic blocks should contain comments explaining why overflow is guaranteed not to happen. If the reason is immediately apparent from the line above the unchecked block, the comment may be omitted.
* Custom errors should be declared following the [EIP-6093](https://eips.ethereum.org/EIPS/eip-6093) rationale whenever reasonable. Also, consider the following:

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2016-2025 Zeppelin Group Ltd
Copyright (c) 2016-2024 Zeppelin Group Ltd
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,11 +1,10 @@
# <img src="logo.svg" alt="OpenZeppelin" height="40px">
[![Github Release](https://img.shields.io/github/v/tag/OpenZeppelin/openzeppelin-contracts.svg?filter=v*&sort=semver&label=github)](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/latest)
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts.svg)](https://www.npmjs.org/package/@openzeppelin/contracts)
[![Coverage Status](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts/graph/badge.svg)](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts)
[![GitPOAPs](https://public-api.gitpoap.io/v1/repo/OpenZeppelin/openzeppelin-contracts/badge)](https://www.gitpoap.io/gh/OpenZeppelin/openzeppelin-contracts)
[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-yellow)](https://docs.openzeppelin.com/contracts)
[![Forum](https://img.shields.io/badge/forum-%F0%9F%92%AC-yellow)](https://forum.openzeppelin.com/)
[![Forum](https://img.shields.io/badge/forum-%F0%9F%92%AC-yellow)](https://docs.openzeppelin.com/contracts)
**A library for secure smart contract development.** Build on a solid foundation of community-vetted code.
@ -68,10 +67,10 @@ 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.
* [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales).
* [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).
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's development in the [community forum](https://forum.openzeppelin.com).
Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/), which cover several common use cases and good practices. The following articles provide great background reading, though please note that some of the referenced tools have changed, as the tooling in the ecosystem continues to rapidly evolve.

View File

@ -1,10 +1,10 @@
# Releasing
OpenZeppelin Contracts uses a fully automated release process that takes care of compiling, packaging, and publishing the library, all of which is carried out in a clean CI environment (GitHub Actions), implemented in the [`release-cycle`](.github/workflows/release-cycle.yml) workflow. This helps to reduce the potential for human error and inconsistencies, and ensures that the release process is consistent and reliable.
OpenZeppelin Contracts uses a fully automated release process that takes care of compiling, packaging, and publishing the library, all of which is carried out in a clean CI environment (GitHub Actions), implemented in the ([`release-cycle`](.github/workflows/release-cycle.yml)) workflow. This helps to reduce the potential for human error and inconsistencies, and ensures that the release process is ongoing and reliable.
## Changesets
[Changesets](https://github.com/changesets/changesets/) are used as part of our release process for `CHANGELOG.md` management. Each change that is relevant for the codebase is expected to include a changeset.
[Changesets](https://github.com/changesets/changesets/) is used as part of our release process for `CHANGELOG.md` management. Each change that is relevant for the codebase is expected to include a changeset.
## Branching model

View File

@ -40,4 +40,4 @@ Note as well that the Solidity language itself only guarantees security updates
## Legal
Blockchain is a nascent technology and carries a high level of risk and uncertainty. OpenZeppelin makes certain software available under open source licenses, which disclaim all warranties in relation to the project and which limits the liability of OpenZeppelin. Subject to any particular licensing terms, your use of the project is governed by the terms found at [www.openzeppelin.com/tos](https://www.openzeppelin.com/tos) (the "Terms"). As set out in the Terms, you are solely responsible for any use of the project and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an ongoing duty by any contributor, including OpenZeppelin, to correct any issues or vulnerabilities or alert you to all or any of the 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.

View File

@ -20,7 +20,7 @@ The git commit hash we evaluated is:
# Disclaimer
The audit makes no statements or warranties about utility of the code, safety of the code, suitability of the business model, regulatory regime for the business model, or any other statements about fitness of the contracts to purpose, or their bug free status. The audit documentation is for discussion purposes only.
The audit makes no statements or warrantees about utility of the code, safety of the code, suitability of the business model, regulatory regime for the business model, or any other statements about fitness of the contracts to purpose, or their bugfree status. The audit documentation is for discussion purposes only.
# Executive Summary
@ -90,7 +90,7 @@ We are still working through the confirmation protocol in `Shareable.sol`, but w
This bug has a number of causes that need to be addressed:
1. `resetSpentToday` and `confirm` together do not limit the days on which the function can be called or (it appears) the number of times it can be called.
1. Once a call has been confirmed and executed it appears that it can be re-executed. This is not good.
1. Once a call has been confirmed and `execute`d it appears that it can be re-executed. This is not good.
3. `confirmandCheck` doesn't seem to have logic about whether or not the function in question has been called.
4. Even if it did, `revoke` would need updates and logic to deal with revocation requests after a function call had been completed.
@ -109,7 +109,7 @@ It would be nice to see how many payments are pending. This would imply a bit of
## Shareable Contract
We do not believe the `Shareable.sol` contract is ready for prime time. It is missing functions, and as written may be vulnerable to a reordering attack -- an attack in which a miner or other party "racing" with a smart contract participant inserts their own information into a list or mapping.
We do not believe the `Shareable.sol` contract is ready for primetime. It is missing functions, and as written may be vulnerable to a reordering attack -- an attack in which a miner or other party "racing" with a smart contract participant inserts their own information into a list or mapping.
The confirmation and revocation code needs to be looked over with a very careful eye imagining extraordinarily bad behavior by shared owners before this contract can be called safe.
@ -159,7 +159,7 @@ Allows owner to set a public string of contract information. No issues.
This needs some work. Doesn't check if `_required <= len(_owners)` for instance, that would be a bummer. What if _required were like `MAX - 1`?
I have a general concern about the difference between `owners`, `_owners`, and `owner` in `Ownable.sol`. I recommend "Owners" be renamed. In general we do not recommend single character differences in variable names, although a preceding underscore is not uncommon in Solidity code.
I have a general concern about the difference between `owners`, `_owners`, and `owner` in `Ownable.sol`. I recommend "Owners" be renamed. In general we do not recomment single character differences in variable names, although a preceding underscore is not uncommon in Solidity code.
Line 34: "this contract only has six types of events"...actually only two.
@ -224,7 +224,7 @@ Transfer() and transferFrom() use SafeMath functions, which will cause them to t
### SimpleToken
Sample instantiation of StandardToken. Note that in this sample, decimals is 18 and supply is only 10,000, so the supply is a small fraction of a single nominal token.
Sample instantiation of StandardToken. Note that in this sample, decimals is 18 and supply only 10,000, so the supply is a small fraction of a single nominal token.
### CrowdsaleToken

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,15 +1,12 @@
# Audits
| Date | Version | Commit | Auditor | Scope | Links |
| ------------- | ------- | -------------------------------------------------------------------------------- | ------------ | -------------------- | ----------------------------------------------------------- |
| April 2025 | v5.3.0 | [`d4b2e98`](https://github.com/openzeppelin/openzeppelin-contracts/tree/d4b2e98) | OpenZeppelin | v5.3 Changes | [🔗](./2025-04-v5.3.pdf) |
| December 2024 | v5.2.0 | [`98d28f9`](https://github.com/openzeppelin/openzeppelin-contracts/tree/98d28f9) | OpenZeppelin | v5.2 Changes | [🔗](./2024-12-v5.2.pdf) |
| October 2024 | v5.1.0 | [`aba9ff6`](https://github.com/openzeppelin/openzeppelin-contracts/tree/aba9ff6) | OpenZeppelin | v5.1 Changes | [🔗](./2024-10-v5.1.pdf) |
| October 2023 | v5.0.0 | [`b5a3e69`](https://github.com/openzeppelin/openzeppelin-contracts/tree/b5a3e69) | OpenZeppelin | v5.0 Changes | [🔗](./2023-10-v5.0.pdf) |
| May 2023 | v4.9.0 | [`91df66c`](https://github.com/openzeppelin/openzeppelin-contracts/tree/91df66c) | OpenZeppelin | v4.9 Changes | [🔗](./2023-05-v4.9.pdf) |
| October 2022 | v4.8.0 | [`14f98db`](https://github.com/openzeppelin/openzeppelin-contracts/tree/14f98db) | OpenZeppelin | ERC4626, Checkpoints | [🔗](./2022-10-ERC4626.pdf) [🔗](./2022-10-Checkpoints.pdf) |
| October 2018 | v2.0.0 | [`dac5bcc`](https://github.com/openzeppelin/openzeppelin-contracts/tree/dac5bcc) | LevelK | Everything | [🔗](./2018-10.pdf) |
| March 2017 | v1.0.4 | [`9c5975a`](https://github.com/openzeppelin/openzeppelin-contracts/tree/9c5975a) | New Alchemy | Everything | [🔗](./2017-03.md) |
| Date | Version | Commit | Auditor | Scope | Links |
| ------------ | ------- | --------- | ------------ | -------------------- | ----------------------------------------------------------- |
| October 2023 | v5.0.0 | `b5a3e69` | OpenZeppelin | v5.0 Changes | [🔗](./2023-10-v5.0.pdf) |
| May 2023 | v4.9.0 | `91df66c` | OpenZeppelin | v4.9 Changes | [🔗](./2023-05-v4.9.pdf) |
| October 2022 | v4.8.0 | `14f98db` | OpenZeppelin | ERC4626, Checkpoints | [🔗](./2022-10-ERC4626.pdf) [🔗](./2022-10-Checkpoints.pdf) |
| October 2018 | v2.0.0 | `dac5bcc` | LevelK | Everything | [🔗](./2018-10.pdf) |
| March 2017 | v1.0.4 | `9c5975a` | New Alchemy | Everything | [🔗](./2017-03.md) |
# Formal Verification

View File

@ -2,14 +2,14 @@
These instructions detail the process for running Certora Verification Tool on OpenZeppelin Contracts.
Documentation for CVT and the specification language is available [here](https://certora.atlassian.net/wiki/spaces/CPD/overview).
Documentation for CVT and the specification language are available [here](https://certora.atlassian.net/wiki/spaces/CPD/overview).
## Prerequisites
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 on a Github Actions' CI environment on selected Pull Requests.
## Running the verification

View File

@ -7,16 +7,11 @@
// node certora/run.js AccessControl
// node certora/run.js AccessControlHarness:AccessControl
import { spawn } from 'child_process';
import { PassThrough } from 'stream';
import { once } from 'events';
import path from 'path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import pLimit from 'p-limit';
import fs from 'fs/promises';
const proc = require('child_process');
const { PassThrough } = require('stream');
const events = require('events');
const argv = yargs(hideBin(process.argv))
const argv = require('yargs')
.env('')
.options({
all: {
@ -26,7 +21,7 @@ const argv = yargs(hideBin(process.argv))
spec: {
alias: 's',
type: 'string',
default: path.resolve(import.meta.dirname, 'specs.json'),
default: __dirname + '/specs.json',
},
parallel: {
alias: 'p',
@ -43,20 +38,18 @@ const argv = yargs(hideBin(process.argv))
type: 'array',
default: [],
},
})
.parse();
}).argv;
function match(entry, request) {
const [reqSpec, reqContract] = request.split(':').reverse();
return entry.spec == reqSpec && (!reqContract || entry.contract == reqContract);
}
const specs = JSON.parse(fs.readFileSync(argv.spec, 'utf8')).filter(s => argv.all || argv._.some(r => match(s, r)));
const limit = pLimit(argv.parallel);
const specs = require(argv.spec).filter(s => argv.all || argv._.some(r => match(s, r)));
const limit = require('p-limit')(argv.parallel);
if (argv._.length == 0 && !argv.all) {
console.error(`Warning: No specs requested. Did you forget to toggle '--all'?`);
console.error(`Warning: No specs requested. Did you forgot to toggle '--all'?`);
}
for (const r of argv._) {
@ -71,13 +64,12 @@ if (process.exitCode) {
}
for (const { spec, contract, files, options = [] } of specs) {
limit(() =>
runCertora(
spec,
contract,
files,
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
),
limit(
runCertora,
spec,
contract,
files,
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
);
}
@ -87,7 +79,7 @@ async function runCertora(spec, contract, files, options = []) {
if (argv.verbose) {
console.log('Running:', args.join(' '));
}
const child = spawn('certoraRun', args);
const child = proc.spawn('certoraRun', args);
const stream = new PassThrough();
const output = collect(stream);
@ -111,7 +103,7 @@ async function runCertora(spec, contract, files, options = []) {
});
// wait for process end
const [code, signal] = await once(child, 'exit');
const [code, signal] = await events.once(child, 'exit');
// error
if (code || signal) {
@ -160,7 +152,7 @@ function writeEntry(spec, contract, success, url) {
formatRow(
spec,
contract,
success ? ':heavy_check_mark:' : ':x:',
success ? ':x:' : ':heavy_check_mark:',
url ? `[link](${url?.replace('/output/', '/jobStatus/')})` : 'error',
url ? `[link](${url})` : 'error',
),

View File

@ -176,7 +176,7 @@ rule renounceRoleEffect(env e, bytes32 role) {
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: defaultAdmin is only affected by accepting an admin transfer or renouncing
Rule: defaultAdmin is only affected by accepting an admin transfer or renoucing
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noDefaultAdminChange(env e, method f, calldataarg args) {
@ -188,7 +188,7 @@ rule noDefaultAdminChange(env e, method f, calldataarg args) {
f.selector == sig:acceptDefaultAdminTransfer().selector ||
f.selector == sig:renounceRole(bytes32,address).selector
),
"default admin is only affected by accepting an admin transfer or renouncing";
"default admin is only affected by accepting an admin transfer or renoucing";
}
/*

View File

@ -18,7 +18,7 @@ methods {
*/
ghost mapping(address => mathint) trackedMintAmount;
ghost mapping(address => mathint) trackedBurnAmount;
ghost mapping(address => mapping(address => mathint)) trackedTransferredAmount;
ghost mapping(address => mapping(address => mathint)) trackedTransferedAmount;
function specUpdate(address from, address to, uint256 amount) {
if (from == 0 && to == 0) { assert(false); } // defensive
@ -28,7 +28,7 @@ function specUpdate(address from, address to, uint256 amount) {
} else if (to == 0) {
trackedBurnAmount[from] = amount;
} else {
trackedTransferredAmount[from][to] = amount;
trackedTransferedAmount[from][to] = amount;
}
}
@ -51,5 +51,5 @@ rule checkMintAndBurn(env e) {
assert trackedMintAmount[receiver] == to_mathint(amount);
assert trackedBurnAmount[receiver] == amount + to_mathint(recipient == 0 ? fees : 0);
assert (fees > 0 && recipient != 0) => trackedTransferredAmount[receiver][recipient] == to_mathint(fees);
assert (fees > 0 && recipient != 0) => trackedTransferedAmount[receiver][recipient] == to_mathint(fees);
}

View File

@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/AccessControl.sol)
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
@ -65,7 +65,9 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
_;
}
/// @inheritdoc IERC165
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
@ -189,7 +191,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
}
/**
* @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/IAccessControl.sol)
// OpenZeppelin Contracts (last updated v5.1.0-rc.1) (access/IAccessControl.sol)
pragma solidity >=0.8.4;
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC-165 detection.
@ -23,7 +23,7 @@ interface IAccessControl {
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted to signal this.
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

Some files were not shown because too many files have changed in this diff Show More