From 9d06958e713e530fdd610c439c7b93199d0dcc69 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:25:56 +0800 Subject: [PATCH] feat(protocol): make sure `init()` covers logics in `init2()`, `init3()`.. (#18292) --- packages/protocol/contracts/layer1/based/TaikoL1.sol | 2 +- packages/protocol/contracts/shared/bridge/Bridge.sol | 2 +- .../protocol/contracts/shared/common/AddressManager.sol | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/protocol/contracts/layer1/based/TaikoL1.sol b/packages/protocol/contracts/layer1/based/TaikoL1.sol index c9bf899783e..9864fd037fc 100644 --- a/packages/protocol/contracts/layer1/based/TaikoL1.sol +++ b/packages/protocol/contracts/layer1/based/TaikoL1.sol @@ -49,7 +49,7 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents { bool _toPause ) external - initializer + reinitializer(2) { __Essential_init(_owner, _rollupAddressManager); LibUtils.init(state, getConfig(), _genesisBlockHash); diff --git a/packages/protocol/contracts/shared/bridge/Bridge.sol b/packages/protocol/contracts/shared/bridge/Bridge.sol index d160c5a7436..813445ef678 100644 --- a/packages/protocol/contracts/shared/bridge/Bridge.sol +++ b/packages/protocol/contracts/shared/bridge/Bridge.sol @@ -104,7 +104,7 @@ contract Bridge is EssentialContract, IBridge { /// @notice Initializes the contract. /// @param _owner The owner of this contract. msg.sender will be used if this value is zero. /// @param _sharedAddressManager The address of the {AddressManager} contract. - function init(address _owner, address _sharedAddressManager) external initializer { + function init(address _owner, address _sharedAddressManager) external reinitializer(2) { __Essential_init(_owner, _sharedAddressManager); } diff --git a/packages/protocol/contracts/shared/common/AddressManager.sol b/packages/protocol/contracts/shared/common/AddressManager.sol index ad064952fe2..d16e9f97c55 100644 --- a/packages/protocol/contracts/shared/common/AddressManager.sol +++ b/packages/protocol/contracts/shared/common/AddressManager.sol @@ -24,10 +24,9 @@ contract AddressManager is EssentialContract, IAddressManager { error AM_ADDRESS_ALREADY_SET(); /// @notice Initializes the contract. - /// @param _owner The owner of this contract. msg.sender will be used if this value is zero. - function init(address _owner) external initializer { - __Essential_init(_owner); - addressManager = address(this); + /// @param _owner The owner of this contract. + function init(address _owner) external reinitializer(2) { + __Essential_init(_owner, address(this)); } function init2() external onlyOwner reinitializer(2) {