Commit 5ffa5bd8 authored by Maurelian's avatar Maurelian Committed by GitHub

Merge pull request #8293 from ethereum-optimism/feat/portal-reads-superchainconfig

Portal reads pause status from SuperchainConfig
parents 2827e697 6f9b8ea4
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -122,8 +122,8 @@ type DeployConfig struct { ...@@ -122,8 +122,8 @@ type DeployConfig struct {
// FinalSystemOwner is the owner of the system on L1. Any L1 contract that is ownable has // FinalSystemOwner is the owner of the system on L1. Any L1 contract that is ownable has
// this account set as its owner. // this account set as its owner.
FinalSystemOwner common.Address `json:"finalSystemOwner"` FinalSystemOwner common.Address `json:"finalSystemOwner"`
// PortalGuardian represents the GUARDIAN account in the OptimismPortal. Has the ability to pause withdrawals. // SuperchainConfigGuardian represents the GUARDIAN account in the SuperchainConfig. Has the ability to pause withdrawals.
PortalGuardian common.Address `json:"portalGuardian"` SuperchainConfigGuardian common.Address `json:"superchainConfigGuardian"`
// BaseFeeVaultRecipient represents the recipient of fees accumulated in the BaseFeeVault. // BaseFeeVaultRecipient represents the recipient of fees accumulated in the BaseFeeVault.
// Can be an account on L1 or L2, depending on the BaseFeeVaultWithdrawalNetwork value. // Can be an account on L1 or L2, depending on the BaseFeeVaultWithdrawalNetwork value.
BaseFeeVaultRecipient common.Address `json:"baseFeeVaultRecipient"` BaseFeeVaultRecipient common.Address `json:"baseFeeVaultRecipient"`
...@@ -252,8 +252,8 @@ func (d *DeployConfig) Check() error { ...@@ -252,8 +252,8 @@ func (d *DeployConfig) Check() error {
if d.L2OutputOracleStartingBlockNumber == 0 { if d.L2OutputOracleStartingBlockNumber == 0 {
log.Warn("L2OutputOracleStartingBlockNumber is 0, should only be 0 for fresh chains") log.Warn("L2OutputOracleStartingBlockNumber is 0, should only be 0 for fresh chains")
} }
if d.PortalGuardian == (common.Address{}) { if d.SuperchainConfigGuardian == (common.Address{}) {
return fmt.Errorf("%w: PortalGuardian cannot be address(0)", ErrInvalidDeployConfig) return fmt.Errorf("%w: SuperchainConfigGuardian cannot be address(0)", ErrInvalidDeployConfig)
} }
if d.MaxSequencerDrift == 0 { if d.MaxSequencerDrift == 0 {
return fmt.Errorf("%w: MaxSequencerDrift cannot be 0", ErrInvalidDeployConfig) return fmt.Errorf("%w: MaxSequencerDrift cannot be 0", ErrInvalidDeployConfig)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"l1GenesisBlockGasLimit": "0x1c9c380", "l1GenesisBlockGasLimit": "0x1c9c380",
"l1GenesisBlockDifficulty": "0x1", "l1GenesisBlockDifficulty": "0x1",
"finalSystemOwner": "0xbcd4042de499d14e55001ccbb24a551f3b954096", "finalSystemOwner": "0xbcd4042de499d14e55001ccbb24a551f3b954096",
"portalGuardian": "0x0000000000000000000000000000000000000112", "superchainConfigGuardian": "0x0000000000000000000000000000000000000112",
"finalizationPeriodSeconds": 2, "finalizationPeriodSeconds": 2,
"l1GenesisBlockMixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "l1GenesisBlockMixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"l1GenesisBlockCoinbase": "0x0000000000000000000000000000000000000000", "l1GenesisBlockCoinbase": "0x0000000000000000000000000000000000000000",
......
...@@ -269,9 +269,9 @@ func OptimismPortal(batch *safe.Batch, implementations superchain.Implementation ...@@ -269,9 +269,9 @@ func OptimismPortal(batch *safe.Batch, implementations superchain.Implementation
return err return err
} }
var portalGuardian common.Address var superchainConfigGuardian common.Address
if config != nil { if config != nil {
portalGuardian = config.PortalGuardian superchainConfigGuardian = config.SuperchainConfigGuardian
} else { } else {
optimismPortal, err := bindings.NewOptimismPortalCaller(common.HexToAddress(list.OptimismPortalProxy.String()), backend) optimismPortal, err := bindings.NewOptimismPortalCaller(common.HexToAddress(list.OptimismPortalProxy.String()), backend)
if err != nil { if err != nil {
...@@ -281,10 +281,10 @@ func OptimismPortal(batch *safe.Batch, implementations superchain.Implementation ...@@ -281,10 +281,10 @@ func OptimismPortal(batch *safe.Batch, implementations superchain.Implementation
if err != nil { if err != nil {
return err return err
} }
portalGuardian = guardian superchainConfigGuardian = guardian
} }
calldata, err := optimismPortalABI.Pack("initialize", common.HexToAddress(list.L2OutputOracleProxy.String()), portalGuardian, common.HexToAddress(chainConfig.SystemConfigAddr.String()), false) calldata, err := optimismPortalABI.Pack("initialize", common.HexToAddress(list.L2OutputOracleProxy.String()), superchainConfigGuardian, common.HexToAddress(chainConfig.SystemConfigAddr.String()), false)
if err != nil { if err != nil {
return err return err
} }
......
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 352334) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 352322)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2950496) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2950484)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 540710) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 540698)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4052903) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4052891)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 442015) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 442003)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3487764) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3487752)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 42970) GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 42970)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 86629) GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 86629)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68474) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68462)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68911) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68899)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 143100) GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 153527)
\ No newline at end of file \ No newline at end of file
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
| l2Sender | address | 50 | 0 | 20 | src/L1/OptimismPortal.sol:OptimismPortal | | l2Sender | address | 50 | 0 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
| finalizedWithdrawals | mapping(bytes32 => bool) | 51 | 0 | 32 | src/L1/OptimismPortal.sol:OptimismPortal | | finalizedWithdrawals | mapping(bytes32 => bool) | 51 | 0 | 32 | src/L1/OptimismPortal.sol:OptimismPortal |
| provenWithdrawals | mapping(bytes32 => struct OptimismPortal.ProvenWithdrawal) | 52 | 0 | 32 | src/L1/OptimismPortal.sol:OptimismPortal | | provenWithdrawals | mapping(bytes32 => struct OptimismPortal.ProvenWithdrawal) | 52 | 0 | 32 | src/L1/OptimismPortal.sol:OptimismPortal |
| paused | bool | 53 | 0 | 1 | src/L1/OptimismPortal.sol:OptimismPortal | | spacer_53_0_1 | bool | 53 | 0 | 1 | src/L1/OptimismPortal.sol:OptimismPortal |
| superchainConfig | contract SuperchainConfig | 53 | 1 | 20 | src/L1/OptimismPortal.sol:OptimismPortal |
======================= =======================
➡ src/L1/SystemConfig.sol:SystemConfig ➡ src/L1/SystemConfig.sol:SystemConfig
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
"sequencerFeeVaultWithdrawalNetwork": "remote", "sequencerFeeVaultWithdrawalNetwork": "remote",
"proxyAdminOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720", "proxyAdminOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
"finalSystemOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720", "finalSystemOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
"portalGuardian": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720", "superchainConfigGuardian": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
"finalizationPeriodSeconds": 2, "finalizationPeriodSeconds": 2,
"fundDevAccounts": true, "fundDevAccounts": true,
"l2GenesisBlockBaseFeePerGas": "0x1", "l2GenesisBlockBaseFeePerGas": "0x1",
......
{ {
"finalSystemOwner": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f", "finalSystemOwner": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f",
"portalGuardian": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f", "superchainConfigGuardian": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f",
"l1StartingBlockTag": "0x6ffc1bf3754c01f6bb9fe057c1578b87a8571ce2e9be5ca14bace6eccfd336c7", "l1StartingBlockTag": "0x6ffc1bf3754c01f6bb9fe057c1578b87a8571ce2e9be5ca14bace6eccfd336c7",
"l1ChainID": 5, "l1ChainID": 5,
"l2ChainID": 420, "l2ChainID": 420,
......
{ {
"finalSystemOwner": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc", "finalSystemOwner": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
"portalGuardian": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc", "superchainConfigGuardian": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
"proxyAdminOwner": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc", "proxyAdminOwner": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
"l1StartingBlockTag": "earliest", "l1StartingBlockTag": "earliest",
"l1ChainID": 900, "l1ChainID": 900,
......
{ {
"finalSystemOwner": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF", "finalSystemOwner": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF",
"portalGuardian": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF", "superchainConfigGuardian": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF",
"l1StartingBlockTag": "0x19c7e6b18fe156e45f4cfef707294fd8f079fa9c30a7b7cd6ec1ce3682ec6a2e", "l1StartingBlockTag": "0x19c7e6b18fe156e45f4cfef707294fd8f079fa9c30a7b7cd6ec1ce3682ec6a2e",
"l1ChainID": 5, "l1ChainID": 5,
"l2ChainID": 998, "l2ChainID": 998,
......
{ {
"finalSystemOwner": "0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A", "finalSystemOwner": "0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A",
"portalGuardian": "0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A", "superchainConfigGuardian": "0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A",
"l1StartingBlockTag": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108", "l1StartingBlockTag": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108",
"l1ChainID": 1, "l1ChainID": 1,
"l2ChainID": 10, "l2ChainID": 10,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"batchInboxAddress": "0x454A2A86132C937AD4eFc8721f1b85418f92cbCe", "batchInboxAddress": "0x454A2A86132C937AD4eFc8721f1b85418f92cbCe",
"batchSenderAddress": "0x7224e05E6cF6E07aFBE1eFa09a3fA23A637DD485", "batchSenderAddress": "0x7224e05E6cF6E07aFBE1eFa09a3fA23A637DD485",
"l2GenesisRegolithTimeOffset": "0x0", "l2GenesisRegolithTimeOffset": "0x0",
"portalGuardian": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7", "superchainConfigGuardian": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7",
"l2OutputOracleSubmissionInterval": 180, "l2OutputOracleSubmissionInterval": 180,
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": -1,
"l2OutputOracleProposer": "0xD457799C5ba870D609f21048c67a9b11aC611BF0", "l2OutputOracleProposer": "0xD457799C5ba870D609f21048c67a9b11aC611BF0",
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"batchInboxAddress": "0xC1B90E1e459aBBDcEc4DCF90dA45ba077d83BFc5", "batchInboxAddress": "0xC1B90E1e459aBBDcEc4DCF90dA45ba077d83BFc5",
"batchSenderAddress": "0x99526b0e49A95833E734EB556A6aBaFFAb0Ee167", "batchSenderAddress": "0x99526b0e49A95833E734EB556A6aBaFFAb0Ee167",
"l2GenesisRegolithTimeOffset": "0x0", "l2GenesisRegolithTimeOffset": "0x0",
"portalGuardian": "0x39E13D1AB040F6EA58CE19998edCe01B3C365f84", "superchainConfigGuardian": "0x39E13D1AB040F6EA58CE19998edCe01B3C365f84",
"l2OutputOracleSubmissionInterval": 1800, "l2OutputOracleSubmissionInterval": 1800,
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": -1,
"l2OutputOracleProposer": "0x69968Ce0E92d9c101BAd81de55EFbcb69603cFe3", "l2OutputOracleProposer": "0x69968Ce0E92d9c101BAd81de55EFbcb69603cFe3",
......
{ {
"finalSystemOwner": "0xfd1D2e729aE8eEe2E146c033bf4400fE75284301", "finalSystemOwner": "0xfd1D2e729aE8eEe2E146c033bf4400fE75284301",
"portalGuardian": "0xfd1D2e729aE8eEe2E146c033bf4400fE75284301", "superchainConfigGuardian": "0xfd1D2e729aE8eEe2E146c033bf4400fE75284301",
"l1StartingBlockTag": "0x48f520cf4ddaf34c8336e6e490632ea3cf1e5e93b0b2bc6e917557e31845371b", "l1StartingBlockTag": "0x48f520cf4ddaf34c8336e6e490632ea3cf1e5e93b0b2bc6e917557e31845371b",
"l1ChainID": 11155111, "l1ChainID": 11155111,
"l2ChainID": 11155420, "l2ChainID": 11155420,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"batchInboxAddress": "0xcF628E24aC574866D3d0a7CFE4e9DA7278b7ef13", "batchInboxAddress": "0xcF628E24aC574866D3d0a7CFE4e9DA7278b7ef13",
"batchSenderAddress": "0x427c9a666d3b27873111cE3894712Bf64C6343A0", "batchSenderAddress": "0x427c9a666d3b27873111cE3894712Bf64C6343A0",
"l2GenesisRegolithTimeOffset": "0x0", "l2GenesisRegolithTimeOffset": "0x0",
"portalGuardian": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7", "superchainConfigGuardian": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7",
"l2OutputOracleSubmissionInterval": 180, "l2OutputOracleSubmissionInterval": 180,
"l2OutputOracleStartingTimestamp": 0, "l2OutputOracleStartingTimestamp": 0,
"l2OutputOracleProposer": "0xa98B585654fC03E2fEa3FAB56E1C851E4f5c2B54", "l2OutputOracleProposer": "0xa98B585654fC03E2fEa3FAB56E1C851E4f5c2B54",
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"batchInboxAddress": "0x6F54Ca6F6EdE96662024Ffd61BFd18f3f4e34DFf", "batchInboxAddress": "0x6F54Ca6F6EdE96662024Ffd61BFd18f3f4e34DFf",
"batchSenderAddress": "0x625726c858dBF78c0125436C943Bf4b4bE9d9033", "batchSenderAddress": "0x625726c858dBF78c0125436C943Bf4b4bE9d9033",
"l2GenesisRegolithTimeOffset": "0x0", "l2GenesisRegolithTimeOffset": "0x0",
"portalGuardian": "0xC72aE5c7cc9a332699305E29F68Be66c73b60542", "superchainConfigGuardian": "0xC72aE5c7cc9a332699305E29F68Be66c73b60542",
"l2OutputOracleSubmissionInterval": 1800, "l2OutputOracleSubmissionInterval": 1800,
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": -1,
"l2OutputOracleProposer": "0x48247032092e7b0ecf5dEF611ad89eaf3fC888Dd", "l2OutputOracleProposer": "0x48247032092e7b0ecf5dEF611ad89eaf3fC888Dd",
......
...@@ -43,7 +43,7 @@ library ChainAssertions { ...@@ -43,7 +43,7 @@ library ChainAssertions {
checkL2OutputOracle(_prox, _cfg, _l2OutputOracleStartingTimestamp, _l2OutputOracleStartingBlockNumber); checkL2OutputOracle(_prox, _cfg, _l2OutputOracleStartingTimestamp, _l2OutputOracleStartingBlockNumber);
checkOptimismMintableERC20Factory(_prox); checkOptimismMintableERC20Factory(_prox);
checkL1ERC721Bridge(_prox); checkL1ERC721Bridge(_prox);
checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isPaused: false }); checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
checkProtocolVersions({ _contracts: _prox, _cfg: _cfg, _isProxy: true }); checkProtocolVersions({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
} }
...@@ -135,28 +135,25 @@ library ChainAssertions { ...@@ -135,28 +135,25 @@ library ChainAssertions {
} }
/// @notice Asserts the OptimismPortal is setup correctly /// @notice Asserts the OptimismPortal is setup correctly
function checkOptimismPortal( function checkOptimismPortal(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isPaused
)
internal
view
{
OptimismPortal portal = OptimismPortal(payable(_contracts.OptimismPortal)); OptimismPortal portal = OptimismPortal(payable(_contracts.OptimismPortal));
address guardian = _cfg.portalGuardian(); address guardian = _cfg.superchainConfigGuardian();
if (guardian.code.length == 0) { if (guardian.code.length == 0) {
console.log("Portal guardian has no code: %s", guardian); console.log("Guardian has no code: %s", guardian);
} }
require(address(portal.L2_ORACLE()) == _contracts.L2OutputOracle); require(address(portal.L2_ORACLE()) == _contracts.L2OutputOracle);
require(address(portal.l2Oracle()) == _contracts.L2OutputOracle); require(address(portal.l2Oracle()) == _contracts.L2OutputOracle);
require(portal.GUARDIAN() == _cfg.portalGuardian());
require(portal.guardian() == _cfg.portalGuardian());
require(address(portal.SYSTEM_CONFIG()) == _contracts.SystemConfig); require(address(portal.SYSTEM_CONFIG()) == _contracts.SystemConfig);
require(address(portal.systemConfig()) == _contracts.SystemConfig); require(address(portal.systemConfig()) == _contracts.SystemConfig);
require(portal.paused() == _isPaused);
if (_isProxy) {
require(portal.GUARDIAN() == _cfg.superchainConfigGuardian());
require(portal.guardian() == _cfg.superchainConfigGuardian());
require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig));
require(portal.paused() == SuperchainConfig(_contracts.SuperchainConfig).paused());
}
} }
/// @notice Asserts that the ProtocolVersions is setup correctly /// @notice Asserts that the ProtocolVersions is setup correctly
...@@ -181,9 +178,16 @@ library ChainAssertions { ...@@ -181,9 +178,16 @@ library ChainAssertions {
} }
/// @notice Asserts that the SuperchainConfig is setup correctly /// @notice Asserts that the SuperchainConfig is setup correctly
function checkSuperchainConfig(Types.ContractSet memory _contracts, DeployConfig _cfg) internal view { function checkSuperchainConfig(
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isPaused
)
internal
view
{
SuperchainConfig superchainConfig = SuperchainConfig(_contracts.SuperchainConfig); SuperchainConfig superchainConfig = SuperchainConfig(_contracts.SuperchainConfig);
require(superchainConfig.guardian() == _cfg.portalGuardian()); require(superchainConfig.guardian() == _cfg.superchainConfigGuardian());
require(superchainConfig.paused() == false); require(superchainConfig.paused() == _isPaused);
} }
} }
...@@ -497,18 +497,13 @@ contract Deploy is Deployer { ...@@ -497,18 +497,13 @@ contract Deploy is Deployer {
/// @notice Deploy the OptimismPortal /// @notice Deploy the OptimismPortal
function deployOptimismPortal() public broadcast returns (address addr_) { function deployOptimismPortal() public broadcast returns (address addr_) {
console.log("Deploying OptimismPortal implementation"); console.log("Deploying OptimismPortal implementation");
address guardian = cfg.portalGuardian();
if (guardian.code.length == 0) {
console.log("Portal guardian has no code: %s", guardian);
}
L2OutputOracle l2OutputOracle = L2OutputOracle(mustGetAddress("L2OutputOracleProxy")); L2OutputOracle l2OutputOracle = L2OutputOracle(mustGetAddress("L2OutputOracleProxy"));
SystemConfig systemConfig = SystemConfig(mustGetAddress("SystemConfigProxy")); SystemConfig systemConfig = SystemConfig(mustGetAddress("SystemConfigProxy"));
SuperchainConfig superchainConfig = SuperchainConfig(mustGetAddress("SuperchainConfigProxy"));
OptimismPortal portal = new OptimismPortal{ salt: _implSalt() }({ OptimismPortal portal = new OptimismPortal{ salt: _implSalt() }({
_l2Oracle: l2OutputOracle, _l2Oracle: l2OutputOracle,
_guardian: guardian,
_paused: true,
_systemConfig: systemConfig _systemConfig: systemConfig
}); });
...@@ -520,7 +515,7 @@ contract Deploy is Deployer { ...@@ -520,7 +515,7 @@ contract Deploy is Deployer {
// are always proxies. // are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismPortal = address(portal); contracts.OptimismPortal = address(portal);
ChainAssertions.checkOptimismPortal({ _contracts: contracts, _cfg: cfg, _isPaused: true }); ChainAssertions.checkOptimismPortal({ _contracts: contracts, _cfg: cfg, _isProxy: false });
require(loadInitializedSlot("OptimismPortal", false) == 1, "OptimismPortal is not initialized"); require(loadInitializedSlot("OptimismPortal", false) == 1, "OptimismPortal is not initialized");
...@@ -733,10 +728,10 @@ contract Deploy is Deployer { ...@@ -733,10 +728,10 @@ contract Deploy is Deployer {
_upgradeAndCallViaSafe({ _upgradeAndCallViaSafe({
_proxy: superchainConfigProxy, _proxy: superchainConfigProxy,
_implementation: superchainConfig, _implementation: superchainConfig,
_innerCallData: abi.encodeCall(SuperchainConfig.initialize, (cfg.portalGuardian())) _innerCallData: abi.encodeCall(SuperchainConfig.initialize, (cfg.superchainConfigGuardian()))
}); });
ChainAssertions.checkSuperchainConfig(_proxiesUnstrict(), cfg); ChainAssertions.checkSuperchainConfig({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isPaused: false });
} }
/// @notice Initialize the DisputeGameFactory /// @notice Initialize the DisputeGameFactory
...@@ -935,18 +930,19 @@ contract Deploy is Deployer { ...@@ -935,18 +930,19 @@ contract Deploy is Deployer {
console.log("Upgrading and initializing OptimismPortal proxy"); console.log("Upgrading and initializing OptimismPortal proxy");
address optimismPortalProxy = mustGetAddress("OptimismPortalProxy"); address optimismPortalProxy = mustGetAddress("OptimismPortalProxy");
address optimismPortal = mustGetAddress("OptimismPortal"); address optimismPortal = mustGetAddress("OptimismPortal");
SuperchainConfig superchainConfigProxy = SuperchainConfig(mustGetAddress("SuperchainConfigProxy"));
_upgradeAndCallViaSafe({ _upgradeAndCallViaSafe({
_proxy: payable(optimismPortalProxy), _proxy: payable(optimismPortalProxy),
_implementation: optimismPortal, _implementation: optimismPortal,
_innerCallData: abi.encodeCall(OptimismPortal.initialize, (false)) _innerCallData: abi.encodeCall(OptimismPortal.initialize, (superchainConfigProxy))
}); });
OptimismPortal portal = OptimismPortal(payable(optimismPortalProxy)); OptimismPortal portal = OptimismPortal(payable(optimismPortalProxy));
string memory version = portal.version(); string memory version = portal.version();
console.log("OptimismPortal version: %s", version); console.log("OptimismPortal version: %s", version);
ChainAssertions.checkOptimismPortal({ _contracts: _proxies(), _cfg: cfg, _isPaused: false }); ChainAssertions.checkOptimismPortal({ _contracts: _proxies(), _cfg: cfg, _isProxy: true });
require(loadInitializedSlot("OptimismPortal", true) == 1, "OptimismPortalProxy is not initialized"); require(loadInitializedSlot("OptimismPortal", true) == 1, "OptimismPortalProxy is not initialized");
} }
......
...@@ -15,7 +15,7 @@ contract DeployConfig is Script { ...@@ -15,7 +15,7 @@ contract DeployConfig is Script {
string internal _json; string internal _json;
address public finalSystemOwner; address public finalSystemOwner;
address public portalGuardian; address public superchainConfigGuardian;
uint256 public l1ChainID; uint256 public l1ChainID;
uint256 public l2ChainID; uint256 public l2ChainID;
uint256 public l2BlockTime; uint256 public l2BlockTime;
...@@ -64,7 +64,7 @@ contract DeployConfig is Script { ...@@ -64,7 +64,7 @@ contract DeployConfig is Script {
} }
finalSystemOwner = stdJson.readAddress(_json, "$.finalSystemOwner"); finalSystemOwner = stdJson.readAddress(_json, "$.finalSystemOwner");
portalGuardian = stdJson.readAddress(_json, "$.portalGuardian"); superchainConfigGuardian = stdJson.readAddress(_json, "$.superchainConfigGuardian");
l1ChainID = stdJson.readUint(_json, "$.l1ChainID"); l1ChainID = stdJson.readUint(_json, "$.l1ChainID");
l2ChainID = stdJson.readUint(_json, "$.l2ChainID"); l2ChainID = stdJson.readUint(_json, "$.l2ChainID");
l2BlockTime = stdJson.readUint(_json, "$.l2BlockTime"); l2BlockTime = stdJson.readUint(_json, "$.l2BlockTime");
......
...@@ -28,7 +28,7 @@ blockhash=$(echo "$block" | awk '/hash/ { print $2 }') ...@@ -28,7 +28,7 @@ blockhash=$(echo "$block" | awk '/hash/ { print $2 }')
config=$(cat << EOL config=$(cat << EOL
{ {
"finalSystemOwner": "$GS_ADMIN_ADDRESS", "finalSystemOwner": "$GS_ADMIN_ADDRESS",
"portalGuardian": "$GS_ADMIN_ADDRESS", "superchainConfigGuardian": "$GS_ADMIN_ADDRESS",
"l1StartingBlockTag": "$blockhash", "l1StartingBlockTag": "$blockhash",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"src/L1/L1ERC721Bridge.sol": "0x0e57251c77c052cec3a537b1dd4bb30eaff083a9d2b7bfb4cff342641ffd690d", "src/L1/L1ERC721Bridge.sol": "0x0e57251c77c052cec3a537b1dd4bb30eaff083a9d2b7bfb4cff342641ffd690d",
"src/L1/L1StandardBridge.sol": "0xc63b9a99a8e61321930a848c67d950a26356343e12e4376a2b12e03e44e8d8da", "src/L1/L1StandardBridge.sol": "0xc63b9a99a8e61321930a848c67d950a26356343e12e4376a2b12e03e44e8d8da",
"src/L1/L2OutputOracle.sol": "0xbc8acf3cdf2ea6107e2f9fad37e68a8f039f289d88b2ce002920c9ae00310450", "src/L1/L2OutputOracle.sol": "0xbc8acf3cdf2ea6107e2f9fad37e68a8f039f289d88b2ce002920c9ae00310450",
"src/L1/OptimismPortal.sol": "0x1f2ee207a5802d7c33a70aacd81e19c3880e593fa71c82adf02414d71066b934", "src/L1/OptimismPortal.sol": "0x0b86047802c87795d2bf8f2c68a8accff18966564a836197dcdf81573405f7db",
"src/L1/ProtocolVersions.sol": "0x6401853c57ca29e8e9bb38173b5ac9f0856395a325324a08eeb965cc831f0419", "src/L1/ProtocolVersions.sol": "0x6401853c57ca29e8e9bb38173b5ac9f0856395a325324a08eeb965cc831f0419",
"src/L1/SuperchainConfig.sol": "0x316e49c6d1d34d3172916015a049039d04364aabe0f0ddfa29472354a1fe6ea9", "src/L1/SuperchainConfig.sol": "0x316e49c6d1d34d3172916015a049039d04364aabe0f0ddfa29472354a1fe6ea9",
"src/L1/SystemConfig.sol": "0xc24454da676297e0cd718ebf017933c5b1084e389e78ebe2a69d31053ea2f051", "src/L1/SystemConfig.sol": "0xc24454da676297e0cd718ebf017933c5b1084e389e78ebe2a69d31053ea2f051",
......
...@@ -6,16 +6,6 @@ ...@@ -6,16 +6,6 @@
"name": "_l2Oracle", "name": "_l2Oracle",
"type": "address" "type": "address"
}, },
{
"internalType": "address",
"name": "_guardian",
"type": "address"
},
{
"internalType": "bool",
"name": "_paused",
"type": "bool"
},
{ {
"internalType": "contract SystemConfig", "internalType": "contract SystemConfig",
"name": "_systemConfig", "name": "_systemConfig",
...@@ -298,9 +288,9 @@ ...@@ -298,9 +288,9 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "bool", "internalType": "contract SuperchainConfig",
"name": "_paused", "name": "_superchainConfig",
"type": "bool" "type": "address"
} }
], ],
"name": "initialize", "name": "initialize",
...@@ -395,20 +385,13 @@ ...@@ -395,20 +385,13 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "paused", "name": "paused",
"outputs": [ "outputs": [
{ {
"internalType": "bool", "internalType": "bool",
"name": "", "name": "paused_",
"type": "bool" "type": "bool"
} }
], ],
...@@ -528,10 +511,23 @@ ...@@ -528,10 +511,23 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "systemConfig", "name": "spacer_53_0_1",
"outputs": [ "outputs": [
{ {
"internalType": "contract SystemConfig", "internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -541,9 +537,15 @@ ...@@ -541,9 +537,15 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "unpause", "name": "systemConfig",
"outputs": [], "outputs": [
"stateMutability": "nonpayable", {
"internalType": "contract SystemConfig",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
"label": "mapping(uint256 => struct BlockOracle.BlockInfo)", "label": "mapping(uint256 => struct BlockOracle.BlockInfo)",
"offset": 0, "offset": 0,
"slot": "0", "slot": "0",
"type": "t_mapping(t_uint256,t_struct(BlockInfo)71413_storage)" "type": "t_mapping(t_uint256,t_struct(BlockInfo)82480_storage)"
} }
] ]
\ No newline at end of file
...@@ -39,20 +39,20 @@ ...@@ -39,20 +39,20 @@
"label": "mapping(GameType => contract IDisputeGame)", "label": "mapping(GameType => contract IDisputeGame)",
"offset": 0, "offset": 0,
"slot": "101", "slot": "101",
"type": "t_mapping(t_userDefinedValueType(GameType)75267,t_contract(IDisputeGame)73134)" "type": "t_mapping(t_userDefinedValueType(GameType)86527,t_contract(IDisputeGame)84201)"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "mapping(Hash => GameId)", "label": "mapping(Hash => GameId)",
"offset": 0, "offset": 0,
"slot": "102", "slot": "102",
"type": "t_mapping(t_userDefinedValueType(Hash)75249,t_userDefinedValueType(GameId)75261)" "type": "t_mapping(t_userDefinedValueType(Hash)86509,t_userDefinedValueType(GameId)86521)"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "GameId[]", "label": "GameId[]",
"offset": 0, "offset": 0,
"slot": "103", "slot": "103",
"type": "t_array(t_userDefinedValueType(GameId)75261)dyn_storage" "type": "t_array(t_userDefinedValueType(GameId)86521)dyn_storage"
} }
] ]
\ No newline at end of file
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
"label": "mapping(string => struct Drippie.DripState)", "label": "mapping(string => struct Drippie.DripState)",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "t_mapping(t_string_memory_ptr,t_struct(DripState)89118_storage)" "type": "t_mapping(t_string_memory_ptr,t_struct(DripState)89568_storage)"
} }
] ]
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"label": "mapping(bytes32 => struct Attestation)", "label": "mapping(bytes32 => struct Attestation)",
"offset": 0, "offset": 0,
"slot": "50", "slot": "50",
"type": "t_mapping(t_bytes32,t_struct(Attestation)55326_storage)" "type": "t_mapping(t_bytes32,t_struct(Attestation)55340_storage)"
}, },
{ {
"bytes": "32", "bytes": "32",
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
"label": "mapping(contract IFaucetAuthModule => struct Faucet.ModuleConfig)", "label": "mapping(contract IFaucetAuthModule => struct Faucet.ModuleConfig)",
"offset": 0, "offset": 0,
"slot": "0", "slot": "0",
"type": "t_mapping(t_contract(IFaucetAuthModule)90039,t_struct(ModuleConfig)89716_storage)" "type": "t_mapping(t_contract(IFaucetAuthModule)90489,t_struct(ModuleConfig)90166_storage)"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "mapping(contract IFaucetAuthModule => mapping(bytes32 => uint256))", "label": "mapping(contract IFaucetAuthModule => mapping(bytes32 => uint256))",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "t_mapping(t_contract(IFaucetAuthModule)90039,t_mapping(t_bytes32,t_uint256))" "type": "t_mapping(t_contract(IFaucetAuthModule)90489,t_mapping(t_bytes32,t_uint256))"
}, },
{ {
"bytes": "32", "bytes": "32",
......
...@@ -4,49 +4,49 @@ ...@@ -4,49 +4,49 @@
"label": "Timestamp", "label": "Timestamp",
"offset": 0, "offset": 0,
"slot": "0", "slot": "0",
"type": "t_userDefinedValueType(Timestamp)75257" "type": "t_userDefinedValueType(Timestamp)86517"
}, },
{ {
"bytes": "1", "bytes": "1",
"label": "enum GameStatus", "label": "enum GameStatus",
"offset": 8, "offset": 8,
"slot": "0", "slot": "0",
"type": "t_enum(GameStatus)75273" "type": "t_enum(GameStatus)86533"
}, },
{ {
"bytes": "20", "bytes": "20",
"label": "contract IBondManager", "label": "contract IBondManager",
"offset": 9, "offset": 9,
"slot": "0", "slot": "0",
"type": "t_contract(IBondManager)73057" "type": "t_contract(IBondManager)84124"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "Hash", "label": "Hash",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "t_userDefinedValueType(Hash)75249" "type": "t_userDefinedValueType(Hash)86509"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "struct IFaultDisputeGame.ClaimData[]", "label": "struct IFaultDisputeGame.ClaimData[]",
"offset": 0, "offset": 0,
"slot": "2", "slot": "2",
"type": "t_array(t_struct(ClaimData)73271_storage)dyn_storage" "type": "t_array(t_struct(ClaimData)84338_storage)dyn_storage"
}, },
{ {
"bytes": "128", "bytes": "128",
"label": "struct IFaultDisputeGame.OutputProposals", "label": "struct IFaultDisputeGame.OutputProposals",
"offset": 0, "offset": 0,
"slot": "3", "slot": "3",
"type": "t_struct(OutputProposals)73286_storage" "type": "t_struct(OutputProposals)84353_storage"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "mapping(ClaimHash => bool)", "label": "mapping(ClaimHash => bool)",
"offset": 0, "offset": 0,
"slot": "7", "slot": "7",
"type": "t_mapping(t_userDefinedValueType(ClaimHash)75253,t_bool)" "type": "t_mapping(t_userDefinedValueType(ClaimHash)86513,t_bool)"
}, },
{ {
"bytes": "32", "bytes": "32",
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"label": "mapping(address => struct Counters.Counter)", "label": "mapping(address => struct Counters.Counter)",
"offset": 0, "offset": 0,
"slot": "5", "slot": "5",
"type": "t_mapping(t_address,t_struct(Counter)49118_storage)" "type": "t_mapping(t_address,t_struct(Counter)51095_storage)"
}, },
{ {
"bytes": "32", "bytes": "32",
...@@ -60,14 +60,14 @@ ...@@ -60,14 +60,14 @@
"label": "mapping(address => struct ERC20Votes.Checkpoint[])", "label": "mapping(address => struct ERC20Votes.Checkpoint[])",
"offset": 0, "offset": 0,
"slot": "8", "slot": "8",
"type": "t_mapping(t_address,t_array(t_struct(Checkpoint)46264_storage)dyn_storage)" "type": "t_mapping(t_address,t_array(t_struct(Checkpoint)48241_storage)dyn_storage)"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "struct ERC20Votes.Checkpoint[]", "label": "struct ERC20Votes.Checkpoint[]",
"offset": 0, "offset": 0,
"slot": "9", "slot": "9",
"type": "t_array(t_struct(Checkpoint)46264_storage)dyn_storage" "type": "t_array(t_struct(Checkpoint)48241_storage)dyn_storage"
}, },
{ {
"bytes": "20", "bytes": "20",
......
...@@ -32,6 +32,6 @@ ...@@ -32,6 +32,6 @@
"label": "struct Types.OutputProposal[]", "label": "struct Types.OutputProposal[]",
"offset": 0, "offset": 0,
"slot": "3", "slot": "3",
"type": "t_array(t_struct(OutputProposal)76122_storage)dyn_storage" "type": "t_array(t_struct(OutputProposal)87382_storage)dyn_storage"
} }
] ]
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"label": "struct ResourceMetering.ResourceParams", "label": "struct ResourceMetering.ResourceParams",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "t_struct(ResourceParams)66223_storage" "type": "t_struct(ResourceParams)76287_storage"
}, },
{ {
"bytes": "1536", "bytes": "1536",
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"label": "mapping(bytes32 => struct OptimismPortal.ProvenWithdrawal)", "label": "mapping(bytes32 => struct OptimismPortal.ProvenWithdrawal)",
"offset": 0, "offset": 0,
"slot": "52", "slot": "52",
"type": "t_mapping(t_bytes32,t_struct(ProvenWithdrawal)65283_storage)" "type": "t_mapping(t_bytes32,t_struct(ProvenWithdrawal)75366_storage)"
}, },
{ {
"bytes": "1", "bytes": "1",
...@@ -54,5 +54,12 @@ ...@@ -54,5 +54,12 @@
"offset": 0, "offset": 0,
"slot": "53", "slot": "53",
"type": "t_bool" "type": "t_bool"
},
{
"bytes": "20",
"label": "contract SuperchainConfig",
"offset": 1,
"slot": "53",
"type": "t_contract(SuperchainConfig)76810"
} }
] ]
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"label": "mapping(address => enum ProxyAdmin.ProxyType)", "label": "mapping(address => enum ProxyAdmin.ProxyType)",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "t_mapping(t_address,t_enum(ProxyType)79943)" "type": "t_mapping(t_address,t_enum(ProxyType)93478)"
}, },
{ {
"bytes": "32", "bytes": "32",
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"label": "contract AddressManager", "label": "contract AddressManager",
"offset": 0, "offset": 0,
"slot": "3", "slot": "3",
"type": "t_contract(AddressManager)73949" "type": "t_contract(AddressManager)85016"
}, },
{ {
"bytes": "1", "bytes": "1",
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
"label": "mapping(address => contract AddressManager)", "label": "mapping(address => contract AddressManager)",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "t_mapping(t_address,t_contract(AddressManager)73949)" "type": "t_mapping(t_address,t_contract(AddressManager)85016)"
} }
] ]
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"label": "mapping(bytes32 => struct SchemaRecord)", "label": "mapping(bytes32 => struct SchemaRecord)",
"offset": 0, "offset": 0,
"slot": "0", "slot": "0",
"type": "t_mapping(t_bytes32,t_struct(SchemaRecord)57706_storage)" "type": "t_mapping(t_bytes32,t_struct(SchemaRecord)57720_storage)"
}, },
{ {
"bytes": "1568", "bytes": "1568",
......
...@@ -67,6 +67,6 @@ ...@@ -67,6 +67,6 @@
"label": "struct ResourceMetering.ResourceConfig", "label": "struct ResourceMetering.ResourceConfig",
"offset": 0, "offset": 0,
"slot": "105", "slot": "105",
"type": "t_struct(ResourceConfig)66236_storage" "type": "t_struct(ResourceConfig)76300_storage"
} }
] ]
\ No newline at end of file
...@@ -5,6 +5,7 @@ import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable ...@@ -5,6 +5,7 @@ import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
import { L2OutputOracle } from "src/L1/L2OutputOracle.sol"; import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.sol"; import { Hashing } from "src/libraries/Hashing.sol";
...@@ -46,11 +47,6 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -46,11 +47,6 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @custom:legacy /// @custom:legacy
SystemConfig public immutable SYSTEM_CONFIG; SystemConfig public immutable SYSTEM_CONFIG;
/// @notice Address that has the ability to pause and unpause withdrawals. This will be removed in the
/// future, use `guardian` instead.
/// @custom:legacy
address public immutable GUARDIAN;
/// @notice Address of the L2 account which initiated a withdrawal in this transaction. /// @notice Address of the L2 account which initiated a withdrawal in this transaction.
/// If the of this variable is the default L2 sender address, then we are NOT inside of /// If the of this variable is the default L2 sender address, then we are NOT inside of
/// a call to finalizeWithdrawalTransaction. /// a call to finalizeWithdrawalTransaction.
...@@ -62,10 +58,13 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -62,10 +58,13 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @notice A mapping of withdrawal hashes to `ProvenWithdrawal` data. /// @notice A mapping of withdrawal hashes to `ProvenWithdrawal` data.
mapping(bytes32 => ProvenWithdrawal) public provenWithdrawals; mapping(bytes32 => ProvenWithdrawal) public provenWithdrawals;
/// @notice Determines if cross domain messaging is paused. /// @custom:legacy
/// When set to true, withdrawals are paused. /// @custom:spacer paused
/// This may be removed in the future. /// @notice Spacer for backwards compatibility.
bool public paused; bool public spacer_53_0_1;
/// @notice The address of the Superchain Config contract.
SuperchainConfig public superchainConfig;
/// @notice Emitted when a transaction is deposited from L1 to L2. /// @notice Emitted when a transaction is deposited from L1 to L2.
/// The parameters of this event are read by the rollup node and used to derive deposit /// The parameters of this event are read by the rollup node and used to derive deposit
...@@ -97,30 +96,28 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -97,30 +96,28 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @notice Reverts when paused. /// @notice Reverts when paused.
modifier whenNotPaused() { modifier whenNotPaused() {
require(paused == false, "OptimismPortal: paused"); require(paused() == false, "OptimismPortal: paused");
_; _;
} }
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.11.0 /// @custom:semver 2.0.0
string public constant version = "1.11.0"; string public constant version = "2.0.0";
/// @notice Constructs the OptimismPortal contract. /// @notice Constructs the OptimismPortal contract.
/// @param _l2Oracle Address of the L2OutputOracle contract. /// @param _l2Oracle Address of the L2OutputOracle contract.
/// @param _guardian Address that can pause withdrawals.
/// @param _paused Sets the contract's pausability state.
/// @param _systemConfig Address of the SystemConfig contract. /// @param _systemConfig Address of the SystemConfig contract.
constructor(L2OutputOracle _l2Oracle, address _guardian, bool _paused, SystemConfig _systemConfig) { constructor(L2OutputOracle _l2Oracle, SystemConfig _systemConfig) {
L2_ORACLE = _l2Oracle; L2_ORACLE = _l2Oracle;
GUARDIAN = _guardian;
SYSTEM_CONFIG = _systemConfig; SYSTEM_CONFIG = _systemConfig;
initialize(_paused); initialize(SuperchainConfig(address(0)));
} }
/// @notice Initializer. /// @notice Initializer.
function initialize(bool _paused) public initializer { /// @param _superchainConfig Address of the SuperchainConfig contract.
function initialize(SuperchainConfig _superchainConfig) public initializer {
l2Sender = Constants.DEFAULT_L2_SENDER; l2Sender = Constants.DEFAULT_L2_SENDER;
paused = _paused; superchainConfig = _superchainConfig;
__ResourceMetering_init(); __ResourceMetering_init();
} }
...@@ -136,24 +133,25 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -136,24 +133,25 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
return SYSTEM_CONFIG; return SYSTEM_CONFIG;
} }
/// @notice Getter function for the address of the L2OutputOracle on this chain. /// @notice Getter function for the address of the guardian. This will be removed in the future, use
/// @notice Address of the L2OutputOracle on this chain. /// `SuperchainConfig.guardian()` instead.
function guardian() public view returns (address) { /// @notice Address of the guardian.
return GUARDIAN; /// @custom:legacy
function GUARDIAN() external view returns (address) {
return guardian();
} }
/// @notice Pauses withdrawals. /// @notice Getter function for the address of the guardian. This will be removed in the future, use
function pause() external { /// `SuperchainConfig.guardian()` instead.
require(msg.sender == GUARDIAN, "OptimismPortal: only guardian can pause"); /// @notice Address of the guardian.
paused = true; /// @custom:legacy
emit Paused(msg.sender); function guardian() public view returns (address) {
return superchainConfig.guardian();
} }
/// @notice Unpauses withdrawals. /// @notice Getter for the current paused status.
function unpause() external { function paused() public view returns (bool paused_) {
require(msg.sender == GUARDIAN, "OptimismPortal: only guardian can unpause"); paused_ = superchainConfig.paused();
paused = false;
emit Unpaused(msg.sender);
} }
/// @notice Computes the minimum gas limit for a deposit. /// @notice Computes the minimum gas limit for a deposit.
......
...@@ -63,7 +63,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -63,7 +63,7 @@ contract Initializer_Test is Bridge_Initializer {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
target: address(optimismPortal), target: address(optimismPortal),
initCalldata: abi.encodeCall(optimismPortal.initialize, (false)), initCalldata: abi.encodeCall(optimismPortal.initialize, (superchainConfig)),
initializedSlotVal: deploy.loadInitializedSlot("OptimismPortal", true) initializedSlotVal: deploy.loadInitializedSlot("OptimismPortal", true)
}) })
); );
......
...@@ -18,12 +18,10 @@ import { ResourceMetering } from "src/L1/ResourceMetering.sol"; ...@@ -18,12 +18,10 @@ import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { L2OutputOracle } from "src/L1/L2OutputOracle.sol"; import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { OptimismPortal } from "src/L1/OptimismPortal.sol";
contract OptimismPortal_Test is CommonTest { contract OptimismPortal_Test is CommonTest {
event Paused(address);
event Unpaused(address);
address depositor; address depositor;
function setUp() public override { function setUp() public override {
...@@ -33,7 +31,7 @@ contract OptimismPortal_Test is CommonTest { ...@@ -33,7 +31,7 @@ contract OptimismPortal_Test is CommonTest {
/// @dev Tests that the constructor sets the correct values. /// @dev Tests that the constructor sets the correct values.
function test_constructor_succeeds() external { function test_constructor_succeeds() external {
address guardian = deploy.cfg().portalGuardian(); address guardian = deploy.cfg().superchainConfigGuardian();
assertEq(address(optimismPortal.L2_ORACLE()), address(l2OutputOracle)); assertEq(address(optimismPortal.L2_ORACLE()), address(l2OutputOracle));
assertEq(address(optimismPortal.l2Oracle()), address(l2OutputOracle)); assertEq(address(optimismPortal.l2Oracle()), address(l2OutputOracle));
assertEq(optimismPortal.GUARDIAN(), guardian); assertEq(optimismPortal.GUARDIAN(), guardian);
...@@ -49,11 +47,11 @@ contract OptimismPortal_Test is CommonTest { ...@@ -49,11 +47,11 @@ contract OptimismPortal_Test is CommonTest {
assertEq(optimismPortal.paused(), false); assertEq(optimismPortal.paused(), false);
vm.expectEmit(address(optimismPortal)); vm.expectEmit(address(superchainConfig));
emit Paused(guardian); emit Paused("identifier");
vm.prank(guardian); vm.prank(guardian);
optimismPortal.pause(); superchainConfig.pause("identifier");
assertEq(optimismPortal.paused(), true); assertEq(optimismPortal.paused(), true);
} }
...@@ -63,9 +61,9 @@ contract OptimismPortal_Test is CommonTest { ...@@ -63,9 +61,9 @@ contract OptimismPortal_Test is CommonTest {
assertEq(optimismPortal.paused(), false); assertEq(optimismPortal.paused(), false);
assertTrue(optimismPortal.GUARDIAN() != alice); assertTrue(optimismPortal.GUARDIAN() != alice);
vm.expectRevert("OptimismPortal: only guardian can pause"); vm.expectRevert("SuperchainConfig: only guardian can pause");
vm.prank(alice); vm.prank(alice);
optimismPortal.pause(); superchainConfig.pause("identifier");
assertEq(optimismPortal.paused(), false); assertEq(optimismPortal.paused(), false);
} }
...@@ -76,13 +74,13 @@ contract OptimismPortal_Test is CommonTest { ...@@ -76,13 +74,13 @@ contract OptimismPortal_Test is CommonTest {
address guardian = optimismPortal.GUARDIAN(); address guardian = optimismPortal.GUARDIAN();
vm.prank(guardian); vm.prank(guardian);
optimismPortal.pause(); superchainConfig.pause("identifier");
assertEq(optimismPortal.paused(), true); assertEq(optimismPortal.paused(), true);
vm.expectEmit(address(optimismPortal)); vm.expectEmit(address(superchainConfig));
emit Unpaused(guardian); emit Unpaused();
vm.prank(guardian); vm.prank(guardian);
optimismPortal.unpause(); superchainConfig.unpause();
assertEq(optimismPortal.paused(), false); assertEq(optimismPortal.paused(), false);
} }
...@@ -92,13 +90,13 @@ contract OptimismPortal_Test is CommonTest { ...@@ -92,13 +90,13 @@ contract OptimismPortal_Test is CommonTest {
address guardian = optimismPortal.GUARDIAN(); address guardian = optimismPortal.GUARDIAN();
vm.prank(guardian); vm.prank(guardian);
optimismPortal.pause(); superchainConfig.pause("identifier");
assertEq(optimismPortal.paused(), true); assertEq(optimismPortal.paused(), true);
assertTrue(optimismPortal.GUARDIAN() != alice); assertTrue(optimismPortal.GUARDIAN() != alice);
vm.expectRevert("OptimismPortal: only guardian can unpause"); vm.expectRevert("SuperchainConfig: only guardian can unpause");
vm.prank(alice); vm.prank(alice);
optimismPortal.unpause(); superchainConfig.unpause();
assertEq(optimismPortal.paused(), true); assertEq(optimismPortal.paused(), true);
} }
...@@ -383,7 +381,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is CommonTest { ...@@ -383,7 +381,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is CommonTest {
/// @dev Tests that `proveWithdrawalTransaction` reverts when paused. /// @dev Tests that `proveWithdrawalTransaction` reverts when paused.
function test_proveWithdrawalTransaction_paused_reverts() external { function test_proveWithdrawalTransaction_paused_reverts() external {
vm.prank(optimismPortal.GUARDIAN()); vm.prank(optimismPortal.GUARDIAN());
optimismPortal.pause(); superchainConfig.pause("identifier");
vm.expectRevert("OptimismPortal: paused"); vm.expectRevert("OptimismPortal: paused");
optimismPortal.proveWithdrawalTransaction({ optimismPortal.proveWithdrawalTransaction({
...@@ -535,7 +533,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is CommonTest { ...@@ -535,7 +533,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is CommonTest {
/// @dev Tests that `finalizeWithdrawalTransaction` reverts if the contract is paused. /// @dev Tests that `finalizeWithdrawalTransaction` reverts if the contract is paused.
function test_finalizeWithdrawalTransaction_paused_reverts() external { function test_finalizeWithdrawalTransaction_paused_reverts() external {
vm.prank(optimismPortal.GUARDIAN()); vm.prank(optimismPortal.GUARDIAN());
optimismPortal.pause(); superchainConfig.pause("identifier");
vm.expectRevert("OptimismPortal: paused"); vm.expectRevert("OptimismPortal: paused");
optimismPortal.finalizeWithdrawalTransaction(_defaultTx); optimismPortal.finalizeWithdrawalTransaction(_defaultTx);
...@@ -898,15 +896,17 @@ contract OptimismPortalUpgradeable_Test is CommonTest { ...@@ -898,15 +896,17 @@ contract OptimismPortalUpgradeable_Test is CommonTest {
/// @dev Tests that the proxy cannot be initialized twice. /// @dev Tests that the proxy cannot be initialized twice.
function test_initialize_cannotInitProxy_reverts() external { function test_initialize_cannotInitProxy_reverts() external {
SuperchainConfig superchainConfig = SuperchainConfig(deploy.mustGetAddress("SuperchainConfig"));
vm.expectRevert("Initializable: contract is already initialized"); vm.expectRevert("Initializable: contract is already initialized");
optimismPortal.initialize({ _paused: false }); optimismPortal.initialize(superchainConfig);
} }
/// @dev Tests that the implementation cannot be initialized twice. /// @dev Tests that the implementation cannot be initialized twice.
function test_initialize_cannotInitImpl_reverts() external { function test_initialize_cannotInitImpl_reverts() external {
address opImpl = deploy.mustGetAddress("OptimismPortal"); address opImpl = deploy.mustGetAddress("OptimismPortal");
SuperchainConfig superchainConfig = SuperchainConfig(deploy.mustGetAddress("SuperchainConfig"));
vm.expectRevert("Initializable: contract is already initialized"); vm.expectRevert("Initializable: contract is already initialized");
OptimismPortal(payable(opImpl)).initialize({ _paused: false }); OptimismPortal(payable(opImpl)).initialize(superchainConfig);
} }
/// @dev Tests that the proxy can be upgraded. /// @dev Tests that the proxy can be upgraded.
......
...@@ -17,7 +17,7 @@ contract SuperchainConfig_Init_Test is CommonTest { ...@@ -17,7 +17,7 @@ contract SuperchainConfig_Init_Test is CommonTest {
/// @dev Tests that initialization sets the correct values. These are defined in CommonTest.sol. /// @dev Tests that initialization sets the correct values. These are defined in CommonTest.sol.
function test_initialize_values_succeeds() external { function test_initialize_values_succeeds() external {
assertFalse(superchainConfig.paused()); assertFalse(superchainConfig.paused());
assertEq(superchainConfig.guardian(), deploy.cfg().portalGuardian()); assertEq(superchainConfig.guardian(), deploy.cfg().superchainConfigGuardian());
} }
} }
...@@ -54,7 +54,7 @@ contract SuperchainConfig_Pause_Test is CommonTest { ...@@ -54,7 +54,7 @@ contract SuperchainConfig_Pause_Test is CommonTest {
contract SuperchainConfig_Unpause_TestFail is CommonTest { contract SuperchainConfig_Unpause_TestFail is CommonTest {
/// @dev Tests that `unpause` reverts when called by a non-guardian. /// @dev Tests that `unpause` reverts when called by a non-guardian.
function test_unpause_notGuardian_reverts() external { function test_unpause_notGuardian_reverts() external {
vm.prank(deploy.cfg().portalGuardian()); vm.prank(superchainConfig.guardian());
superchainConfig.pause("identifier"); superchainConfig.pause("identifier");
assertEq(superchainConfig.paused(), true); assertEq(superchainConfig.paused(), true);
...@@ -71,13 +71,12 @@ contract SuperchainConfig_Unpause_Test is CommonTest { ...@@ -71,13 +71,12 @@ contract SuperchainConfig_Unpause_Test is CommonTest {
/// @dev Tests that `unpause` successfully unpauses /// @dev Tests that `unpause` successfully unpauses
/// when called by the guardian. /// when called by the guardian.
function test_unpause_succeeds() external { function test_unpause_succeeds() external {
vm.prank(deploy.cfg().portalGuardian()); vm.startPrank(superchainConfig.guardian());
superchainConfig.pause("identifier"); superchainConfig.pause("identifier");
assertEq(superchainConfig.paused(), true); assertEq(superchainConfig.paused(), true);
vm.expectEmit(address(superchainConfig)); vm.expectEmit(address(superchainConfig));
emit Unpaused(); emit Unpaused();
vm.prank(deploy.cfg().portalGuardian());
superchainConfig.unpause(); superchainConfig.unpause();
assertFalse(superchainConfig.paused()); assertFalse(superchainConfig.paused());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment