Skip to content

Commit

Permalink
refactor(protocol): add MainnetSgxVerifier (#17803)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Jul 16, 2024
1 parent bb2abc5 commit a4be247
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
17 changes: 17 additions & 0 deletions packages/protocol/contracts/mainnet/MainnetSgxVerifier.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 "../verifiers/SgxVerifier.sol";
import "./LibRollupAddressCache.sol";

/// @title MainnetSgxVerifier
/// @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 {SgxVerifier}.
/// @custom:security-contact [email protected]
contract MainnetSgxVerifier is SgxVerifier {
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);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "./ITierRouter.sol";
import "../L1/tiers/ITierRouter.sol";

/// @title TierRouter
/// @title MainnetTierRouter
/// @dev Labeled in AddressResolver as "tier_router"
/// @custom:security-contact [email protected]
contract TierRouter is ITierRouter {
contract MainnetTierRouter is ITierRouter {
/// @inheritdoc ITierRouter
function getProvider(uint256 /*_blockId*/ ) external pure returns (address) {
return 0x4cffe56C947E26D07C14020499776DB3e9AE3a23;
return 0x4cffe56C947E26D07C14020499776DB3e9AE3a23; // TierProviderV2
}
}
8 changes: 7 additions & 1 deletion packages/protocol/script/DeployOnL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "../contracts/mainnet/MainnetSignalService.sol";
import "../contracts/automata-attestation/AutomataDcapV3Attestation.sol";
import "../contracts/automata-attestation/utils/SigVerifyLib.sol";
import "../contracts/automata-attestation/lib/PEMCertChainLib.sol";
import "../contracts/verifiers/SgxVerifier.sol";
import "../contracts/mainnet/MainnetSgxVerifier.sol";
import "../contracts/team/proving/ProverSet.sol";
import "../test/common/erc20/FreeMintERC20.sol";
import "../test/common/erc20/MayFailFreeMintERC20.sol";
Expand Down Expand Up @@ -299,6 +299,12 @@ contract DeployOnL1 is DeployCapability {
registerTo: rollupAddressManager
});

deployProxy({
name: "mainnet_tier_sgx",
impl: address(new MainnetSgxVerifier()),
data: abi.encodeCall(SgxVerifier.init, (owner, rollupAddressManager))
});

deployProxy({
name: "tier_sgx",
impl: address(new SgxVerifier()),
Expand Down

0 comments on commit a4be247

Please sign in to comment.