diff --git a/CHANGELOG.md b/CHANGELOG.md index 4891ed39a91..f96956e0c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Deprecation +- `Initializable` and `UUPSUpgradeable` are no longer transpiled. An alias is present in the `@openzeppelin/contracts-upgradeable` package that redirect to the corresponding file in `@openzeppelin/contracts`. These alias will be removed in the next major release. Developers are advised to update their imports to get these files directly from the `@openzeppelin/contracts` package. - `ECDSA` signature malleability protection is partly deprecated. See documentation for more details. ## 5.4.0 (2025-07-17) diff --git a/contracts/proxy/utils/UUPSUpgradeable.sol b/contracts/proxy/utils/UUPSUpgradeable.sol index d0f58427f9b..6be78251d96 100644 --- a/contracts/proxy/utils/UUPSUpgradeable.sol +++ b/contracts/proxy/utils/UUPSUpgradeable.sol @@ -15,6 +15,8 @@ import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol"; * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. + * + * @custom:stateless */ abstract contract UUPSUpgradeable is IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable diff --git a/package-lock.json b/package-lock.json index d454e9303a4..8e6df71f0d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@nomicfoundation/hardhat-network-helpers": "^1.0.13", "@openzeppelin/docs-utils": "^0.1.5", "@openzeppelin/merkle-tree": "^1.0.7", - "@openzeppelin/upgrade-safe-transpiler": "^0.3.32", + "@openzeppelin/upgrade-safe-transpiler": "^0.4.1", "@openzeppelin/upgrades-core": "^1.20.6", "chai": "^4.2.0", "eslint": "^9.0.0", @@ -1427,6 +1427,29 @@ "url": "https://github.com/sponsors/nzakas" } }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -2008,17 +2031,17 @@ } }, "node_modules/@openzeppelin/upgrade-safe-transpiler": { - "version": "0.3.33", - "resolved": "https://registry.npmjs.org/@openzeppelin/upgrade-safe-transpiler/-/upgrade-safe-transpiler-0.3.33.tgz", - "integrity": "sha512-yKdnfZtfDw0ivonZmDx1YgFJXLNHz/5+XPN7bx/9ObQYKUawmTiOcGC6BKezpphL+witvHQbMhmQbwGIyEoR8g==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/upgrade-safe-transpiler/-/upgrade-safe-transpiler-0.4.1.tgz", + "integrity": "sha512-IxNqDuHLBUp7WcTtrfNrl7ccHzaKLB0Pn9YLE6HyMdzppbBiKls47cHFIC/uLI91cvZP0cheIyvtA3g/3FEdOA==", "dev": true, "license": "MIT", "dependencies": { "ajv": "^8.0.0", "compare-versions": "^6.0.0", - "ethereum-cryptography": "^2.0.0", + "ethereum-cryptography": "^3.0.0", "lodash": "^4.17.20", - "minimatch": "^9.0.0", + "minimatch": "^10.0.3", "minimist": "^1.2.5", "solidity-ast": "^0.4.51" }, @@ -2026,82 +2049,20 @@ "upgrade-safe-transpiler": "dist/cli.js" } }, - "node_modules/@openzeppelin/upgrade-safe-transpiler/node_modules/@noble/curves": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", - "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "node_modules/@openzeppelin/upgrade-safe-transpiler/node_modules/minimatch": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "@noble/hashes": "1.4.0" + "@isaacs/brace-expansion": "^5.0.0" }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@openzeppelin/upgrade-safe-transpiler/node_modules/@noble/hashes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", - "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", - "dev": true, - "license": "MIT", "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@openzeppelin/upgrade-safe-transpiler/node_modules/@scure/base": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", - "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@openzeppelin/upgrade-safe-transpiler/node_modules/@scure/bip32": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", - "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@noble/curves": "~1.4.0", - "@noble/hashes": "~1.4.0", - "@scure/base": "~1.1.6" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@openzeppelin/upgrade-safe-transpiler/node_modules/@scure/bip39": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", - "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@noble/hashes": "~1.4.0", - "@scure/base": "~1.1.6" + "node": "20 || >=22" }, "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@openzeppelin/upgrade-safe-transpiler/node_modules/ethereum-cryptography": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", - "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@noble/curves": "1.4.2", - "@noble/hashes": "1.4.0", - "@scure/bip32": "1.4.0", - "@scure/bip39": "1.3.0" + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/@openzeppelin/upgrades-core": { diff --git a/package.json b/package.json index 285a074ed63..f6960972ad5 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "@nomicfoundation/hardhat-network-helpers": "^1.0.13", "@openzeppelin/docs-utils": "^0.1.5", "@openzeppelin/merkle-tree": "^1.0.7", - "@openzeppelin/upgrade-safe-transpiler": "^0.3.32", + "@openzeppelin/upgrade-safe-transpiler": "^0.4.1", "@openzeppelin/upgrades-core": "^1.20.6", "chai": "^4.2.0", "eslint": "^9.0.0", diff --git a/scripts/upgradeable/alias/Initializable.sol b/scripts/upgradeable/alias/Initializable.sol new file mode 100644 index 00000000000..b5f26b5e2f7 --- /dev/null +++ b/scripts/upgradeable/alias/Initializable.sol @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; diff --git a/scripts/upgradeable/alias/UUPSUpgradeable.sol b/scripts/upgradeable/alias/UUPSUpgradeable.sol new file mode 100644 index 00000000000..e869ba6ba96 --- /dev/null +++ b/scripts/upgradeable/alias/UUPSUpgradeable.sol @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.22; + +import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; diff --git a/scripts/upgradeable/transpile.sh b/scripts/upgradeable/transpile.sh index f7c848c1320..daf4da7270a 100644 --- a/scripts/upgradeable/transpile.sh +++ b/scripts/upgradeable/transpile.sh @@ -23,7 +23,7 @@ fi # -D: delete original and excluded files # -b: use this build info file # -i: use included Initializable -# -x: exclude proxy-related contracts with a few exceptions +# -x: exclude some proxy-related contracts # -p: emit public initializer # -n: use namespaces # -N: exclude from namespaces transformation @@ -32,12 +32,8 @@ npx @openzeppelin/upgrade-safe-transpiler -D \ -b "$build_info" \ -i contracts/proxy/utils/Initializable.sol \ -x 'contracts-exposed/**/*' \ - -x 'contracts/proxy/**/*' \ - -x '!contracts/proxy/Clones.sol' \ - -x '!contracts/proxy/ERC1967/ERC1967Storage.sol' \ - -x '!contracts/proxy/ERC1967/ERC1967Utils.sol' \ - -x '!contracts/proxy/utils/UUPSUpgradeable.sol' \ - -x '!contracts/proxy/beacon/IBeacon.sol' \ + -x 'contracts/proxy/**/*Proxy*.sol' \ + -x 'contracts/proxy/beacon/UpgradeableBeacon.sol' \ -p 'contracts/access/manager/AccessManager.sol' \ -p 'contracts/finance/VestingWallet.sol' \ -p 'contracts/governance/TimelockController.sol' \ @@ -46,5 +42,8 @@ npx @openzeppelin/upgrade-safe-transpiler -D \ -N 'contracts/mocks/**/*' \ -q '@openzeppelin/' +# create alias to Initializable and UUPSUpgradeable +cp $DIRNAME/alias/*.sol contracts/proxy/utils/. + # delete compilation artifacts of vanilla code npm run clean