Skip to content

Commit

Permalink
fix(protocol): fix a deployment issue in TaikoL1 (#16897)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Apr 28, 2024
1 parent 1d5b04c commit c8384f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {
/// @param _owner The owner of this contract. msg.sender will be used if this value is zero.
/// @param _addressManager The address of the {AddressManager} contract.
/// @param _genesisBlockHash The block hash of the genesis block.
/// @param _pause true to pause the contract by default.
/// @param _toPause true to pause the contract by default.
function init(
address _owner,
address _addressManager,
bytes32 _genesisBlockHash,
bool _pause
bool _toPause
)
external
initializer
{
__Essential_init(_owner, _addressManager);
LibVerifying.init(state, getConfig(), _genesisBlockHash);
if (_pause) pause();
if (_toPause) _pause();
}

function init2() external onlyOwner reinitializer(2) {
Expand Down
22 changes: 15 additions & 7 deletions packages/protocol/contracts/common/EssentialContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,16 @@ abstract contract EssentialContract is UUPSUpgradeable, Ownable2StepUpgradeable,
}

/// @notice Pauses the contract.
function pause() public virtual whenNotPaused {
__paused = _TRUE;
emit Paused(msg.sender);
function pause() public virtual {
_pause();
// We call the authorize function here to avoid:
// Warning (5740): Unreachable code.
_authorizePause(msg.sender, true);
}

/// @notice Unpauses the contract.
function unpause() public virtual whenPaused {
__paused = _FALSE;
lastUnpausedAt = uint64(block.timestamp);
emit Unpaused(msg.sender);
function unpause() public virtual {
_unpause();
// We call the authorize function here to avoid:
// Warning (5740): Unreachable code.
_authorizePause(msg.sender, false);
Expand All @@ -108,6 +105,17 @@ abstract contract EssentialContract is UUPSUpgradeable, Ownable2StepUpgradeable,
__paused = _FALSE;
}

function _pause() internal whenNotPaused {
__paused = _TRUE;
emit Paused(msg.sender);
}

function _unpause() internal whenPaused {
__paused = _FALSE;
lastUnpausedAt = uint64(block.timestamp);
emit Unpaused(msg.sender);
}

function _authorizeUpgrade(address) internal virtual override onlyOwner { }

function _authorizePause(address, bool) internal virtual onlyOwner { }
Expand Down

0 comments on commit c8384f2

Please sign in to comment.