Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OZ][N-10] _disableInitializers() Not Being Called From Initializable Contract Constructors #106

Merged
merged 12 commits into from
Dec 17, 2024
Merged
5 changes: 5 additions & 0 deletions contracts/sfc/NodeDriver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ contract NodeDriver is OwnableUpgradeable, UUPSUpgradeable, INodeDriver {
event UpdateNetworkVersion(uint256 version);
event AdvanceEpochs(uint256 num);

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}

/// Initialization is called only once, after the contract deployment.
/// Because the contract code is written directly into genesis, constructor cannot be used.
function initialize(address _backend, address _evmWriterAddress, address _owner) external initializer {
Expand Down
5 changes: 5 additions & 0 deletions contracts/sfc/NodeDriverAuth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ contract NodeDriverAuth is OwnableUpgradeable, UUPSUpgradeable {
error DriverCodeHashMismatch();
error RecipientNotSFC();

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}

// Initialize NodeDriverAuth, NodeDriver and SFC in one call to allow fewer genesis transactions
function initialize(address payable _sfc, address _driver, address _owner) external initializer {
__Ownable_init(_owner);
Expand Down
5 changes: 5 additions & 0 deletions contracts/sfc/SFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ contract SFC is OwnableUpgradeable, UUPSUpgradeable, Version {
_;
}

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}

/// Initialization is called only once, after the contract deployment.
/// Because the contract code is written directly into genesis, constructor cannot be used.
function initialize(
Expand Down
Loading