Skip to content

Commit c87e6eb

Browse files
authored
[OZ][N-10] _disableInitializers() Not Being Called From Initializable Contract Constructors (#106)
1 parent 3d3be8e commit c87e6eb

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

contracts/sfc/NodeDriver.sol

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ contract NodeDriver is OwnableUpgradeable, UUPSUpgradeable, INodeDriver {
3535
event UpdateNetworkVersion(uint256 version);
3636
event AdvanceEpochs(uint256 num);
3737

38+
/// @custom:oz-upgrades-unsafe-allow constructor
39+
constructor() {
40+
_disableInitializers();
41+
}
42+
3843
/// Initialization is called only once, after the contract deployment.
3944
/// Because the contract code is written directly into genesis, constructor cannot be used.
4045
function initialize(address _backend, address _evmWriterAddress, address _owner) external initializer {

contracts/sfc/NodeDriverAuth.sol

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ contract NodeDriverAuth is OwnableUpgradeable, UUPSUpgradeable {
2121
error DriverCodeHashMismatch();
2222
error RecipientNotSFC();
2323

24+
/// @custom:oz-upgrades-unsafe-allow constructor
25+
constructor() {
26+
_disableInitializers();
27+
}
28+
2429
// Initialize NodeDriverAuth, NodeDriver and SFC in one call to allow fewer genesis transactions
2530
function initialize(address payable _sfc, address _driver, address _owner) external initializer {
2631
__Ownable_init(_owner);

contracts/sfc/SFC.sol

+5
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ contract SFC is OwnableUpgradeable, UUPSUpgradeable, Version {
229229
_;
230230
}
231231

232+
/// @custom:oz-upgrades-unsafe-allow constructor
233+
constructor() {
234+
_disableInitializers();
235+
}
236+
232237
/// Initialization is called only once, after the contract deployment.
233238
/// Because the contract code is written directly into genesis, constructor cannot be used.
234239
function initialize(

0 commit comments

Comments
 (0)