Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title IL2ContractsManager
/// @notice Interface for the L2ContractsManager contract.
interface IL2ContractsManager {
/// @notice Executes the upgrade for all predeploys.
/// @dev This function MUST be called via DELEGATECALL from the L2ProxyAdmin.
function upgrade() external;
}
24 changes: 24 additions & 0 deletions packages/contracts-bedrock/interfaces/L2/IL2ProxyAdmin.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Interfaces
import { IProxyAdmin } from "interfaces/universal/IProxyAdmin.sol";
import { ISemver } from "interfaces/universal/ISemver.sol";

/// @title IL2ProxyAdmin
interface IL2ProxyAdmin is IProxyAdmin, ISemver {
/// @notice Emitted when the predeploys are upgraded.
/// @param l2ContractsManager Address of the L2ContractsManager contract.
event PredeploysUpgraded(address indexed l2ContractsManager);

/// @notice Thrown when the caller is not the depositor account.
error L2ProxyAdmin__Unauthorized();

/// @notice Thrown when the upgrade fails.
error L2ProxyAdmin__UpgradeFailed(bytes data);

function __constructor__(address _owner) external;
/// @notice Upgrades the predeploys via delegatecall to the L2ContractsManager contract.
/// @param _l2ContractsManager Address of the L2ContractsManager contract.
function upgradePredeploys(address _l2ContractsManager) external;
}
9 changes: 5 additions & 4 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ contract L2Genesis is Script {

/// @notice Set up the accounts that correspond to the predeploys.
/// The Proxy bytecode should be set. All proxied predeploys should have
/// the 1967 admin slot set to the ProxyAdmin predeploy. All defined predeploys
/// the 1967 admin slot set to the L2ProxyAdmin predeploy. All defined predeploys
/// should have their implementations set.
/// Warning: the predeploy accounts have contract code, but 0 nonce value, contrary
/// to the expected nonce of 1 per EIP-161. This is because the legacy go genesis
Expand Down Expand Up @@ -249,7 +249,7 @@ contract L2Genesis is Script {
setL1Block(_input.useCustomGasToken); // 15
setL2ToL1MessagePasser(_input.useCustomGasToken); // 16
setOptimismMintableERC721Factory(_input); // 17
setProxyAdmin(_input); // 18
setL2ProxyAdmin(_input); // 18
setBaseFeeVault(_input); // 19
setL1FeeVault(_input); // 1A
setOperatorFeeVault(_input); // 1B
Expand All @@ -272,12 +272,13 @@ contract L2Genesis is Script {

function setInteropPredeployProxies() internal { }

function setProxyAdmin(Input memory _input) internal {
// Note the ProxyAdmin implementation itself is behind a proxy that owns itself.
function setL2ProxyAdmin(Input memory _input) internal {
// Note the L2ProxyAdmin implementation itself is behind a proxy that owns itself.
address impl = _setImplementationCode(Predeploys.PROXY_ADMIN);

bytes32 _ownerSlot = bytes32(0);

// TODO(#19182): Remove this once the L2ProxyAdmin is initializable.
// there is no initialize() function, so we just set the storage manually.
vm.store(Predeploys.PROXY_ADMIN, _ownerSlot, bytes32(uint256(uint160(_input.opChainProxyAdminOwner))));
// update the proxy to not be uninitialized (although not standard initialize pattern)
Expand Down
Loading