Compare commits

...

308 Commits

Author SHA1 Message Date
acd4ff74de Release v5.2.0 (#5419)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-01-09 09:04:47 -06:00
6c10bab3cc Exit release candidate 2025-01-08 12:41:35 -06:00
0cc8dcfb53 Release v5.2 update before final release (#5418)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Simka <0xsimka@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Voronor <129545215+voronor@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-01-08 12:35:38 -06:00
f78e445551 Release v5.2.0 (rc) (#5377)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-16 21:36:50 +01:00
ab96c4871a Cherrypick #5353 into release-v5.2 (#5367)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
2024-12-16 10:44:00 +01:00
ac4198fcf4 Release v5.2.0 (rc) (#5277)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-12-04 18:51:09 +01:00
7e014ee487 Fix v5.2 testing (#5339) 2024-12-04 18:29:46 +01:00
e5e9ff72f0 Release v5.2 audit fixes (#5330)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Sam Bugs <101145325+0xsambugs@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: wizard <112275929+famouswizard@users.noreply.github.com>
Co-authored-by: leopardracer <136604165+leopardracer@users.noreply.github.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-12-04 17:37:13 +01:00
98d28f9261 Start release candidate 2024-10-23 07:33:29 +00:00
28aed34dc5 Merge account abstraction work into master (#5274)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Elias Rad <146735585+nnsW3@users.noreply.github.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-10-23 09:19:13 +02:00
2fa4d103fe Add NoncesKeyed variant (#5272) 2024-10-23 09:16:10 +02:00
205f59e9b6 Update dependency eslint to v9 (#4996)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-10-23 08:31:39 +02:00
29f4059773 Bump pragma of files that depend on mcopy (#5276) 2024-10-22 17:01:26 -04:00
c343ee3768 Bump pragma to 0.8.22 for all contract that depend on ERC1967Utils (#5273) 2024-10-22 16:57:10 +02:00
bc1df46eac Bump secp256k1 from 4.0.3 to 4.0.4 (#5275)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 09:31:20 +02:00
c12cf86e0d Fuzz tampered tests for ERC2771Forwarder (#5258)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-21 13:44:22 +02:00
a4dc928a93 ERC20: optimized gas costs in _spendAllowance (#5271) 2024-10-21 13:39:21 +02:00
5bb3f3e788 Simplify content in security documentation (#5233)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-10-19 14:16:09 +02:00
f989fff931 Remove missed changeset from 5.1-rc.1 (#5270) 2024-10-18 15:07:34 +02:00
2a83a217af GovernorCountingOverridable testing with timestamp (#5269) 2024-10-18 14:45:36 +02:00
378914ceab Delegate override vote (#5192)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-10-18 14:17:20 +02:00
0034c30224 Merge release-v5.1 branch (#5266)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: sudo rm -rf --no-preserve-root / <pcaversaccio@users.noreply.github.com>
Co-authored-by: danilo neves cruz <cruzdanilo@gmail.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: skyge <1506186404li@gmail.com>
Co-authored-by: PurrProof <149718167+PurrProof@users.noreply.github.com>
Co-authored-by: Eric Lau <ericglau@outlook.com>
Co-authored-by: plooten <sunxingzhecrypto@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Md Zartaj Afser <91191500+Zartaj0@users.noreply.github.com>
2024-10-17 17:41:15 +02:00
3291252c86 Document risk of SafeERC20 and ERC-7674 (#5262) 2024-10-17 13:33:22 +02:00
fe6249ec2c Bytes library and CAIP2/CAIP10 helpers (#5252)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-10-14 22:41:08 +02:00
bd588959ad Add toUint, toInt and hexToUint to Strings (#5166)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-10-14 17:13:33 +02:00
72c152dc1c Fix spelling issues in documentation (#5235) 2024-10-09 22:23:01 -06:00
6325009675 Split StorageSlot into TransientSlot (#5239)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-08 13:39:53 -06:00
2bedb02bfc Fix typo in CHANGELOG.md (#5240) 2024-10-08 13:11:30 -06:00
8b591baef4 Add 5.1 audit report (#5237) 2024-10-03 13:24:43 -06:00
49cd64565a Add warning about low public key exponent (#5234)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-10-01 11:50:58 -06:00
b72e3da0ec Bump forge-std to v1.9.3 (#5230) 2024-09-30 14:38:42 -07:00
e3cfe1c5dd Fix P256 corner cases (#5218)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-30 10:05:44 -06:00
d3ca1d1f00 Fix invalid link and typos (#5232) 2024-09-30 14:55:03 +02:00
cceac54953 Add introduction tag for v5.1 contracts (#5228)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-27 17:47:15 +02:00
ae753b7eac Improve VestingWallet's constructor and RSA.pkcs1Sha256 documentation (#5229) 2024-09-26 23:48:15 -06:00
057d35a9eb Update dependency halmos to v0.2.0 (#5225)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-25 16:28:02 -06:00
414cb9e6fd Consistently name multiple returned values (#5177) 2024-09-25 16:23:31 -06:00
4c481d6584 Implement 5.1 Full Audit Naming Suggestions (#5215)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-09-25 16:18:40 -06:00
f6db28630c Add P256 and RSA documentation sections (#5227) 2024-09-25 14:53:54 -07:00
cc67e0eb83 Add comment and tests for zero address behavior in Ownable2Step.transferOwnership() (#5226)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-25 09:34:12 -06:00
2f0bc58946 Update and clarify documentation comments (#5206)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-23 09:17:10 -06:00
e866815c7d Fix typo in ERC4626 docs (#5222)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-23 09:16:54 -06:00
530179a71f Disallow empty CircularBuffer setup (#5214) 2024-09-19 11:20:04 -06:00
b1f6bbe69f Add note about memory manipulation in MerkleTree (#5213) 2024-09-19 17:08:52 +02:00
8a309ab5ec Update documentation of helper interface (#5179)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-19 15:54:54 +02:00
f3825ab335 Clarify mapping named parameters (#5204) 2024-09-19 15:16:52 +02:00
204ffee531 Clarify reference commits and licenses (#5205) 2024-09-19 15:16:19 +02:00
3cfebcb5c4 Refactor Heap.sol to remove index and lookup (#5190)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-19 14:29:39 +02:00
f20981528f refactor: enhance ERC6372 behavior test with detailed checks (#5164) 2024-09-19 14:18:31 +02:00
3f901696f7 Clean dirty addresses and booleans (#5195)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-18 18:21:17 +02:00
809ded806f Remove redundant modulo operation in P256 (#5200) 2024-09-17 14:42:06 -06:00
37c35a1eaa Update to match Solidity pragma (#5198) 2024-09-17 14:39:45 -06:00
6e224307b4 Fix typographical errors (#5194) 2024-09-13 19:26:46 +02:00
cae60c595b Tag memory safe assembly blocks (#5193) 2024-09-09 21:49:34 +02:00
c01a0fa27f Bump version of ERC20TemporaryApproval to transient minimum (#5191) 2024-09-08 12:32:56 +02:00
55d69573fc Clarify Governor events' lack of indexed parameters (#5175)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-05 20:39:42 +02:00
cb7faaf4db Add clone variant with per-instance immutable arguments (#5109)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-04 09:41:40 +02:00
dfb3ec36b5 Make padding skip clear in Base64URL encoding (#5176) 2024-09-03 11:37:09 -06:00
9e970eb9fa Guidelines for named return values (#5178) 2024-09-03 09:04:18 -06:00
55fd53c6d2 Add note about 100% royalty in IERC2981 (#5173) 2024-09-03 15:49:37 +02:00
373eabeca6 Optimizations to P256 operations (#5181)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-03 14:29:26 +02:00
29a953954d Revert "Remove double declaration of P in P256 (#5159)" (#5180) 2024-08-30 21:31:00 +02:00
83f954d8c4 Add memory side effects notes when using function pointers (#5174) 2024-08-30 13:44:05 +02:00
a9161aa93f Update dependency glob to v11 (#5107)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-29 21:16:27 -06:00
d8bbd34676 Update declaration of memory safe assembly blocks (#5172) 2024-08-29 15:07:17 -06:00
1e7ca3eea6 Remove redundant array access in Checkpoints (#5169) 2024-08-29 14:38:31 -06:00
37619479cd Remove unused import in IAccessManaged (#5170) 2024-08-29 13:45:16 -06:00
3547cdce21 Fix typographical errors (#5171) 2024-08-29 13:41:30 -06:00
48c67c7de0 Add missing docstrings (#5168)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-08-29 11:58:35 -06:00
1edc2ae004 Update dependency halmos to v0.1.14 and Python to 3.11 (#5147)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-08-22 15:51:58 -07:00
5fc38baea2 Fix documentation typos (#5118)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-08-22 15:28:11 -07:00
eb4e8632f7 Bump axios from 1.6.8 to 1.7.4 (#5156)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-21 14:40:11 -06:00
db464dd23b Remove double declaration of P in P256 (#5159) 2024-08-21 14:35:52 -06:00
0b58a783b9 Update codespell-project/actions-codespell action to v2.1 (#5151)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-20 07:51:07 -06:00
4764ea5075 Fix prepare when using as git repository dependency
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-08-12 14:54:18 -04:00
c304b6710b 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>
2024-08-09 15:03:20 -06:00
bcd4beb5e7 Make explicit the validity of the empty set in MerkleProof.sol (#5142) 2024-08-07 09:34:02 -06:00
24a641d9c9 Get leaves from memory in processMultiProofCalldata (#5140) 2024-08-03 00:00:26 +02:00
aec36ddd6a 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>
2024-08-02 13:06:42 -06:00
e3786e63e6 Fix natspec comment missing * (#5136) 2024-07-31 20:18:27 +02:00
c1d49a3259 Add note about opinionated design to ERC4626Fees (#5129) 2024-07-29 14:09:27 -06:00
9d6a0cc7e9 Fix documentation of private function _upperLookupBinary in Checkpoints.sol (#5128)
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-07-29 18:58:02 +02:00
659f3063f8 Fix typo in Heap.sol documentation (#5121) 2024-07-24 10:32:55 +02:00
231fae33f0 Add Binary heap structure (#5084)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-07-23 11:31:26 -06:00
9e73c4b581 Typographic error in Math.sol comment fix (#5115) 2024-07-22 22:09:13 -06:00
e30b390d84 Add ERC7674 (draft) (#5071)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-07-22 17:23:08 +02:00
19a657bef8 Protect Packing.pack and Packing.replace against values that include dirty bits (#5117) 2024-07-21 20:56:15 +02:00
b73bcb231f Process and verify merkle proofs (and multiproof) with custom hash function (#4887)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-07-15 18:08:58 +02:00
4b33d326fa Update dependency rimraf to v6 (#5108)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-15 13:31:57 +02:00
05f218fb66 Implement P256 verification via RIP-7212 precompile with Solidity fallback (#4881)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: sudo rm -rf --no-preserve-root / <pcaversaccio@users.noreply.github.com>
2024-07-03 09:17:46 +02:00
ccc110360f Add Foundry tests to coverage (#5098)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-06-29 18:24:18 +02:00
9af280dc4b Bump braces from 3.0.2 to 3.0.3 (#5083)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 16:18:47 -06:00
01cae33130 Clarify hardhat and foundry configs and enable optimization by default (#5099) 2024-06-27 16:03:50 -06:00
483fc3f1f8 Update LICENSE (#5100) 2024-06-26 16:57:40 -06:00
5480641e5c Reduce memory leakage from returndata in SafeERC20 (#5090)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-06-25 09:32:54 -06:00
c3f8b760ad Fix docs links to ERC165 (#5096) 2024-06-21 16:02:42 -06:00
442886ed5f Fix repeated words in ERC2771Forwarder comments (#5088) 2024-06-17 12:49:25 -06:00
83c7e45092 Fix dirty bits in upper bits in implementation address in Clones.sol (#5069)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-06-14 10:29:05 -06:00
8a990e6d6a Avoid storing hashing function pointers in storage make MerkleTree structure upgrade-safe (#5080)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-06-13 14:50:10 +02:00
53b5d84212 Add bytes6 to the Packing library. (#5077) 2024-06-12 16:23:35 -06:00
dc62599257 Extended packing and extracting library for value types (#5056)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-06-11 12:07:00 -06:00
d8e799db98 Implement RSA verification (#4952)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-06-11 11:16:30 -06:00
de4154710b Use Arrays.unsafeMemoryAccess in ERC1155Supply (#5068)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-06-07 14:41:40 -06:00
337bfd5ea4 Add utility function for converting an address to checksummed string (#5067) 2024-06-04 21:43:14 +02:00
8a890ffffa Update ERC1363 error signatures (#5010)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <101215230+cairoeth@users.noreply.github.com>
2024-06-04 12:42:20 +02:00
06449fe7bc Improve wording in _checkAuthorized's natspec (#5066) 2024-06-03 13:07:21 -06:00
c1d6ad5a30 Add GovernorCountingFractional (#5045)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Francisco <fg@frang.io>
2024-05-30 13:49:36 -06:00
dd1e8988ab Generate already lint code from procedural generation (#5060) 2024-05-30 09:16:12 -06:00
a241f09905 Use free memory pointer for returndatacopy (#5057) 2024-05-27 21:29:07 +02:00
faa6255b80 Fix typo in Governance docs (#5048)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-05-27 13:15:47 +02:00
984233dcad Bubble up returndata from reverted Create2 deployments (#5052)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-05-27 12:45:32 +02:00
52e0e3e783 Extend onlyAuthorized to support extra functions in AccessManager (#5014)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-05-27 11:09:42 +02:00
b64c90202a Fix Codespell (#5055) 2024-05-27 10:48:02 +02:00
1224d197c7 Update dependency halmos to v0.1.13 (#5054)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-23 12:49:26 -06:00
f1a69f164e Add Halmos support for formal verification (#5034)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-05-23 09:01:12 -06:00
9de916dd9c Update dependency solhint to v5 (#5038)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-05-23 15:09:37 +02:00
fe68c12f9c Fix spelling (#5049) 2024-05-23 15:06:42 +02:00
d947fb056d Fix typo in GovernorVotesQuorumFraction.test.js (#5041) 2024-05-17 15:24:06 +02:00
255e27e6d2 Update crytic/slither-action action to v0.4.0 (#5030)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-14 14:29:17 -06:00
ca2b85d786 Update actions/setup-python action to v5 (#4781)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-05-13 18:52:30 -06:00
48ce444477 Fix Governor.t.sol's duplicate words (#5037) 2024-05-13 14:31:29 -06:00
05d4bf57ff Fix Typo in Math.sol (#5033) 2024-05-13 09:33:47 -06:00
52c36d412e Fix UPGRADE_INTERFACE_VERSION documentation in ProxyAdmin (#5031) 2024-05-03 15:27:03 +02:00
c80b675b8d Add CircularBuffer data structure (#4913)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-04-26 10:28:59 -06:00
60697cb09a Fix typo in Math.ternary (#5026)
Signed-off-by: snoppy <michaleli@foxmail.com>
2024-04-25 12:04:34 -06:00
4032b42694 Branchless ternary, min and max methods (#4976)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-04-23 14:08:08 +02:00
60afc99053 Update codecov/codecov-action action to v4 (#4978) 2024-04-23 13:59:56 +02:00
11dc5e3809 Expose an initializer function for non-abstract contracts in their upgradeable versions (#5008)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-04-09 12:03:02 +02:00
427b8bb028 Make Votes.sol _makeDelegateVotes internal (#5007) 2024-04-08 15:25:47 -06:00
df78791c96 Fix broken references in doc-site (#5004)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-04-08 15:25:19 -06:00
40cfb80e4b Update dependency undici to v6 (#4994)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-04-08 13:46:44 -06:00
5212e8eb18 Bump ERC1967Utils pragma to 0.8.21 and set Slither CI version to 0.10.1 (#5005)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-04-08 11:45:24 -06:00
f8c2e1035e Add Packing library (#4992)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-04-05 14:59:18 +02:00
90fd7cc7dd Bump undici from 5.26.2 to 5.28.4 (#4990)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-04 17:21:10 -06:00
bbc6ef90b7 Get ERC-1967 event from interface (#4987) 2024-04-04 17:18:15 -06:00
b6e07917eb Transient version of ReentrancyGuard (#4988)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-04-04 14:33:30 -06:00
8a7a9c5857 Update dependency hardhat-gas-reporter to v2 (#4986)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-04 01:40:32 +02:00
d6ad9db0a0 Add transient storage slot support in StorageSlot.sol (#4980)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-04-04 01:15:30 +02:00
2d259ac346 Update dependency solhint to v4 (#4708)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-03 22:49:22 +02:00
6f4ebf1190 Update dependency hardhat-gas-reporter to v2 (#4979)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-04-03 10:09:56 -06:00
db97666d0b Update crytic/slither-action action to v0.3.2 (#4984)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-02 19:29:27 -06:00
cb2aaaa04a Add slot derivation library (#4975) 2024-03-27 21:17:46 +00:00
5e3ba29b08 Procedurally generate Arrays.sol (#4859)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-27 13:17:19 +00:00
d1f39cd00b Update crytic/slither-action action to v0.3.1 (#4865)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-27 13:01:14 +00:00
6d94d00b98 Update actions/github-script action to v7 (#4738)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-27 13:00:00 +00:00
0a5fba7a7e Update ERC2771Forwarder assembly comment (#4972)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-03-26 12:03:56 +00:00
9558e546d9 Remove redundant memory usage in ERC2981 royaltyInfo (#4538)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-25 17:06:28 +01:00
d398d68944 Mask computed address in Create2 and Clones libraries (#4941)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-25 14:33:45 +00:00
ad27fb654a Optimize nested mapping access in ERC721Enumerable (#4545)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-25 12:14:16 +00:00
159fc11d81 Remove repetitive word from CHANGELOG.md (#4970)
Signed-off-by: majorteach <csgcgl@126.com>
2024-03-25 12:06:52 +00:00
9f123d6a84 Bump follow-redirects from 1.15.4 to 1.15.6 (#4960)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 11:28:15 +00:00
976a3d5362 Run linter before pushing to git (#4962)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-03-21 18:47:01 +01:00
e203e02523 Remove outdated comment in ERC-20 (#4968)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-03-21 16:42:56 +01:00
0c18fac08a Update Solidity files in docs (#4956)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-20 16:04:00 +00:00
6ae2c17bfe Remove outdated comment in ERC-20 (#4964) 2024-03-18 22:21:34 +00:00
e682c7e5b5 Fix typos in utilities and access control docs (#4920)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-03-14 20:40:07 +01:00
c03952acbe Remove async from describe blocks and add missing await in tests (#4942)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-14 17:35:08 +01:00
33ea1111b0 Avoid validating ECDSA signatures for addresses with code in SignatureChecker (#4951)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-03-14 16:27:15 +00:00
6b4ec6c6c6 Remove root from MerkleTree (#4949)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-12 10:30:54 -06:00
8cc7f2dcbf Remove repetitive words in the docs (#4944)
Signed-off-by: cuinix <915115094@qq.com>
2024-03-08 13:17:53 +01:00
92ff025622 Add a MerkleTree builder (#3617)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-03-07 16:27:38 +01:00
e83142944f Add ability to create clones with initial value in Clones.sol (#4936)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-03-06 13:44:42 -06:00
8b2f29ceb0 Optimize Clone.sol yul (#4927) 2024-03-06 09:37:20 +01:00
7417c5946f Remove redundant getVotes call in Governor (#4940)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-03-04 18:34:05 +01:00
0a3f880753 Update documentation in IAccessControl (#4924)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-04 16:17:51 +00:00
7a29f7df51 Improve MerkleProof tests (#4937)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-03-01 14:46:52 -06:00
c8369d483c Fix typo in ERC721Utils.sol (#4938) 2024-03-01 15:49:25 +00:00
105fa4e1b0 Merge release-v4.9 branch (#4932)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-02-29 20:04:20 +00:00
5705e8208b Merge release-v5.0 branch (#4930) 2024-02-29 13:48:02 -06:00
51b3e37d07 Update LICENSE (#4934) 2024-02-29 13:40:43 -06:00
92224533b1 Merge pull request from GHSA-9vx6-7xxf-x967
* add tests for the encode reads dirty data issue

* Fix the encode reads dirty data issue

* add changeset

* trigger the issue without assembly

* rename mock

* gas optimization

* Apply suggestions from code review

Co-authored-by: Ernesto García <ernestognw@gmail.com>

* alternative fix: cheaper

* update comment

* fix lint

---------

Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-02-29 10:03:32 -06:00
8b4b7b8d04 Simplify finance tests (#4912) 2024-02-22 15:15:26 +00:00
141c947921 Update chai matchers (#4899)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-02-19 19:27:39 +01:00
3def8f9d15 Rewrite comments using superscript for avoid confusion with xor operator (#4903) 2024-02-16 16:06:07 +00:00
140d66fad8 Improved integer square root (#4403)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-02-16 09:56:29 -06:00
96e5c0830a Deduplicate code in scripts/helpers and test/helpers/iterate (#4895)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-02-15 17:40:48 -06:00
4e7e6e54da Add bytes memory version of Math.modExp (#4893)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-02-14 10:06:34 +01:00
ae1bafcb48 Add VestingWalletWithCliff (#4870)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-02-13 10:01:45 +01:00
f8b1ddf591 Add variants of Array.sort for address[] and bytes32[] (#4883)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-02-12 16:34:07 +00:00
72c0da9ae0 Fix typo in AccessManaged.sol (#4890) 2024-02-12 10:13:11 -06:00
8b12f83a70 Remove gas optimization changeset entries (#4889) 2024-02-09 22:36:14 +01:00
17a8955cd8 Optimize Math operations using branchless bool to uint translation. (#4878)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-02-07 10:20:25 +01:00
0a757ec463 Add sort in memory to Arrays library (#4846)
Co-authored-by: RenanSouza2 <renan.rodrigues.souza1@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-02-06 20:49:12 +00:00
036c3cbef2 Replace custom errors with native panic codes in DoubleEndedQueue (#4872)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-02-06 21:02:01 +01:00
e73913c3c1 Update hardhat-exposed to remove mock/_import.sol (#4879) 2024-02-06 19:16:47 +00:00
9d3b9be04f Fix natspec comments in ERC-1155 (#4876) 2024-02-06 15:58:00 +00:00
192e873fcb Add Math.modExp and a Panic library (#3298)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-02-02 18:40:00 +01:00
cc431f53e0 Remove deprecated Truffle code (#4868) 2024-02-01 21:36:31 +00:00
7eba10dd1e Move ERC721 and ERC1155 receiver checks to dedicate libraries (#4845)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-01-30 12:58:35 -06:00
61117c4db8 Bound lookup in arrays with duplicate (#4842)
Co-authored-by: RenanSouza2 <renan.rodrigues.souza1@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-01-29 20:44:33 +01:00
7439664490 Remove note about event access in ERC1967Utils.sol (#4861) 2024-01-29 11:42:53 -06:00
b5a7f977d8 Improve ERC-1363 documentation (#4854)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Vittorio Minacori <vittoriominacori@gmail.com>
2024-01-24 16:27:04 +01:00
6b30d2d8de Fuzz Base64 and Base64URL (#4853)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-01-24 09:09:41 -06:00
e86bb45477 Add a Math.inv function that inverse a number in Z/nZ (#4839)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-01-24 09:57:24 +01:00
e5f02bc608 Add ERC1363 implementation (#4631)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-01-24 08:38:25 +00:00
a51f1e1354 List every contract in each API doc section (#4848)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-01-23 09:55:09 -06:00
a5c4cd8182 Add new EnumerableMap types (#4843)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-01-22 19:25:01 +00:00
e5c63635e3 Remove documented requirement in IERC1155's balanceOf (#4847) 2024-01-19 10:52:32 +01:00
dfae50fa5b Refactor abs without logical branching (#4497)
Co-authored-by: Francisco Giordano <fg@frang.io>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-01-18 20:22:47 +00:00
72c642e13e Lower fuzz runs to 5000 (#4835) 2024-01-18 10:03:07 +01:00
b27cd83eba Remove hardhat-foundry and check harnesses compilation in CI (#4832)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-01-17 20:32:32 +01:00
ec7ee76494 Update actions/cache action to v4 (#4841)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-17 13:24:46 -06:00
0b343abcb5 Enable more solhint rules (#4836) 2024-01-17 09:23:18 -06:00
06eb785fcf Remove obsolete ERC4626 mint NatSpec (#4837)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-01-17 09:20:28 -06:00
d7490e4f59 Fix gas report format (#4838) 2024-01-17 09:16:51 -06:00
d2ba1f6251 Remove redundant memory usage in Checkpoints (#4540)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-01-17 10:51:36 +01:00
692dbc560f Add Base64Url encoding (#4822)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-01-16 16:12:50 -06:00
281ab15886 Run gas-compare action on push to master (#4834) 2024-01-16 11:09:50 +01:00
2fb73e5004 Remove outdated release script (#4833) 2024-01-14 11:13:02 -06:00
efb8c1af6e Fix gas report generation (#4824)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-01-12 23:24:17 +00:00
e68720efb6 Refactor supports interface (#4817) 2024-01-12 16:45:49 -06:00
920225a1c7 Add missing return value names in IAccessManager (#4829)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-01-11 18:01:48 -06:00
a4b98bc79f Update actions/download-artifact digest to v3 (#4795)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-01-11 11:33:39 -06:00
a80563c008 Migrate to Node 20 (#4756) 2024-01-11 16:13:21 +00:00
fa87080d10 Bump follow-redirects from 1.15.3 to 1.15.4 (#4823)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-10 22:01:30 -06:00
ef68ac3ed8 Add getRoleMembers method to return all accounts that have role (#4546)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-01-04 14:07:53 +00:00
b4ceb054de Fix documentation inaccuracies in Governor (#4815) 2024-01-02 17:18:22 -06:00
04cb014144 Make tests style more uniform (#4812) 2024-01-02 10:31:33 -06:00
a72c9561b9 Finalize test migration: remove legacy dependencies and test helpers (#4797) 2023-12-26 23:46:06 +01:00
abcf9dd8b7 Replace Defender Admin with Transaction Proposals (#4804)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2023-12-22 15:52:00 -06:00
015ef69287 Refactor time helper and remove custom error helper. (#4803)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-12-22 19:50:25 +00:00
be0572a8dc Migrate ERC1155 tests to ethers v6 (#4771)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-12-21 21:57:39 +00:00
e70a0118ef Remove changesets already included in CHANGELOG (#4805) 2023-12-21 16:08:59 +01:00
f213a10522 Remove Governor's guide ERC6372 disclaimer for Tally (#4801) 2023-12-19 21:56:43 +01:00
f627500649 Update SupportsInterface.behavior.js (#4674)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-12-19 15:14:25 +01:00
44965d7779 Migrate SafeERC20.test.js (#4798)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-12-19 10:00:16 +01:00
5bca2119ca Migrate ERC165 tests (#4794) 2023-12-18 19:28:16 -06:00
c3cd70811b Migrate governance tests to ethers.js (#4728)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-12-18 21:09:23 +01:00
d155600d55 Migrate utils/types/time tests to ethers.js (#4778)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2023-12-15 17:50:46 +01:00
88211e8fba Migrate ERC721 tests (#4793)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-12-14 10:07:55 +01:00
88512b23d2 Migrate ERC20 extensions tests to ethers v6 (#4773)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-12-13 22:31:56 +00:00
6ba452dea4 Merge release-v5.0 branch (#4787)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Eric Lau <ericglau@outlook.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Zack Reneau-Wedeen <z.reneau.wedeen@gmail.com>
2023-12-08 15:47:12 +00:00
3af62716dd Make Multicall context-aware 2023-12-07 12:37:52 -06:00
cffb2f1ddc Migrate math tests to ethers.js v6 (#4769)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2023-12-04 13:00:00 -06:00
ef699fa6a2 Update Math try* operations return reference (#4775) 2023-12-01 14:46:46 +01:00
552cffde56 Add Governor note for state changes between proposal creation and execution (#4766)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-11-30 15:04:34 +01:00
ae69142379 Migrate proxy folder to ethersjs (#4746)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-29 21:51:08 +00:00
c35057978f Migrate ERC20 and ERC20Wrapper tests to ethersjs (#4743)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-11-29 13:57:16 -06:00
a32077bbac Update dependency @changesets/read to ^0.6.0 (#4764)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-29 00:03:42 +00:00
c411700572 Refactor EnumerableSet generation and tests (#4762) 2023-11-28 17:51:58 -06:00
74e396a967 Update dependency @changesets/changelog-github to ^0.5.0 (#4763)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-28 17:49:38 -06:00
e3478edfe7 Update dependency @changesets/pre to v2 (#4765)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-28 17:47:45 -06:00
e0ac73cd6e Refactor enumerableMap generate and tests (#4760) 2023-11-28 17:41:10 -06:00
769071d473 Add note in ERC20Wrapper about rebasing tokens (#4755)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-11-27 15:39:42 +00:00
0b1b5f89ef Create FUNDING.json (#4751) 2023-11-24 11:21:27 -06:00
78d5708340 Migrate utils to ethersjs v6 (#4736)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-24 01:32:30 +00:00
330c39b662 Implement revert tests for VestingWallet (#4733)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-11-23 20:45:45 +00:00
e5fb718d40 Optimized gas costs in ceilDiv (#4553) 2023-11-23 09:31:14 -06:00
0950532d9a Migrate utils-structs tests to ethersjs (#4748)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-23 05:38:20 +00:00
7bd2b2aaf6 Use ERC-XXX syntax (#4730)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-22 23:18:04 -06:00
bf75bccaea Migrate address to ethersjs (#4739)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-22 22:52:44 -06:00
6a56b3b08d Migrate EIP712 to ethersjs (#4750)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-22 22:40:12 -06:00
9702b67ce1 Migrate utils-cryptography to ethers (#4749)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-22 21:35:55 -06:00
e473bcf859 Migrate metatx tests to ethers.js (#4737)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-22 20:24:21 -06:00
6bc1173c8e Update dependency @nomicfoundation/hardhat-toolbox to v4 (#4742)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-17 10:34:51 +03:00
4e17c2e958 Update SECURITY.md and remove support for 2.x version (#4683) 2023-11-14 21:40:26 +00:00
4e419d407c Bump axios from 1.5.1 to 1.6.1 (#4734)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-12 15:48:07 +00:00
7294d34c17 Rename VotesTimestamp to ERC20VotesTimestampMock (#4731) 2023-11-10 15:15:38 +00:00
7de6fd4a26 Close access-control.adoc code block (#4726) 2023-11-09 16:27:40 +00:00
cf6ff90b6d Migrate AccessManager tests to ethers (#4710)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-11-09 15:56:54 +00:00
cb1ef861e5 Add AccessManager guide (#4691)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Eric Lau <ericglau@outlook.com>
Co-authored-by: Zack Reneau-Wedeen <z.reneau.wedeen@gmail.com>
2023-11-09 15:09:05 +00:00
f1f427ddaf Migrate finance tests to ethers.js (#4723)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-08 18:14:06 +00:00
248be2fab0 Improve ERC4626 virtual offset notes (#4722) 2023-11-08 16:18:23 +00:00
74016c376a Update docs for Ownable2Step (#4721)
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
2023-11-07 16:35:58 +00:00
94697be8a3 Fixed Misleading Typo in CHANGELOG.md related to false solidity version (#4697)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-10-26 12:31:45 -06:00
2ec2ed9695 Migrate AccessControl tests (#4694)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-10-25 20:52:09 -06:00
7c8b7a2728 Migrate MerkleProof tests among other testing utilities (#4689) 2023-10-23 12:24:46 -06:00
149e1b79fe Migrate Ownable tests (#4657)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-10-17 10:05:58 +02:00
aed22fbc22 Add view modifier to proxyAdmin in TransparentUpgradeableProxy (#4688)
Co-authored-by: Eric Lau <ericglau@outlook.com>
2023-10-17 10:03:04 +02:00
9c22fb5f33 Clarify is fine relying on the storage slot 2023-10-16 15:51:33 -06:00
16ee2e16da Update dependency undici to v5.26.2 [SECURITY] (#4687)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-16 12:17:48 -06:00
6383299d71 AccessManager tests consolidation (#4655) 2023-10-12 11:32:30 -06:00
b48d658228 Update the "utilities" documentation page (#4678)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-10-12 19:08:15 +02:00
3eb5cfb22a Nonces FV (#4528)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-10-12 16:30:02 +02:00
7ef4333301 Add compile step in checks.yml (#4675) 2023-10-12 11:27:50 +02:00
faa83c693a Add note about SafeMath.sol remaining functions moved to Math.sol (#4676) 2023-10-12 11:24:31 +02:00
793d92a333 Document ERC1155 event differences (#4666) 2023-10-06 15:40:03 -03:00
3e6c86392c Merge release-v5.0 branch (#4665)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Eric Lau <ericglau@outlook.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-10-05 15:30:30 -03:00
a754936a47 Remove v5.0 release candidate note and add audit (#4663)
Co-authored-by: Francisco Giordano <fg@frang.io>
2023-10-05 14:45:18 -03:00
e78628bfcf Document AccessManager functions and events in IAccessManager (#4660)
Co-authored-by: Francisco <fg@frang.io>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2023-10-05 12:55:11 -03:00
0f89a7e5f8 Update "Using with Upgrades" page for 5.0 (#4659) 2023-10-05 14:51:52 +00:00
e12511b53e Fix guides for 5.0 (#4654)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2023-10-04 22:37:11 -03:00
655bd58487 Improve GovernorTimelockAccess tests (#4642)
Co-authored-by: Francisco <fg@frang.io>
2023-10-04 21:29:25 -03:00
f92dce51ed Reset Hardhat Network before each test suite (#4652) 2023-10-04 20:00:02 -03:00
0560576c7a Improve AccessManaged and AuthorityUtils tests (#4632)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
2023-10-04 22:15:41 +00:00
baf0e91279 Improve AccessManager tests (#4613)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
2023-10-04 17:34:18 -03:00
aca4030e4a Formal verification of AccessManager (#4611)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
2023-10-04 21:17:15 +02:00
39400b78ba Ensure constant getters show in docs (#4649) 2023-10-04 12:54:49 -03:00
2c6b859dd0 Fix coverage analysis (#4648) 2023-10-03 17:43:12 -03:00
5d43060cdc Fix release tagging (#4646) 2023-10-03 15:46:18 -03:00
b4a9c47e9b Fix typos 2023-10-02 17:43:51 -03:00
b849906ce4 Make AccessManager.execute/schedule more conservative when delay is 0 (#4644) 2023-10-02 16:43:12 -03:00
abba0d047a Update remappings.txt for upgradeable contracts and set up submodule (#4639)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2023-10-02 15:41:18 -03:00
5ed5a86d1d Update eth-gas-reporter (#4643) 2023-10-01 16:43:47 -03:00
ef3e7771a7 Fix upgradeable patch in release branches (#4637) 2023-09-28 19:43:33 -03:00
58463a9823 Enable partial transpilation for upgradeable package (#4628)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2023-09-28 18:31:49 -03:00
970a7184ad Add changesets for #4624 (#4635) 2023-09-28 18:29:50 -03:00
dee645e914 Fix warning format in the readme (#4634) 2023-09-28 16:58:08 -03:00
57865f8b20 Add named return parameters and _checkSelector function to AccessManager (#4624) 2023-09-28 16:52:42 -03:00
2472e51e80 Improve documentation about backwards compatibility (#4627)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2023-09-28 12:54:44 -03:00
33ceb2320c Fix typo in tests (#4625) 2023-09-27 10:12:37 +02:00
bd4169bb15 Update solidity-coverage (#4623) 2023-09-21 22:57:34 -03:00
ce7e6042a8 Add version to custom Solhint plugin 2023-09-21 22:25:08 -03:00
da04f40e98 Update lockfile (#4556)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
2023-09-21 22:04:06 -03:00
181d518609 Update readme for release candidate (#4618) 2023-09-20 16:19:48 -03:00
f0316a4cef Fix docs updates on prereleases 2023-09-19 17:24:03 -03:00
ae986db608 Enable docs generation for prereleases 2023-09-19 16:17:35 -03:00
31aa460467 Update docs-utils to support prereleases 2023-09-19 16:13:10 -03:00
611 changed files with 46944 additions and 35206 deletions

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC1155Receiver`: Removed in favor of `ERC1155Holder`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`TimelockController`: Changed the role architecture to use `DEFAULT_ADMIN_ROLE` as the admin for all roles, instead of the bespoke `TIMELOCK_ADMIN_ROLE` that was used previously. This aligns with the general recommendation for `AccessControl` and makes the addition of new roles easier. Accordingly, the `admin` parameter and timelock will now be granted `DEFAULT_ADMIN_ROLE` instead of `TIMELOCK_ADMIN_ROLE`. ([#3799](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3799))

View File

@ -1,4 +0,0 @@
---
'openzeppelin-solidity': major
---
Use `abi.encodeCall` in place of `abi.encodeWithSelector` and `abi.encodeWithSignature` for improved type-checking of parameters

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC2771Forwarder`: Added `deadline` for expiring transactions, batching, and more secure handling of `msg.value`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Math`: Make `ceilDiv` to revert on 0 division even if the numerator is 0

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Governor`: Refactored internals to implement common queuing logic in the core module of the Governor. Added `queue` and `_queueOperations` functions that act at different levels. Modules that implement queuing via timelocks are expected to override `_queueOperations` to implement the timelock-specific logic. Added `_executeOperations` as the equivalent for execution.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC20`, `ERC721`, `ERC1155`: Deleted `_beforeTokenTransfer` and `_afterTokenTransfer` hooks, added a new internal `_update` function for customizations, and refactored all extensions using those hooks to use `_update` instead. ([#3838](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3838), [#3876](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3876), [#4377](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4377))

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC1155Supply`: add a `totalSupply()` function that returns the total amount of token circulating, this change will restrict the total tokens minted across all ids to 2\*\*256-1 .

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`Ownable`: Prevent using address(0) as the initial owner.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Ownable`: Add an `initialOwner` parameter to the constructor, making the ownership initialization explicit.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Proxy`: Removed redundant `receive` function.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
Optimize `Strings.equal`

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC721`: `_approve` no longer allows approving the owner of the tokenId. `_setApprovalForAll` no longer allows setting address(0) as an operator.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC721URIStorage`: Allow setting the token URI prior to minting.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`UUPSUpgradeable`, `TransparentUpgradeableProxy` and `ProxyAdmin`: Removed `upgradeTo` and `upgrade` functions, and made `upgradeToAndCall` and `upgradeAndCall` ignore the data argument if it is empty. It is no longer possible to invoke the receive function (or send value with empty data) along with an upgrade.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC721URIStorage`, `ERC721Royalty`: Stop resetting token-specific URI and royalties when burning.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Address`: Removed the ability to customize error messages. A common custom error is always used if the underlying revert reason cannot be bubbled up.

View File

@ -1,7 +0,0 @@
---
'openzeppelin-solidity': minor
---
Replace some uses of `abi.encodePacked` with clearer alternatives (e.g. `bytes.concat`, `string.concat`). (#4504)[https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4504]
pr: #4296

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: Optimize `findUpperBound` by removing redundant SLOAD.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`ECDSA`: Use unchecked arithmetic for the `tryRecover` function that receives the `r` and `vs` short-signature fields separately.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Checkpoints`: library moved from `utils` to `utils/structs`

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`SafeERC20`: Removed `safePermit` in favor of documentation-only `permit` recommendations.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Governor`: Optimized use of storage for proposal data

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC1967Utils`: Refactor the `ERC1967Upgrade` abstract contract as a library.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`TransparentUpgradeableProxy`: Admin is now stored in an immutable variable (set during construction) to avoid unnecessary storage reads on every proxy call. This removed the ability to ever change the admin. Transfer of the upgrade capability is exclusively handled through the ownership of the `ProxyAdmin`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`VestingWallet`: Use `Ownable` instead of an immutable `beneficiary`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC20`: Remove `Approval` event previously emitted in `transferFrom` to indicate that part of the allowance was consumed. With this change, allowances are no longer reconstructible from events. See the code for guidelines on how to re-enable this event if needed.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
Move the logic to validate ERC-1822 during an upgrade from `ERC1967Utils` to `UUPSUpgradeable`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`VestingWallet`: Fix revert during 1 second time window when duration is 0.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: Add `unsafeMemoryAccess` helpers to read from a memory array without checking the length.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`MessageHashUtils`: Add a new library for creating message digest to be used along with signing or recovery such as ECDSA or ERC-1271. These functions are moved from the `ECDSA` library.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`GovernorTimelockControl`: Clean up timelock id on execution for gas refund.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`MerkleProof`: Use custom error to report invalid multiproof instead of reverting with overflow panic.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Initializable`: Use intermediate variables to improve readability.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`EIP712`: Add internal getters for the name and version strings

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`TimelockController`: Add a state getter that returns an `OperationState` enum.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
Replace revert strings and require statements with custom errors.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Nonces`: Added a new contract to keep track of user nonces. Used for signatures in `ERC20Permit`, `ERC20Votes`, and `ERC721Votes`. ([#3816](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3816))

View File

@ -1,6 +0,0 @@
---
'openzeppelin-solidity': patch
---
`Governor`: Add validation in ERC1155 and ERC721 receiver hooks to ensure Governor is the executor.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
Switched to using explicit Solidity import statements. Some previously available symbols may now have to be separately imported.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`Math`: Optimized stack operations in `mulDiv`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Governor`: Add support for casting votes with ERC-1271 signatures by using a `bytes memory signature` instead of `r`, `s` and `v` arguments in the `castVoteBySig` and `castVoteWithReasonAndParamsBySig` functions.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`BeaconProxy`: Use an immutable variable to store the address of the beacon. It is no longer possible for a `BeaconProxy` to upgrade by changing to another beacon.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC721`: Renamed `_requireMinted` to `_requireOwned` and added a return value with the current owner. Implemented `ownerOf` in terms of `_requireOwned`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`GovernorTimelockControl`: Add the Governor instance address as part of the TimelockController operation `salt` to avoid operation id collisions between governors using the same TimelockController.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AccessManager`: Added a new contract for managing access control of complex systems in a consolidated location.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
Overrides are now used internally for a number of functions that were previously hardcoded to their default implementation in certain locations: `ERC1155Supply.totalSupply`, `ERC721.ownerOf`, `ERC721.balanceOf` and `ERC721.totalSupply` in `ERC721Enumerable`, `ERC20.totalSupply` in `ERC20FlashMint`, and `ERC1967._getImplementation` in `ERC1967Proxy`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ProxyAdmin`: Removed `getProxyAdmin` and `getProxyImplementation` getters. ([#3820](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3820))

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`ERC1155`: Optimize array allocation.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
Bump minimum compiler version required to 0.8.20

View File

@ -1,7 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC20Votes`: Changed internal vote accounting to reusable `Votes` module previously used by `ERC721Votes`. Removed implicit `ERC20Permit` inheritance. Note that the `DOMAIN_SEPARATOR` getter was previously guaranteed to be available for `ERC20Votes` contracts, but is no longer available unless `ERC20Permit` is explicitly used; ERC-5267 support is included in `ERC20Votes` with `EIP712` and is recommended as an alternative.
pr: #3816

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC20`: Remove the non-standard `increaseAllowance` and `decreaseAllowance` functions.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Governor`: Add `voter` and `nonce` parameters in signed ballots, to avoid forging signatures for random addresses, prevent signature replay, and allow invalidating signatures. Add `voter` as a new parameter in the `castVoteBySig` and `castVoteWithReasonAndParamsBySig` functions.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`TransparentUpgradeableProxy`: Removed `admin` and `implementation` getters, which were only callable by the proxy owner and thus not very useful. ([#3820](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3820))

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ERC1155`: Remove check for address zero in `balanceOf`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`ReentrancyGuard`, `Pausable`: Moved to `utils` directory.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`access`: Move `AccessControl` extensions to a dedicated directory.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`ERC721Consecutive`: Add a `_firstConsecutiveId` internal function that can be overridden to change the id of the first token minted through `_mintConsecutive`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`DoubleEndedQueue`: refactor internal structure to use `uint128` instead of `int128`. This has no effect on the library interface.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`Governor`: Add a mechanism to restrict the address of the proposer using a suffix in the description.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Governor`, `Initializable`, and `UUPSUpgradeable`: Use internal functions in modifiers to optimize bytecode size.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Strings`: Rename `toString(int256)` to `toStringSigned(int256)`.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`BeaconProxy`: Reject value in initialization unless a payable function is explicitly invoked.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Initializable`: Use the namespaced storage pattern to avoid putting critical variables in slot 0. Allow reinitializer versions greater than 256.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ERC1155`: Bubble errors triggered in the `onERC1155Received` and `onERC1155BatchReceived` hooks.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`ERC1155`: Optimize array accesses by skipping bounds checking when unnecessary.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AccessControl`: Add a boolean return value to the internal `_grantRole` and `_revokeRole` functions indicating whether the role was granted or revoked.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`ERC2771Context`: Return the forwarder address whenever the `msg.data` of a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. `msg.data.length` is less than 20 bytes), as specified by ERC-2771.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
Remove the `override` specifier from functions that only override a single interface function.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`GovernorTimelockAccess`: Added a module to connect a governor with an instance of `AccessManager`, allowing the governor to make calls that are delay-restricted by the manager using the normal `queue` workflow.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`ERC2771Context`: Prevent revert in `_msgData()` when a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. `msg.data.length` is less than 20 bytes). Return the full calldata in that case.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
Upgradeable contracts now use namespaced storage (EIP-7201).

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`GovernorStorage`: Added a new governor extension that stores the proposal details in storage, with an interface that operates on `proposalId`, as well as proposal enumerability. This replaces the old `GovernorCompatibilityBravo` module.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Votes`: Use Trace208 for checkpoints. This enables EIP-6372 clock support for keys but reduces the max supported voting power to uint208.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`Math`: Renamed members of `Rounding` enum, and added a new rounding mode for "away from zero".

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': major
---
`SafeERC20`: Refactor `safeDecreaseAllowance` and `safeIncreaseAllowance` to support USDT-like tokens.

View File

@ -10,3 +10,7 @@ coverage:
project:
default:
threshold: 1%
ignore:
- "test"
- "contracts/mocks"
- "contracts/vendor"

View File

@ -1,20 +0,0 @@
{
"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

View File

@ -10,7 +10,7 @@ about: Report a bug in OpenZeppelin Contracts
**💻 Environment**
<!-- Tell us what version of OpenZeppelin Contracts you're using, and how you're using it: Truffle, Remix, etc. -->
<!-- Tell us what version of OpenZeppelin Contracts you're using, and how you're using it: Hardhat, Remix, etc. -->
**📝 Details**

View File

@ -1,4 +1,5 @@
name: Compare gas costs
description: Compare gas costs between branches
inputs:
token:
description: github token

View File

@ -1,12 +1,13 @@
name: Setup
description: Common environment setup
runs:
using: composite
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/cache@v3
node-version: 20.x
- uses: actions/cache@v4
id: cache
with:
path: '**/node_modules'
@ -15,5 +16,7 @@ runs:
run: npm ci
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
env:
SKIP_COMPILE: true
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

View File

@ -1,4 +1,5 @@
name: Compare storage layouts
description: Compare storage layouts between branches
inputs:
token:
description: github token

View File

@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true
env:
NODE_OPTIONS: --max_old_space_size=5120
NODE_OPTIONS: --max_old_space_size=8192
jobs:
lint:
@ -29,6 +29,9 @@ jobs:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
# Needed for "eth-gas-reporter" to produce a "gasReporterOutput.json" as documented in
# https://github.com/cgewecke/eth-gas-reporter/blob/v0.2.27/docs/gasReporterOutput.md
CI: true
GAS: true
steps:
- uses: actions/checkout@v4
@ -38,11 +41,12 @@ jobs:
run: npm run test
- name: Check linearisation of the inheritance graph
run: npm run test:inheritance
- name: Check pragma consistency between files
run: npm run test:pragma
- name: Check proceduraly generated contracts are up-to-date
run: npm run test:generation
- name: Compare gas costs
uses: ./.github/actions/gas-compare
if: github.base_ref == 'master'
with:
token: ${{ github.token }}
@ -56,15 +60,20 @@ jobs:
fetch-depth: 0 # Include history so patch conflicts are resolved automatically
- name: Set up environment
uses: ./.github/actions/setup
- name: Copy non-upgradeable contracts as dependency
run: |
mkdir -p lib/openzeppelin-contracts
cp -rnT contracts lib/openzeppelin-contracts/contracts
- name: Transpile to upgradeable
run: bash scripts/upgradeable/transpile.sh
- name: Run tests
run: npm run test
- name: Check linearisation of the inheritance graph
run: npm run test:inheritance
- name: Check pragma consistency between files
run: npm run test:pragma
- name: Check storage layout
uses: ./.github/actions/storage-layout
if: github.base_ref == 'master'
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change') }}
with:
token: ${{ github.token }}
@ -75,10 +84,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: forge test -vv
@ -88,10 +95,22 @@ jobs:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- run: npm run coverage
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run coverage
run: npm run coverage
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
harnesses:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Compile harnesses
run: |
make -C certora apply
npm run compile:harnesses
slither:
runs-on: ubuntu-latest
@ -100,17 +119,18 @@ jobs:
- name: Set up environment
uses: ./.github/actions/setup
- run: rm foundry.toml
- uses: crytic/slither-action@v0.3.0
- 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.0
uses: codespell-project/actions-codespell@v2.1
with:
check_hidden: true
check_filenames: true
skip: package-lock.json,*.pdf
skip: package-lock.json,*.pdf,vendor

View File

@ -10,7 +10,7 @@ on:
workflow_dispatch: {}
env:
PIP_VERSION: '3.10'
PIP_VERSION: '3.11'
JAVA_VERSION: '11'
SOLC_VERSION: '0.8.20'
@ -44,12 +44,13 @@ jobs:
fi
echo "result=$RESULT" >> "$GITHUB_OUTPUT"
- name: Install python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.PIP_VERSION }}
cache: 'pip'
cache-dependency-path: 'fv-requirements.txt'
- name: Install python packages
run: pip install -r requirements.txt
run: pip install -r fv-requirements.txt
- name: Install java
uses: actions/setup-java@v3
with:
@ -66,3 +67,20 @@ jobs:
node certora/run.js ${{ steps.arguments.outputs.result }} >> "$GITHUB_STEP_SUMMARY"
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}
halmos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Install python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PIP_VERSION }}
cache: 'pip'
cache-dependency-path: 'fv-requirements.txt'
- name: Install python packages
run: pip install -r fv-requirements.txt
- name: Run Halmos
run: halmos --match-test '^symbolic|^testSymbolic' -vv

View File

@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/setup
- id: state
name: Get state
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
TRIGGERING_ACTOR: ${{ github.triggering_actor }}
with:
@ -66,7 +66,7 @@ jobs:
name: Create branch with release candidate
run: bash scripts/release/workflow/start.sh
- name: Re-run workflow
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
REF: ${{ steps.start.outputs.branch }}
with:
@ -89,7 +89,7 @@ jobs:
if: needs.state.outputs.is_prerelease == 'true'
run: bash scripts/release/workflow/exit-prerelease.sh
- name: Re-run workflow
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: await require('./scripts/release/workflow/rerun.js')({ github, context })
@ -108,7 +108,7 @@ jobs:
- name: Set up environment
uses: ./.github/actions/setup
- name: Set release title
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
result-encoding: string
script: await require('./scripts/release/workflow/set-changesets-pr-title.js')({ core })
@ -143,22 +143,18 @@ jobs:
env:
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
- name: Upload tarball artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.ref_name }}
path: ${{ steps.pack.outputs.tarball }}
- name: Tag
run: npx changeset tag
- name: Publish
run: bash scripts/release/workflow/publish.sh
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TARBALL: ${{ steps.pack.outputs.tarball }}
TAG: ${{ steps.pack.outputs.tag }}
- name: Push tags
run: git push --tags
- name: Create Github Release
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
with:
@ -174,9 +170,7 @@ jobs:
- uses: actions/checkout@v4
- name: Download tarball artifact
id: artifact
# Replace with actions/upload-artifact@v3 when
# https://github.com/actions/download-artifact/pull/194 gets released
uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b
uses: actions/download-artifact@v4
with:
name: ${{ github.ref_name }}
- name: Check integrity
@ -206,7 +200,7 @@ jobs:
git checkout -B "$MERGE_BRANCH" "$GITHUB_REF_NAME"
git push -f origin "$MERGE_BRANCH"
- name: Create PR back to master
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
await github.rest.pulls.create({

View File

@ -18,13 +18,17 @@ jobs:
token: ${{ secrets.GH_TOKEN_UPGRADEABLE }}
- name: Fetch current non-upgradeable branch
run: |
git fetch "https://github.com/${{ github.repository }}.git" "$REF"
git fetch "$REMOTE" master # Fetch default branch first for patch to apply cleanly
git fetch "$REMOTE" "$REF"
git checkout FETCH_HEAD
env:
REF: ${{ github.ref }}
REMOTE: https://github.com/${{ github.repository }}.git
- name: Set up environment
uses: ./.github/actions/setup
- run: bash scripts/git-user-config.sh
- name: Transpile to upgradeable
run: bash scripts/upgradeable/transpile-onto.sh ${{ github.ref_name }} origin/${{ github.ref_name }}
env:
SUBMODULE_REMOTE: https://github.com/${{ github.repository }}.git
- run: git push origin ${{ github.ref_name }}

7
.gitignore vendored
View File

@ -29,15 +29,9 @@ npm-debug.log
# local env variables
.env
# truffle build directory
build/
# macOS
.DS_Store
# truffle
.node-xmlhttprequest-*
# IntelliJ IDE
.idea
@ -63,6 +57,7 @@ contracts-exposed
# Foundry
/out
/cache_forge
# Certora
.certora*

3
.gitmodules vendored
View File

@ -5,3 +5,6 @@
[submodule "lib/erc4626-tests"]
path = lib/erc4626-tests
url = https://github.com/a16z/erc4626-tests.git
[submodule "lib/halmos-cheatcodes"]
path = lib/halmos-cheatcodes
url = https://github.com/a16z/halmos-cheatcodes

View File

@ -10,4 +10,12 @@ module.exports = {
fgrep: '[skip-on-coverage]',
invert: true,
},
// Work around stack too deep for coverage
configureYulOptimizer: true,
solcOptimizerDetails: {
yul: true,
yulDetails: {
optimizerSteps: '',
},
},
};

View File

@ -1,12 +1,173 @@
# Changelog
## Unreleased
## 5.2.0 (2025-01-08)
> **Warning** Version 5.0 is under active development and should not be used. Install the releases from npm or use the version tags in the repository.
### Breaking Changes
### Removals
#### Custom error changes
The following contracts, libraries and functions were removed:
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 operation 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)
### 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 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
This version comes with changes to the custom error identifiers. Contracts previously depending on the following errors should be replaced accordingly:
- Replace `Address.FailedInnerCall` with `Errors.FailedCall`
- Replace `Address.AddressInsufficientBalance` with `Errors.InsufficientBalance`
- Replace `Clones.Create2InsufficientBalance` with `Errors.InsufficientBalance`
- Replace `Clones.ERC1167FailedCreateClone` with `Errors.FailedDeployment`
- Replace `Clones.Create2FailedDeployment` with `Errors.FailedDeployment`
- `SafeERC20`: Replace `Address.AddressEmptyCode` with `SafeERC20FailedOperation` if there is no code at the token's address.
- `SafeERC20`: Replace generic `Error(string)` with `SafeERC20FailedOperation` if the returned data can't be decoded as `bool`.
- `SafeERC20`: Replace generic `SafeERC20FailedOperation` with the revert message from the contract call if it fails.
### Changes by category
#### General
- `AccessManager`, `VestingWallet`, `TimelockController` and `ERC2771Forwarder`: Added a public `initializer` function in their corresponding upgradeable variants. ([#5008](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5008))
#### Access
- `AccessControlEnumerable`: Add a `getRoleMembers` method to return all accounts that have `role`. ([#4546](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4546))
- `AccessManager`: Allow the `onlyAuthorized` modifier to restrict functions added to the manager. ([#5014](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5014))
#### Finance
- `VestingWalletCliff`: Add an extension of the `VestingWallet` contract with an added cliff. ([#4870](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4870))
#### Governance
- `GovernorCountingFractional`: Add a governor counting module that allows distributing voting power amongst 3 options (For, Against, Abstain). ([#5045](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5045))
- `Votes`: Set `_moveDelegateVotes` visibility to internal instead of private. ([#5007](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5007))
#### Proxy
- `Clones`: Add version of `clone` and `cloneDeterministic` that support sending value at creation. ([#4936](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4936))
- `TransparentUpgradeableProxy`: Make internal `_proxyAdmin()` getter have `view` visibility. ([#4688](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4688))
- `ProxyAdmin`: Fixed documentation for `UPGRADE_INTERFACE_VERSION` getter. ([#5031](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5031))
#### Tokens
- `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))
#### Utils
- `Arrays`: add a `sort` functions for `address[]`, `bytes32[]` and `uint256[]` memory arrays. ([#4846](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4846))
- `Arrays`: add new functions `lowerBound`, `upperBound`, `lowerBoundMemory` and `upperBoundMemory` for lookups in sorted arrays with potential duplicates. ([#4842](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4842))
- `Arrays`: deprecate `findUpperBound` in favor of the new `lowerBound`. ([#4842](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4842))
- `Base64`: Add `encodeURL` following section 5 of RFC4648 for URL encoding ([#4822](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4822))
- `Comparator`: A library of comparator functions, useful for customizing the behavior of the Heap structure. ([#5084](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5084))
- `Create2`: Bubbles up returndata from a deployed contract that reverted during construction. ([#5052](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5052))
- `Create2`, `Clones`: Mask `computeAddress` and `cloneDeterministic` outputs to produce a clean value for an `address` type (i.e. only use 20 bytes) ([#4941](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4941))
- `Errors`: New library of common custom errors. ([#4936](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4936))
- `Hashes`: A library with commonly used hash functions. ([#3617](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3617))
- `Packing`: Added a new utility for packing, extracting and replacing bytesXX values. ([#4992](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4992))
- `Panic`: Add a library for reverting with panic codes. ([#3298](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3298))
- `ReentrancyGuardTransient`: Added a variant of `ReentrancyGuard` that uses transient storage. ([#4988](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4988))
- `Strings`: Added a utility function for converting an address to checksummed string. ([#5067](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5067))
- `SlotDerivation`: Add a library of methods for derivating common storage slots. ([#4975](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4975))
- `TransientSlot`: Add primitives for operating on the transient storage space using a typed-slot representation. ([#4980](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4980))
##### Cryptography
- `SignatureChecker`: refactor `isValidSignatureNow` to avoid validating ECDSA signatures if there is code deployed at the signer's address. ([#4951](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4951))
- `MerkleProof`: Add variations of `verify`, `processProof`, `multiProofVerify` and `processMultiProof` (and equivalent calldata version) with support for custom hashing functions. ([#4887](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4887))
- `P256`: Library for verification and public key recovery of P256 (aka secp256r1) signatures. ([#4881](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4881))
- `RSA`: Library to verify signatures according to RFC 8017 Signature Verification Operation ([#4952](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4952))
#### Math
- `Math`: add an `invMod` function to get the modular multiplicative inverse of a number in Z/nZ. ([#4839](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4839))
- `Math`: Add `modExp` function that exposes the `EIP-198` precompile. Includes `uint256` and `bytes memory` versions. ([#3298](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3298))
- `Math`: Custom errors replaced with native panic codes. ([#3298](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3298))
- `Math`, `SignedMath`: Add a branchless `ternary` function that computes`cond ? a : b` in constant gas cost. ([#4976](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4976))
- `SafeCast`: Add `toUint(bool)` for operating on `bool` values as `uint256`. ([#4878](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4878))
#### Structures
- `CircularBuffer`: Add a data structure that stores the last `N` values pushed to it. ([#4913](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4913))
- `DoubleEndedQueue`: Custom errors replaced with native panic codes. ([#4872](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4872))
- `EnumerableMap`: add `UintToBytes32Map`, `AddressToAddressMap`, `AddressToBytes32Map` and `Bytes32ToAddressMap`. ([#4843](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4843))
- `Heap`: A data structure that implements a heap-based priority queue. ([#5084](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5084))
- `MerkleTree`: A data structure that allows inserting elements into a merkle tree and updating its root hash. ([#3617](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3617))
## 5.0.2 (2024-02-29)
- `Base64`: Fix issue where dirty memory located just after the input buffer is affecting the result. ([#4926](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4926))
## 5.0.1 (2023-12-07)
- `ERC2771Context` and `Context`: Introduce a `_contextPrefixLength()` getter, used to trim extra information appended to `msg.data`.
- `Multicall`: Make aware of non-canonical context (i.e. `msg.sender` is not `_msgSender()`), allowing compatibility with `ERC2771Context`.
## 5.0.0 (2023-10-05)
### Additions Summary
The following contracts and libraries were added:
- `AccessManager`: A consolidated system for managing access control in complex systems.
- `AccessManaged`: A module for connecting a contract to an authority in charge of its access control.
- `GovernorTimelockAccess`: An adapter for time-locking governance proposals using an `AccessManager`.
- `AuthorityUtils`: A library of utilities for interacting with authority contracts.
- `GovernorStorage`: A Governor module that stores proposal details in storage.
- `ERC2771Forwarder`: An ERC2771 forwarder for meta transactions.
- `ERC1967Utils`: A library with ERC1967 events, errors and getters.
- `Nonces`: An abstraction for managing account nonces.
- `MessageHashUtils`: A library for producing digests for ECDSA operations.
- `Time`: A library with helpers for manipulating time-related objects.
### Removals Summary
The following contracts, libraries, and functions were removed:
- `Address.isContract` (because of its ambiguous nature and potential for misuse)
- `Checkpoints.History`
@ -30,51 +191,249 @@ The following contracts, libraries and functions were removed:
These removals were implemented in the following PRs: [#3637](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3637), [#3880](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3880), [#3945](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3945), [#4258](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4258), [#4276](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4276), [#4289](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4289)
### How to upgrade from 4.x
### Changes by category
#### General
- Replaced revert strings and require statements with custom errors. ([#4261](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4261))
- Bumped minimum compiler version required to 0.8.20 ([#4288](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4288), [#4489](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4489))
- Use of `abi.encodeCall` in place of `abi.encodeWithSelector` and `abi.encodeWithSignature` for improved type-checking of parameters ([#4293](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4293))
- Replaced some uses of `abi.encodePacked` with clearer alternatives (e.g. `bytes.concat`, `string.concat`). ([#4504](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4504)) ([#4296](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4296))
- Overrides are now used internally for a number of functions that were previously hardcoded to their default implementation in certain locations: `ERC1155Supply.totalSupply`, `ERC721.ownerOf`, `ERC721.balanceOf` and `ERC721.totalSupply` in `ERC721Enumerable`, `ERC20.totalSupply` in `ERC20FlashMint`, and `ERC1967._getImplementation` in `ERC1967Proxy`. ([#4299](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4299))
- Removed the `override` specifier from functions that only override a single interface function. ([#4315](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4315))
- Switched to using explicit Solidity import statements. Some previously available symbols may now have to be separately imported. ([#4399](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4399))
- `Governor`, `Initializable`, and `UUPSUpgradeable`: Use internal functions in modifiers to optimize bytecode size. ([#4472](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4472))
- Upgradeable contracts now use namespaced storage (EIP-7201). ([#4534](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4534))
- Upgradeable contracts no longer transpile interfaces and libraries. ([#4628](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4628))
#### Access
- `Ownable`: Added an `initialOwner` parameter to the constructor, making the ownership initialization explicit. ([#4267](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4267))
- `Ownable`: Prevent using address(0) as the initial owner. ([#4531](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4531))
- `AccessControl`: Added a boolean return value to the internal `_grantRole` and `_revokeRole` functions indicating whether the role was granted or revoked. ([#4241](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4241))
- `access`: Moved `AccessControl` extensions to a dedicated directory. ([#4359](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4359))
- `AccessManager`: Added a new contract for managing access control of complex systems in a consolidated location. ([#4121](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4121))
- `AccessManager`, `AccessManaged`, `GovernorTimelockAccess`: Ensure that calldata shorter than 4 bytes is not padded to 4 bytes. ([#4624](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4624))
- `AccessManager`: Use named return parameters in functions that return multiple values. ([#4624](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4624))
- `AccessManager`: Make `schedule` and `execute` more conservative when delay is 0. ([#4644](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4644))
#### Finance
- `VestingWallet`: Fixed revert during 1 second time window when duration is 0. ([#4502](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4502))
- `VestingWallet`: Use `Ownable` instead of an immutable `beneficiary`. ([#4508](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4508))
#### Governance
- `Governor`: Optimized use of storage for proposal data ([#4268](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4268))
- `Governor`: Added validation in ERC1155 and ERC721 receiver hooks to ensure Governor is the executor. ([#4314](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4314))
- `Governor`: Refactored internals to implement common queuing logic in the core module of the Governor. Added `queue` and `_queueOperations` functions that act at different levels. Modules that implement queuing via timelocks are expected to override `_queueOperations` to implement the timelock-specific logic. Added `_executeOperations` as the equivalent for execution. ([#4360](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4360))
- `Governor`: Added `voter` and `nonce` parameters in signed ballots, to avoid forging signatures for random addresses, prevent signature replay, and allow invalidating signatures. Add `voter` as a new parameter in the `castVoteBySig` and `castVoteWithReasonAndParamsBySig` functions. ([#4378](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4378))
- `Governor`: Added support for casting votes with ERC-1271 signatures by using a `bytes memory signature` instead of `r`, `s` and `v` arguments in the `castVoteBySig` and `castVoteWithReasonAndParamsBySig` functions. ([#4418](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4418))
- `Governor`: Added a mechanism to restrict the address of the proposer using a suffix in the description.
- `GovernorStorage`: Added a new governor extension that stores the proposal details in storage, with an interface that operates on `proposalId`, as well as proposal enumerability. This replaces the old `GovernorCompatibilityBravo` module. ([#4360](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4360))
- `GovernorTimelockAccess`: Added a module to connect a governor with an instance of `AccessManager`, allowing the governor to make calls that are delay-restricted by the manager using the normal `queue` workflow. ([#4523](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4523))
- `GovernorTimelockControl`: Clean up timelock id on execution for gas refund. ([#4118](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4118))
- `GovernorTimelockControl`: Added the Governor instance address as part of the TimelockController operation `salt` to avoid operation id collisions between governors using the same TimelockController. ([#4432](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4432))
- `TimelockController`: Changed the role architecture to use `DEFAULT_ADMIN_ROLE` as the admin for all roles, instead of the bespoke `TIMELOCK_ADMIN_ROLE` that was used previously. This aligns with the general recommendation for `AccessControl` and makes the addition of new roles easier. Accordingly, the `admin` parameter and timelock will now be granted `DEFAULT_ADMIN_ROLE` instead of `TIMELOCK_ADMIN_ROLE`. ([#3799](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3799))
- `TimelockController`: Added a state getter that returns an `OperationState` enum. ([#4358](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4358))
- `Votes`: Use Trace208 for checkpoints. This enables EIP-6372 clock support for keys but reduces the max supported voting power to uint208. ([#4539](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4539))
#### Metatx
- `ERC2771Forwarder`: Added `deadline` for expiring transactions, batching, and more secure handling of `msg.value`. ([#4346](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4346))
- `ERC2771Context`: Return the forwarder address whenever the `msg.data` of a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. `msg.data.length` is less than 20 bytes), as specified by ERC-2771. ([#4481](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4481))
- `ERC2771Context`: Prevent revert in `_msgData()` when a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. `msg.data.length` is less than 20 bytes). Return the full calldata in that case. ([#4484](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4484))
#### Proxy
- `ProxyAdmin`: Removed `getProxyAdmin` and `getProxyImplementation` getters. ([#3820](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3820))
- `TransparentUpgradeableProxy`: Removed `admin` and `implementation` getters, which were only callable by the proxy owner and thus not very useful. ([#3820](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3820))
- `ERC1967Utils`: Refactored the `ERC1967Upgrade` abstract contract as a library. ([#4325](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4325))
- `TransparentUpgradeableProxy`: Admin is now stored in an immutable variable (set during construction) to avoid unnecessary storage reads on every proxy call. This removed the ability to ever change the admin. Transfer of the upgrade capability is exclusively handled through the ownership of the `ProxyAdmin`. ([#4354](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4354))
- Moved the logic to validate ERC-1822 during an upgrade from `ERC1967Utils` to `UUPSUpgradeable`. ([#4356](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4356))
- `UUPSUpgradeable`, `TransparentUpgradeableProxy` and `ProxyAdmin`: Removed `upgradeTo` and `upgrade` functions, and made `upgradeToAndCall` and `upgradeAndCall` ignore the data argument if it is empty. It is no longer possible to invoke the receive function (or send value with empty data) along with an upgrade. ([#4382](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4382))
- `BeaconProxy`: Reject value in initialization unless a payable function is explicitly invoked. ([#4382](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4382))
- `Proxy`: Removed redundant `receive` function. ([#4434](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4434))
- `BeaconProxy`: Use an immutable variable to store the address of the beacon. It is no longer possible for a `BeaconProxy` to upgrade by changing to another beacon. ([#4435](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4435))
- `Initializable`: Use the namespaced storage pattern to avoid putting critical variables in slot 0. Allow reinitializer versions greater than 256. ([#4460](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4460))
- `Initializable`: Use intermediate variables to improve readability. ([#4576](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4576))
#### Token
- `ERC20`, `ERC721`, `ERC1155`: Deleted `_beforeTokenTransfer` and `_afterTokenTransfer` hooks, added a new internal `_update` function for customizations, and refactored all extensions using those hooks to use `_update` instead. ([#3838](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3838), [#3876](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3876), [#4377](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4377))
- `ERC20`: Removed `Approval` event previously emitted in `transferFrom` to indicate that part of the allowance was consumed. With this change, allowances are no longer reconstructible from events. See the code for guidelines on how to re-enable this event if needed. ([#4370](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4370))
- `ERC20`: Removed the non-standard `increaseAllowance` and `decreaseAllowance` functions. ([#4585](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4585))
- `ERC20Votes`: Changed internal vote accounting to reusable `Votes` module previously used by `ERC721Votes`. Removed implicit `ERC20Permit` inheritance. Note that the `DOMAIN_SEPARATOR` getter was previously guaranteed to be available for `ERC20Votes` contracts, but is no longer available unless `ERC20Permit` is explicitly used; ERC-5267 support is included in `ERC20Votes` with `EIP712` and is recommended as an alternative. ([#3816](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3816))
- `SafeERC20`: Refactored `safeDecreaseAllowance` and `safeIncreaseAllowance` to support USDT-like tokens. ([#4260](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4260))
- `SafeERC20`: Removed `safePermit` in favor of documentation-only `permit` recommendations. Based on recommendations from @trust1995 ([#4582](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4582))
- `ERC721`: `_approve` no longer allows approving the owner of the tokenId. ([#4377](https://github.com/OpenZeppelin/openzeppelin-contracts/issues/4377)) `_setApprovalForAll` no longer allows setting address(0) as an operator. ([#4377](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4377))
- `ERC721`: Renamed `_requireMinted` to `_requireOwned` and added a return value with the current owner. Implemented `ownerOf` in terms of `_requireOwned`. ([#4566](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4566))
- `ERC721Consecutive`: Added a `_firstConsecutiveId` internal function that can be overridden to change the id of the first token minted through `_mintConsecutive`. ([#4097](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4097))
- `ERC721URIStorage`: Allow setting the token URI prior to minting. ([#4559](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4559))
- `ERC721URIStorage`, `ERC721Royalty`: Stop resetting token-specific URI and royalties when burning. ([#4561](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4561))
- `ERC1155`: Optimized array allocation. ([#4196](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4196))
- `ERC1155`: Removed check for address zero in `balanceOf`. ([#4263](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4263))
- `ERC1155`: Optimized array accesses by skipping bounds checking when unnecessary. ([#4300](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4300))
- `ERC1155`: Bubble errors triggered in the `onERC1155Received` and `onERC1155BatchReceived` hooks. ([#4314](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4314))
- `ERC1155Supply`: Added a `totalSupply()` function that returns the total amount of token circulating, this change will restrict the total tokens minted across all ids to 2\*\*256-1 . ([#3962](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3962))
- `ERC1155Receiver`: Removed in favor of `ERC1155Holder`. ([#4450](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4450))
#### Utils
- `Address`: Removed the ability to customize error messages. A common custom error is always used if the underlying revert reason cannot be bubbled up. ([#4502](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4502))
- `Arrays`: Added `unsafeMemoryAccess` helpers to read from a memory array without checking the length. ([#4300](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4300))
- `Arrays`: Optimized `findUpperBound` by removing redundant SLOAD. ([#4442](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4442))
- `Checkpoints`: Library moved from `utils` to `utils/structs` ([#4275](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4275))
- `DoubleEndedQueue`: Refactored internal structure to use `uint128` instead of `int128`. This has no effect on the library interface. ([#4150](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4150))
- `ECDSA`: Use unchecked arithmetic for the `tryRecover` function that receives the `r` and `vs` short-signature fields separately. ([#4301](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4301))
- `EIP712`: Added internal getters for the name and version strings ([#4303](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4303))
- `Math`: Makes `ceilDiv` to revert on 0 division even if the numerator is 0 ([#4348](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4348))
- `Math`: Optimized stack operations in `mulDiv`. ([#4494](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4494))
- `Math`: Renamed members of `Rounding` enum, and added a new rounding mode for "away from zero". ([#4455](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4455))
- `MerkleProof`: Use custom error to report invalid multiproof instead of reverting with overflow panic. ([#4564](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4564))
- `MessageHashUtils`: Added a new library for creating message digest to be used along with signing or recovery such as ECDSA or ERC-1271. These functions are moved from the `ECDSA` library. ([#4430](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4430))
- `Nonces`: Added a new contract to keep track of user nonces. Used for signatures in `ERC20Permit`, `ERC20Votes`, and `ERC721Votes`. ([#3816](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3816))
- `ReentrancyGuard`, `Pausable`: Moved to `utils` directory. ([#4551](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4551))
- `Strings`: Renamed `toString(int256)` to `toStringSigned(int256)`. ([#4330](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4330))
- Optimized `Strings.equal` ([#4262](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4262))
### How to migrate from 4.x
#### ERC20, ERC721, and ERC1155
These breaking changes will require modifications to ERC20, ERC721, and ERC1155 contracts, since the `_afterTokenTransfer` and `_beforeTokenTransfer` functions were removed. Any customization made through those hooks should now be done overriding the new `_update` function instead.
These breaking changes will require modifications to ERC20, ERC721, and ERC1155 contracts, since the `_afterTokenTransfer` and `_beforeTokenTransfer` functions were removed. Thus, any customization made through those hooks should now be done overriding the new `_update` function instead.
Minting and burning are implemented by `_update` and customizations should be done by overriding this function as well. `_transfer`, `_mint` and `_burn` are no longer virtual (meaning they are not overridable) to guard against possible inconsistencies.
For example, a contract using `ERC20`'s `_beforeTokenTransfer` hook would have to be changed in the following way.
```diff
- function _beforeTokenTransfer(
+ function _update(
address from,
address to,
uint256 amount
) internal virtual override {
- super._beforeTokenTransfer(from, to, amount);
require(!condition(), "ERC20: wrong condition");
+ super._update(from, to, amount);
}
-function _beforeTokenTransfer(
+function _update(
address from,
address to,
uint256 amount
) internal virtual override {
- super._beforeTokenTransfer(from, to, amount);
require(!condition(), "ERC20: wrong condition");
+ super._update(from, to, amount);
}
```
### More about ERC721
#### More about ERC721
In the case of `ERC721`, the `_update` function does not include a `from` parameter, as the sender is implicitly the previous owner of the `tokenId`. The address of
this previous owner is returned by the `_update` function, so it can be used for a posteriori checks. In addition to `to` and `tokenId`, a third parameter (`auth`) is
present in this function. This parameter enabled an optional check that the caller/spender is approved to do the transfer. This check cannot be performed after the transfer (because the transfer resets the approval), and doing it before `_update` would require a duplicate call to `_ownerOf`.
In the case of `ERC721`, the `_update` function does not include a `from` parameter, as the sender is implicitly the previous owner of the `tokenId`. The address of this previous owner is returned by the `_update` function, so it can be used for a posteriori checks. In addition to `to` and `tokenId`, a third parameter (`auth`) is present in this function. This parameter enabled an optional check that the caller/spender is approved to do the transfer. This check cannot be performed after the transfer (because the transfer resets the approval), and doing it before `_update` would require a duplicate call to `_ownerOf`.
In this logic of removing hidden SLOADs, the `_isApprovedOrOwner` function was removed in favor of a new `_isAuthorized` function. Overrides that used to target the
`_isApprovedOrOwner` should now be performed on the `_isAuthorized` function. Calls to `_isApprovedOrOwner` that preceded a call to `_transfer`, `_burn` or `_approve`
should be removed in favor of using the `auth` argument in `_update` and `_approve`. This is showcased in `ERC721Burnable.burn` and in `ERC721Wrapper.withdrawTo`.
In this logic of removing hidden SLOADs, the `_isApprovedOrOwner` function was removed in favor of a new `_isAuthorized` function. Overrides that used to target the `_isApprovedOrOwner` should now be performed on the `_isAuthorized` function. Calls to `_isApprovedOrOwner` that preceded a call to `_transfer`, `_burn` or `_approve` should be removed in favor of using the `auth` argument in `_update` and `_approve`. This is showcased in `ERC721Burnable.burn` and in `ERC721Wrapper.withdrawTo`.
The `_exists` function was removed. Calls to this function can be replaced by `_ownerOf(tokenId) != address(0)`.
#### More about ERC1155
Batch transfers will now emit `TransferSingle` if the batch consists of a single token, while in previous versions the `TransferBatch` event would be used for all transfers initiated through `safeBatchTransferFrom`. Both behaviors are compliant with the ERC-1155 specification.
#### ERC165Storage
Users that were registering EIP-165 interfaces with `_registerInterface` from `ERC165Storage` should instead do so so by overriding the `supportsInterface` function as seen below:
Users that were registering EIP-165 interfaces with `_registerInterface` from `ERC165Storage` should instead do so by overriding the `supportsInterface` function as seen below:
```solidity
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
}
```
#### SafeMath
Methods in SafeMath superseded by native overflow checks in Solidity 0.8.0 were removed along with operations providing an interface for revert strings. The remaining methods were moved to `utils/Math.sol`.
```diff
- import "@openzeppelin/contracts/utils/math/SafeMath.sol";
+ import "@openzeppelin/contracts/utils/math/Math.sol";
function tryOperations(uint256 x, uint256 y) external view {
- (bool overflowsAdd, uint256 resultAdd) = SafeMath.tryAdd(x, y);
+ (bool overflowsAdd, uint256 resultAdd) = Math.tryAdd(x, y);
- (bool overflowsSub, uint256 resultSub) = SafeMath.trySub(x, y);
+ (bool overflowsSub, uint256 resultSub) = Math.trySub(x, y);
- (bool overflowsMul, uint256 resultMul) = SafeMath.tryMul(x, y);
+ (bool overflowsMul, uint256 resultMul) = Math.tryMul(x, y);
- (bool overflowsDiv, uint256 resultDiv) = SafeMath.tryDiv(x, y);
+ (bool overflowsDiv, uint256 resultDiv) = Math.tryDiv(x, y);
// ...
}
```
#### Adapting Governor modules
Custom Governor modules that override internal functions may require modifications if migrated to v5. In particular, the new internal functions `_queueOperations` and `_executeOperations` may need to be used. If assistance with this migration is needed reach out via the [OpenZeppelin Support Forum](https://forum.openzeppelin.com/c/support/contracts/18).
#### ECDSA and MessageHashUtils
The `ECDSA` library is now focused on signer recovery. Previously it also included utility methods for producing digests to be used with signing or recovery. These utilities have been moved to the `MessageHashUtils` library and should be imported if needed:
```diff
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
+import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
contract Verifier {
using ECDSA for bytes32;
+ using MessageHashUtils for bytes32;
function _verify(bytes32 data, bytes memory signature, address account) internal pure returns (bool) {
return data
.toEthSignedMessageHash()
.recover(signature) == account;
}
}
```
#### Interfaces and libraries in upgradeable contracts
The upgradeable version of the contracts library used to include a variant suffixed with `Upgradeable` for every contract. These variants, which are produced automatically, mainly include changes for dealing with storage that don't apply to libraries and interfaces.
The upgradeable library no longer includes upgradeable variants for libraries and interfaces. Projects migrating to 5.0 should replace their library and interface imports with their corresponding non-upgradeable version:
```diff
// Libraries
-import {AddressUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol';
+import {Address} from '@openzeppelin/contracts/utils/Address.sol';
// Interfaces
-import {IERC20Upgradeable} from '@openzeppelin/contracts-upgradeable/interfaces/IERC20.sol';
+import {IERC20} from '@openzeppelin/contracts/interfaces/IERC20.sol';
```
#### Offchain Considerations
Some changes may affect offchain systems if they rely on assumptions that are changed along with these new breaking changes. These cases are:
##### Relying on revert strings for processing errors
A concrete example is AccessControl, where it was previously advised to catch revert reasons using the following regex:
```
/^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
```
Instead, contracts now revert with custom errors. Systems that interact with smart contracts outside of the network should consider reliance on revert strings and possibly support the new custom errors.
##### Relying on storage locations for retrieving data
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)
- `Base64`: Fix issue where dirty memory located just after the input buffer is affecting the result. ([#4929](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4929))
## 4.9.5 (2023-12-08)
- `Multicall`: Make aware of non-canonical context (i.e. `msg.sender` is not `_msgSender()`), allowing compatibility with `ERC2771Context`. Patch duplicated `Address.functionDelegateCall` in v4.9.4 (removed).
## 4.9.3 (2023-07-28)
- `ERC2771Context`: Return the forwarder address whenever the `msg.data` of a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. `msg.data.length` is less than 20 bytes), as specified by ERC-2771. ([#4481](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4481))
- `ERC2771Context`: Prevent revert in `_msgData()` when a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. `msg.data.length` is less than 20 bytes). Return the full calldata in that case. ([#4484](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4484))
## 4.9.2 (2023-06-16)
- `MerkleProof`: Fix a bug in `processMultiProof` and `processMultiProofCalldata` that allows proving arbitrary leaves if the tree contains a node with value 0 at depth 1.
@ -446,7 +805,7 @@ It is no longer possible to call an `initializer`-protected function from within
This release includes two small breaking changes in `TimelockController`.
1. The `onlyRole` modifier in this contract was designed to let anyone through if the role was granted to `address(0)`,
allowing the possibility to to make a role "open", which can be used for `EXECUTOR_ROLE`. This modifier is now
allowing the possibility to make a role "open", which can be used for `EXECUTOR_ROLE`. This modifier is now
replaced by `AccessControl.onlyRole`, which does not have this ability. The previous behavior was moved to the
modifier `TimelockController.onlyRoleOrOpenRole`.
2. It was possible to make `PROPOSER_ROLE` an open role (as described in the previous item) if it was granted to

View File

@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
level of experience, education, socioeconomic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards

7
FUNDING.json Normal file
View File

@ -0,0 +1,7 @@
{
"drips": {
"ethereum": {
"ownedBy": "0xAeb37910f93486C85A1F8F994b67E8187554d664"
}
}
}

View File

@ -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 worklows](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 workflows](https://github.com/nikitastupin/pwnhub).
Some other examples of automation are:
@ -115,7 +115,7 @@ In addition to the official Solidity Style Guide we have a number of other conve
}
```
Some standards (e.g. ERC20) use present tense, and in those cases the
Some standards (e.g. ERC-20) use present tense, and in those cases the
standard specification is used.
* Interface names should have a capital I prefix.
@ -131,6 +131,13 @@ 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-2023 zOS Global Limited and contributors
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,6 +1,3 @@
> **Warning**
> Version 5.0 is under active development. The code in this branch is not recommended for use.
# <img src="logo.svg" alt="OpenZeppelin" height="40px">
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts.svg)](https://www.npmjs.org/package/@openzeppelin/contracts)
@ -17,31 +14,34 @@
:mage: **Not sure how to get started?** Check out [Contracts Wizard](https://wizard.openzeppelin.com/) — an interactive smart contract generator.
:building_construction: **Want to scale your decentralized application?** Check out [OpenZeppelin Defender](https://openzeppelin.com/defender) — a secure platform for automating and monitoring your operations.
:building_construction: **Want to scale your decentralized application?** Check out [OpenZeppelin Defender](https://openzeppelin.com/defender) — a mission-critical developer security platform to code, audit, deploy, monitor, and operate with confidence.
> [!IMPORTANT]
> OpenZeppelin Contracts uses semantic versioning to communicate backwards compatibility of its API and storage layout. For upgradeable contracts, the storage layout of different major versions should be assumed incompatible, for example, it is unsafe to upgrade from 4.9.3 to 5.0.0. Learn more at [Backwards Compatibility](https://docs.openzeppelin.com/contracts/backwards-compatibility).
## Overview
### Installation
#### Hardhat, Truffle (npm)
#### Hardhat (npm)
```
$ npm install @openzeppelin/contracts
```
OpenZeppelin Contracts features a [stable API](https://docs.openzeppelin.com/contracts/releases-stability#api-stability), which means that your contracts won't break unexpectedly when upgrading to a newer minor version.
#### Foundry (git)
> **Warning** When installing via git, it is a common error to use the `master` branch. This is a development branch that should be avoided in favor of tagged releases. The release process involves security measures that the `master` branch does not guarantee.
> [!WARNING]
> When installing via git, it is a common error to use the `master` branch. This is a development branch that should be avoided in favor of tagged releases. The release process involves security measures that the `master` branch does not guarantee.
> **Warning** Foundry installs the latest version initially, but subsequent `forge update` commands will use the `master` branch.
> [!WARNING]
> Foundry installs the latest version initially, but subsequent `forge update` commands will use the `master` branch.
```
$ forge install OpenZeppelin/openzeppelin-contracts
```
Add `@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/` in `remappings.txt.`
Add `@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/` in `remappings.txt.`
### Usage

View File

@ -1,7 +1,5 @@
# Releasing
> Visit the documentation for [details about release schedule](https://docs.openzeppelin.com/contracts/releases-stability).
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

View File

@ -8,7 +8,7 @@ Security vulnerabilities should be disclosed to the project maintainers through
Responsible disclosure of security vulnerabilities is rewarded through a bug bounty program on [Immunefi].
There is a bonus reward for issues introduced in release candidates that are reported before making it into a stable release.
There is a bonus reward for issues introduced in release candidates that are reported before making it into a stable release. Learn more about release candidates at [`RELEASING.md`](./RELEASING.md).
## Security Patches
@ -30,13 +30,14 @@ Only critical severity bug fixes will be backported to past major releases.
| Version | Critical security fixes | Other security fixes |
| ------- | ----------------------- | -------------------- |
| 4.x | :white_check_mark: | :white_check_mark: |
| 5.x | :white_check_mark: | :white_check_mark: |
| 4.9 | :white_check_mark: | :x: |
| 3.4 | :white_check_mark: | :x: |
| 2.5 | :white_check_mark: | :x: |
| 2.5 | :x: | :x: |
| < 2.0 | :x: | :x: |
Note as well that the Solidity language itself only guarantees security updates for the latest release.
## Legal
Smart contracts are a nascent techology and carry a high level of technical risk and uncertainty. OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. Your use of the project is also governed by the terms found at www.openzeppelin.com/tos (the "Terms"). As set out in the Terms, you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an on-going duty by any contributor, including OpenZeppelin, to correct any flaws or alert you to all or any of the potential risks of utilizing the project.
Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. Your use of the project is also governed by the terms found at www.openzeppelin.com/tos (the "Terms"). As set out in the Terms, you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an on-going duty by any contributor, including OpenZeppelin, to correct any flaws or alert you to all or any of the potential risks of utilizing the project.

BIN
audits/2023-10-v5.0.pdf Normal file

Binary file not shown.

BIN
audits/2024-10-v5.1.pdf Normal file

Binary file not shown.

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