From 7c57e0ef4094a4ad4fdd3dedb4ff01f8db5ad03e Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 28 Nov 2024 08:20:35 +0100 Subject: [PATCH] Disable initializers to be called directly --- contracts/sfc/NodeDriver.sol | 5 +++++ contracts/sfc/NodeDriverAuth.sol | 5 +++++ contracts/sfc/SFC.sol | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/contracts/sfc/NodeDriver.sol b/contracts/sfc/NodeDriver.sol index 8ff9e07..d0a5002 100644 --- a/contracts/sfc/NodeDriver.sol +++ b/contracts/sfc/NodeDriver.sol @@ -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 { diff --git a/contracts/sfc/NodeDriverAuth.sol b/contracts/sfc/NodeDriverAuth.sol index 94383cd..713dabd 100644 --- a/contracts/sfc/NodeDriverAuth.sol +++ b/contracts/sfc/NodeDriverAuth.sol @@ -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); diff --git a/contracts/sfc/SFC.sol b/contracts/sfc/SFC.sol index ef9b782..159f91f 100644 --- a/contracts/sfc/SFC.sol +++ b/contracts/sfc/SFC.sol @@ -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(