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

fix(protocol): fix a deployment issue in TaikoL1 #16897

Merged
merged 4 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
davidtaikocha marked this conversation as resolved.
Show resolved Hide resolved
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 whenNotPaused onlyOwner {
_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 whenPaused onlyOwner {
_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 {
__paused = _TRUE;
emit Paused(msg.sender);
}

function _unpause() internal {
__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