-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPCM: OPPrestateUpdater for L1 Pectra Defense (#13998)
* Add a new updatePrestatehash method to the OPContractsManager * deployed * second deployment * Go back to refactor * delete file * format * make diff smaller * even smaller * missing bracket * Go back on refactoring * fix build * fix build * fix build * fix build * fix versions * add snapshots * Add a new updatePrestatehash method to the OPContractsManager * deployed * second deployment * Go back to refactor * delete file * format * make diff smaller * even smaller * missing bracket * Go back on refactoring * fix build * fix build * fix build * fix build * fix versions * fix versions * add snapshots * update snapshots & semver * correct semver * bump OPCM version * move interface to inherit IOPCM * fix interface * update versions * add specs * fix deploy opcm setters * fix deploy opcm setters * changes asked on review & semver-lock * Add non implemented tests for coverage * linting * New tests & semverlock * rewrite hasFDG boolean * semver-lock * fix review comments * pre-pr * semver * semver-lock * semverlock again * final semverlock * fix comment about versions * fix comment about versions * semverlock opcm * feat: test upgrading just the pdg vs. both games * feat: remove unused assertValidGameType() function * review changes * remove unnecessary comment * update interface to fix CI * change file format * rebase * semver lock * valid semlock * rerun ci --------- Co-authored-by: JosepBove <[email protected]> Co-authored-by: JosepBove <[email protected]> Co-authored-by: JosepBove <[email protected]>
- Loading branch information
1 parent
cdec591
commit e620444
Showing
10 changed files
with
1,904 additions
and
8 deletions.
There are no files selected for viewing
131 changes: 131 additions & 0 deletions
131
packages/contracts-bedrock/interfaces/L1/IOPPrestateUpdater.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
// Interfaces | ||
import { IProxyAdmin } from "interfaces/universal/IProxyAdmin.sol"; | ||
import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol"; | ||
import { IProtocolVersions } from "interfaces/L1/IProtocolVersions.sol"; | ||
import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol"; | ||
import { IOPContractsManager } from "interfaces/L1/IOPContractsManager.sol"; | ||
|
||
interface IOPPrestateUpdater { | ||
// -------- Constants and Variables -------- | ||
|
||
function version() external pure returns (string memory); | ||
|
||
/// @notice Address of the SuperchainConfig contract shared by all chains. | ||
function superchainConfig() external view returns (ISuperchainConfig); | ||
|
||
/// @notice Address of the ProtocolVersions contract shared by all chains. | ||
function protocolVersions() external view returns (IProtocolVersions); | ||
|
||
/// @notice Address of the ProxyAdmin contract shared by all chains. | ||
function superchainProxyAdmin() external view returns (IProxyAdmin); | ||
|
||
/// @notice L1 smart contracts release deployed by this version of OPCM. This is used in opcm to signal which | ||
/// version of the L1 smart contracts is deployed. It takes the format of `op-contracts/vX.Y.Z`. | ||
function l1ContractsRelease() external view returns (string memory); | ||
|
||
// -------- Events -------- | ||
|
||
/// @notice Emitted when a new OP Stack chain is deployed. | ||
/// @param l2ChainId Chain ID of the new chain. | ||
/// @param deployer Address that deployed the chain. | ||
/// @param deployOutput ABI-encoded output of the deployment. | ||
event Deployed(uint256 indexed l2ChainId, address indexed deployer, bytes deployOutput); | ||
|
||
/// @notice Emitted when a chain is upgraded | ||
/// @param systemConfig Address of the chain's SystemConfig contract | ||
/// @param upgrader Address that initiated the upgrade | ||
event Upgraded(uint256 indexed l2ChainId, ISystemConfig indexed systemConfig, address indexed upgrader); | ||
|
||
// -------- Errors -------- | ||
|
||
error BytesArrayTooLong(); | ||
error DeploymentFailed(); | ||
error EmptyInitcode(); | ||
error IdentityPrecompileCallFailed(); | ||
error NotABlueprint(); | ||
error ReservedBitsSet(); | ||
error UnexpectedPreambleData(bytes data); | ||
error UnsupportedERCVersion(uint8 version); | ||
error OnlyUpgradeController(); | ||
error PrestateNotSet(); | ||
|
||
/// @notice Thrown when an address is the zero address. | ||
error AddressNotFound(address who); | ||
|
||
/// @notice Throw when a contract address has no code. | ||
error AddressHasNoCode(address who); | ||
|
||
/// @notice Thrown when a release version is already set. | ||
error AlreadyReleased(); | ||
|
||
/// @notice Thrown when an invalid `l2ChainId` is provided to `deploy`. | ||
error InvalidChainId(); | ||
|
||
/// @notice Thrown when a role's address is not valid. | ||
error InvalidRoleAddress(string role); | ||
|
||
/// @notice Thrown when the latest release is not set upon initialization. | ||
error LatestReleaseNotSet(); | ||
|
||
/// @notice Thrown when the starting anchor root is not provided. | ||
error InvalidStartingAnchorRoot(); | ||
|
||
/// @notice Thrown when certain methods are called outside of a DELEGATECALL. | ||
error OnlyDelegatecall(); | ||
|
||
/// @notice Thrown when game configs passed to addGameType are invalid. | ||
error InvalidGameConfigs(); | ||
|
||
/// @notice Thrown when the SuperchainConfig of the chain does not match the SuperchainConfig of this OPCM. | ||
error SuperchainConfigMismatch(ISystemConfig systemConfig); | ||
|
||
error SuperchainProxyAdminMismatch(); | ||
|
||
/// @notice Thrown when a function from the parent (OPCM) is not implemented. | ||
error NotImplemented(); | ||
|
||
/// @notice Thrown when the prestate of a permissioned disputed game is 0. | ||
error PrestateRequired(); | ||
|
||
// -------- Methods -------- | ||
|
||
function __constructor__( | ||
ISuperchainConfig _superchainConfig, | ||
IProtocolVersions _protocolVersions, | ||
IOPContractsManager.Blueprints memory _blueprints | ||
) | ||
external; | ||
|
||
function deploy(IOPContractsManager.DeployInput calldata _input) external returns (IOPContractsManager.DeployOutput memory); | ||
|
||
/// @notice Upgrades the implementation of all proxies in the specified chains | ||
/// @param _opChainConfigs The chains to upgrade | ||
function upgrade(IOPContractsManager.OpChainConfig[] memory _opChainConfigs) external; | ||
|
||
/// @notice addGameType deploys a new dispute game and links it to the DisputeGameFactory. The inputted _gameConfigs | ||
/// must be added in ascending GameType order. | ||
function addGameType(IOPContractsManager.AddGameInput[] memory _gameConfigs) external returns (IOPContractsManager.AddGameOutput[] memory); | ||
|
||
/// @notice Maps an L2 chain ID to an L1 batch inbox address as defined by the standard | ||
/// configuration's convention. This convention is `versionByte || keccak256(bytes32(chainId))[:19]`, | ||
/// where || denotes concatenation`, versionByte is 0x00, and chainId is a uint256. | ||
/// https://specs.optimism.io/protocol/configurability.html#consensus-parameters | ||
function chainIdToBatchInboxAddress(uint256 _l2ChainId) external pure returns (address); | ||
|
||
/// @notice Returns the blueprint contract addresses. | ||
function blueprints() external view returns (IOPContractsManager.Blueprints memory); | ||
|
||
/// @notice Returns the implementation contract addresses. | ||
function implementations() external view returns (IOPContractsManager.Implementations memory); | ||
|
||
function upgradeController() external view returns (address); | ||
|
||
function isRC() external view returns (bool); | ||
|
||
function setRC(bool _isRC) external; | ||
|
||
function updatePrestate(IOPContractsManager.OpChainConfig[] memory _prestateUpdateInputs) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.