Skip to content

Commit

Permalink
Merge branch 'main' into l1-deployment-716
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Jul 17, 2024
2 parents 1f8b053 + 1d5a6ff commit 8f7b28f
Show file tree
Hide file tree
Showing 25 changed files with 83 additions and 68 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 @@ -42,19 +42,19 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents {

/// @notice Initializes the contract.
/// @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 _rollupAddressManager The address of the {AddressManager} contract.
/// @param _genesisBlockHash The block hash of the genesis block.
/// @param _toPause true to pause the contract by default.
function init(
address _owner,
address _addressManager,
address _rollupAddressManager,
bytes32 _genesisBlockHash,
bool _toPause
)
external
initializer
{
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _rollupAddressManager);
LibUtils.init(state, _genesisBlockHash);
if (_toPause) _pause();
}
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/L1/provers/GuardianProver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ contract GuardianProver is IVerifier, EssentialContract {

/// @notice Initializes the contract.
/// @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.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _rollupAddressManager The address of the {AddressManager} contract.
function init(address _owner, address _rollupAddressManager) external initializer {
__Essential_init(_owner, _rollupAddressManager);
}

/// @notice Set the set of guardians
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/L2/DelegateOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ contract DelegateOwner is EssentialContract, IMessageInvocable {
/// @param _remoteOwner The real owner on L1 that can send a cross-chain message to invoke
/// `onMessageInvocation`.
/// @param _remoteChainId The L1 chain's ID.
/// @param _addressManager The address of the {AddressManager} contract.
/// @param _sharedAddressManager The address of the {AddressManager} contract.
/// @param _admin The admin address.
function init(
address _remoteOwner,
address _addressManager,
address _sharedAddressManager,
uint64 _remoteChainId,
address _admin
)
external
initializer
{
// This contract's owner will be itself.
__Essential_init(address(this), _addressManager);
__Essential_init(address(this), _sharedAddressManager);

if (_remoteOwner == address(0) || _remoteChainId == 0 || _remoteChainId == block.chainid) {
revert DO_INVALID_PARAM();
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/L2/TaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ contract TaikoL2 is EssentialContract {

/// @notice Initializes the contract.
/// @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 _rollupAddressManager The address of the {AddressManager} contract.
/// @param _l1ChainId The ID of the base layer.
/// @param _gasExcess The initial gasExcess.
function init(
address _owner,
address _addressManager,
address _rollupAddressManager,
uint64 _l1ChainId,
uint64 _gasExcess
)
external
initializer
{
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _rollupAddressManager);

if (_l1ChainId == 0 || _l1ChainId == block.chainid) {
revert L2_INVALID_L1_CHAIN_ID();
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ 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 _addressManager The address of the {AddressManager} contract.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _sharedAddressManager The address of the {AddressManager} contract.
function init(address _owner, address _sharedAddressManager) external initializer {
__Essential_init(_owner, _sharedAddressManager);
}

function init2() external onlyOwner reinitializer(2) {
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/bridge/QuotaManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ contract QuotaManager is EssentialContract, IQuotaManager {

/// @notice Initializes the contract.
/// @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 _sharedAddressManager The address of the {AddressManager} contract.
/// @param _quotaPeriod The time required to restore all quota.
function init(
address _owner,
address _addressManager,
address _sharedAddressManager,
uint24 _quotaPeriod
)
external
initializer
{
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _sharedAddressManager);
_setQuotaPeriod(_quotaPeriod);
}

Expand Down
3 changes: 3 additions & 0 deletions packages/protocol/contracts/mainnet/LibRollupAddressCache.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ library LibRollupAddressCache {
if (_name == LibStrings.B_AUTOMATA_DCAP_ATTESTATION) {
return (true, 0x8d7C954960a36a7596d7eA4945dDf891967ca8A3);
}
if (_name == LibStrings.B_CHAIN_WATCHDOG) {
return (true, address(0));
}
}
return (false, address(0));
}
Expand Down
17 changes: 17 additions & 0 deletions packages/protocol/contracts/mainnet/MainnetGuardianProver.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "../L1/provers/GuardianProver.sol";
import "./LibRollupAddressCache.sol";

/// @title MainnetGuardianProver
/// @dev This contract shall be deployed to replace its parent contract on Ethereum for Taiko
/// mainnet to reduce gas cost.
/// @notice See the documentation in {GuardianProver}.
/// @custom:security-contact [email protected]
contract MainnetGuardianProver is GuardianProver {
function _getAddress(uint64 _chainId, bytes32 _name) internal view override returns (address) {
(bool found, address addr) = LibRollupAddressCache.getAddress(_chainId, _name);
return found ? addr : super._getAddress(_chainId, _name);
}
}
6 changes: 3 additions & 3 deletions packages/protocol/contracts/signal/SignalService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ contract SignalService is EssentialContract, ISignalService {

/// @notice Initializes the contract.
/// @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.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _sharedAddressManager The address of the {AddressManager} contract.
function init(address _owner, address _sharedAddressManager) external initializer {
__Essential_init(_owner, _sharedAddressManager);
}

/// @dev Authorize or deauthorize an address for calling syncChainData.
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/team/proving/ProverSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ contract ProverSet is EssentialContract, IERC1271 {
function init(
address _owner,
address _admin,
address _addressManager
address _rollupAddressManager
)
external
nonZeroAddr(_admin)
initializer
{
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _rollupAddressManager);
admin = _admin;
IERC20(tkoToken()).approve(taikoL1(), type(uint256).max);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ contract TokenUnlock is EssentialContract {

/// @notice Initializes the contract.
/// @param _owner The contract owner address.
/// @param _addressManager The rollup address manager.
/// @param _rollupAddressManager The rollup address manager.
/// @param _recipient Who will be the grantee for this contract.
/// @param _tgeTimestamp The token generation event timestamp.
function init(
address _owner,
address _addressManager,
address _rollupAddressManager,
address _recipient,
uint64 _tgeTimestamp
)
Expand All @@ -84,7 +84,7 @@ contract TokenUnlock is EssentialContract {
{
if (_owner == _recipient) revert INVALID_PARAM();

__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _rollupAddressManager);

recipient = _recipient;
tgeTimestamp = _tgeTimestamp;
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/tko/BridgedTaikoToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import "./TaikoTokenBase.sol";
contract BridgedTaikoToken is TaikoTokenBase, IBridgedERC20 {
/// @notice Initializes the contract.
/// @param _owner The owner of this contract. msg.sender will be used if this value is zero.
/// @param _addressManager The address manager address.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _sharedAddressManager The address manager address.
function init(address _owner, address _sharedAddressManager) external initializer {
__Essential_init(_owner, _sharedAddressManager);
__ERC20_init("Taiko Token", "TKO");
__ERC20Votes_init();
__ERC20Permit_init("Taiko Token");
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/tokenvault/BridgedERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract BridgedERC1155 is
/// @inheritdoc IBridgedERC1155Initializable
function init(
address _owner,
address _addressManager,
address _sharedAddressManager,
address _srcToken,
uint256 _srcChainId,
string calldata _symbol,
Expand All @@ -48,7 +48,7 @@ contract BridgedERC1155 is
// The symbol and the name can be empty for ERC1155 tokens so we use some placeholder data
// for them instead.
LibBridgedToken.validateInputs(_srcToken, _srcChainId);
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _sharedAddressManager);

// The token URI here is not important as the client will have to read the URI from the
// canonical contract to fetch meta data.
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/tokenvault/BridgedERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract BridgedERC20 is
/// @inheritdoc IBridgedERC20Initializable
function init(
address _owner,
address _addressManager,
address _sharedAddressManager,
address _srcToken,
uint256 _srcChainId,
uint8 _decimals,
Expand All @@ -72,7 +72,7 @@ contract BridgedERC20 is
{
// Check if provided parameters are valid
LibBridgedToken.validateInputs(_srcToken, _srcChainId);
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _sharedAddressManager);
__ERC20_init(_name, _symbol);

// Set contract properties
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/tokenvault/BridgedERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract BridgedERC721 is
/// @inheritdoc IBridgedERC721Initializable
function init(
address _owner,
address _addressManager,
address _sharedAddressManager,
address _srcToken,
uint256 _srcChainId,
string calldata _symbol,
Expand All @@ -41,7 +41,7 @@ contract BridgedERC721 is
{
// Check if provided parameters are valid
LibBridgedToken.validateInputs(_srcToken, _srcChainId);
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _sharedAddressManager);
__ERC721_init(_name, _symbol);

srcToken = _srcToken;
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/tokenvault/ERC1155Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable {

/// @notice Initializes the contract.
/// @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.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _sharedAddressManager The address of the {AddressManager} contract.
function init(address _owner, address _sharedAddressManager) external initializer {
__Essential_init(_owner, _sharedAddressManager);
__ERC1155Receiver_init();
}
/// @notice Transfers ERC1155 tokens to this vault and sends a message to
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/tokenvault/ERC20Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ contract ERC20Vault is BaseVault {

/// @notice Initializes the contract.
/// @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.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _sharedAddressManager The address of the {AddressManager} contract.
function init(address _owner, address _sharedAddressManager) external initializer {
__Essential_init(_owner, _sharedAddressManager);
}

/// @notice Change bridged token.
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/tokenvault/ERC721Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ contract ERC721Vault is BaseNFTVault, IERC721Receiver {

/// @notice Initializes the contract.
/// @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.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _sharedAddressManager The address of the {AddressManager} contract.
function init(address _owner, address _sharedAddressManager) external initializer {
__Essential_init(_owner, _sharedAddressManager);
}

/// @notice Transfers ERC721 tokens to this vault and sends a message to the
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/tokenvault/IBridgedERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ interface IBridgedERC1155 {
interface IBridgedERC1155Initializable {
/// @notice Initializes the contract.
/// @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 _sharedAddressManager The address of the {AddressManager} contract.
/// @param _srcToken Address of the source token.
/// @param _srcChainId Source chain ID.
/// @param _symbol Symbol of the bridged token.
/// @param _name Name of the bridged token.
function init(
address _owner,
address _addressManager,
address _sharedAddressManager,
address _srcToken,
uint256 _srcChainId,
string calldata _symbol,
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/tokenvault/IBridgedERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ interface IBridgedERC20Migratable {
interface IBridgedERC20Initializable {
/// @notice Initializes the contract.
/// @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 _sharedAddressManager The address of the {AddressManager} contract.
/// @param _srcToken The source token address.
/// @param _srcChainId The source chain ID.
/// @param _decimals The number of decimal places of the source token.
/// @param _symbol The symbol of the token.
/// @param _name The name of the token.
function init(
address _owner,
address _addressManager,
address _sharedAddressManager,
address _srcToken,
uint256 _srcChainId,
uint8 _decimals,
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/tokenvault/IBridgedERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ interface IBridgedERC721 {
interface IBridgedERC721Initializable {
/// @notice Initializes the contract.
/// @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 _sharedAddressManager The address of the {AddressManager} contract.
/// @param _srcToken Address of the source token.
/// @param _srcChainId Source chain ID.
/// @param _symbol Symbol of the bridged token.
/// @param _name Name of the bridged token.
function init(
address _owner,
address _addressManager,
address _sharedAddressManager,
address _srcToken,
uint256 _srcChainId,
string calldata _symbol,
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/verifiers/RiscZeroVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ contract RiscZeroVerifier is EssentialContract, IVerifier {

/// @notice Initializes the contract with the provided address manager.
/// @param _owner The address of the owner.
/// @param _addressManager The address of the AddressManager.
/// @param _rollupAddressManager The address of the AddressManager.
/// @param _receiptVerifier The address of the risc zero receipt verifier contract.
function init(
address _owner,
address _addressManager,
address _rollupAddressManager,
address _receiptVerifier
)
external
initializer
{
__Essential_init(_owner, _addressManager);
__Essential_init(_owner, _rollupAddressManager);
receiptVerifier = IRiscZeroReceiptVerifier(_receiptVerifier);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/verifiers/SgxVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ contract SgxVerifier is EssentialContract, IVerifier {

/// @notice Initializes the contract.
/// @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.
function init(address _owner, address _addressManager) external initializer {
__Essential_init(_owner, _addressManager);
/// @param _rollupAddressManager The address of the {AddressManager} contract.
function init(address _owner, address _rollupAddressManager) external initializer {
__Essential_init(_owner, _rollupAddressManager);
}

/// @notice Adds trusted SGX instances to the registry.
Expand Down
Loading

0 comments on commit 8f7b28f

Please sign in to comment.