v4.4.1
版本发布时间: 2021-12-15 03:07:32
OpenZeppelin/openzeppelin-contracts最新发布版本:v5.1.0-rc.0(2024-10-03 22:56:46)
:warning: This is a patch for a low severity vulnerability. For more information visit the security advisory.
-
Initializable
: change the existinginitializer
modifier and add a newonlyInitializing
modifier to prevent reentrancy risk. (#3006)
Breaking change
It is no longer possible to call an initializer
-protected function from within another initializer
function outside the context of a constructor. Projects using OpenZeppelin upgradeable proxies should continue to work as is, since in the common case the initializer is invoked in the constructor directly. If this is not the case for you, the suggested change is to use the new onlyInitializing
modifier in the following way:
contract A {
- function initialize() public initializer { ... }
+ function initialize() internal onlyInitializing { ... }
}
contract B is A {
function initialize() public initializer {
A.initialize();
}
}