-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: OPCM v2 #18079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: OPCM v2 #18079
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
89b1f81
feat: OPCMv2
smartcontracts 84b829e
fix: bug in deploying dispute games
smartcontracts d39bc52
fix: no more opcmv1 changes
smartcontracts a8a1659
fix: bad interface
smartcontracts fee01a0
fix: further clean diff
smartcontracts 3ed221d
fix: reduce diff
smartcontracts 5ebcbce
fix: undo artifacts diffs
smartcontracts 5207543
fix: broken go structs
smartcontracts 6e8e61c
fix: opcm output struct ordering
smartcontracts e8f3da4
fix: better tests
smartcontracts 1e06f5e
fix: justfile path
smartcontracts 6e9e700
fix: lcov issue
smartcontracts f24ef9e
fix: pr review comments
smartcontracts b234361
fix: pr comments
smartcontracts 98f4062
fix: rebase tweaks
smartcontracts b7c2b85
fix: contract verification failure
smartcontracts 8fb6572
fix: last few ci issues
smartcontracts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
46 changes: 46 additions & 0 deletions
46
packages/contracts-bedrock/interfaces/L1/opcm/IOPContractsManagerContainer.sol
This file contains hidden or 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,46 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| interface IOPContractsManagerContainer { | ||
| struct Blueprints { | ||
| address addressManager; | ||
| address proxy; | ||
| address proxyAdmin; | ||
| address l1ChugSplashProxy; | ||
| address resolvedDelegateProxy; | ||
| address permissionedDisputeGame1; | ||
| address permissionedDisputeGame2; | ||
| address permissionlessDisputeGame1; | ||
| address permissionlessDisputeGame2; | ||
| } | ||
|
|
||
| struct Implementations { | ||
| address superchainConfigImpl; | ||
| address protocolVersionsImpl; | ||
| address l1ERC721BridgeImpl; | ||
| address optimismPortalImpl; | ||
| address optimismPortalInteropImpl; | ||
| address ethLockboxImpl; | ||
| address systemConfigImpl; | ||
| address optimismMintableERC20FactoryImpl; | ||
| address l1CrossDomainMessengerImpl; | ||
| address l1StandardBridgeImpl; | ||
| address disputeGameFactoryImpl; | ||
| address anchorStateRegistryImpl; | ||
| address delayedWETHImpl; | ||
| address mipsImpl; | ||
| address faultDisputeGameV2Impl; | ||
| address permissionedDisputeGameV2Impl; | ||
| address superFaultDisputeGameImpl; | ||
| address superPermissionedDisputeGameImpl; | ||
| address storageSetterImpl; | ||
| } | ||
|
|
||
| error OPContractsManagerContractsContainer_DevFeatureInProd(); | ||
|
|
||
| function blueprints() external view returns (Blueprints memory); | ||
| function implementations() external view returns (Implementations memory); | ||
| function isDevFeatureEnabled(bytes32 _feature) external view returns (bool); | ||
| function devFeatureBitmap() external view returns (bytes32); | ||
| function __constructor__(Blueprints memory _blueprints, Implementations memory _implementations, bytes32 _devFeatureBitmap) external; | ||
| } |
150 changes: 150 additions & 0 deletions
150
packages/contracts-bedrock/interfaces/L1/opcm/IOPContractsManagerV2.sol
This file contains hidden or 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,150 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| // Libraries | ||
| import { Claim, GameType, Proposal } from "src/dispute/lib/Types.sol"; | ||
|
|
||
| // Interfaces | ||
| import { IProxyAdmin } from "interfaces/universal/IProxyAdmin.sol"; | ||
| import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol"; | ||
| import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol"; | ||
| import { IL1CrossDomainMessenger } from "interfaces/L1/IL1CrossDomainMessenger.sol"; | ||
| import { IL1ERC721Bridge } from "interfaces/L1/IL1ERC721Bridge.sol"; | ||
| import { IL1StandardBridge } from "interfaces/L1/IL1StandardBridge.sol"; | ||
| import { IOptimismPortal2 } from "interfaces/L1/IOptimismPortal2.sol"; | ||
| import { IOptimismMintableERC20Factory } from "interfaces/universal/IOptimismMintableERC20Factory.sol"; | ||
| import { IDisputeGameFactory } from "interfaces/dispute/IDisputeGameFactory.sol"; | ||
| import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol"; | ||
| import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol"; | ||
| import { IAddressManager } from "interfaces/legacy/IAddressManager.sol"; | ||
| import { IETHLockbox } from "interfaces/L1/IETHLockbox.sol"; | ||
| import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol"; | ||
| import { IOPContractsManagerContainer } from "interfaces/L1/opcm/IOPContractsManagerContainer.sol"; | ||
| import { IOPContractsManagerStandardValidator } from "interfaces/L1/IOPContractsManagerStandardValidator.sol"; | ||
|
|
||
| interface IOPContractsManagerV2 { | ||
| /// @notice Configuration for the FaultDisputeGame. | ||
| struct FaultDisputeGameConfig { | ||
| Claim absolutePrestate; | ||
| } | ||
|
|
||
| /// @notice Configuration for the PermissionedDisputeGame. | ||
| struct PermissionedDisputeGameConfig { | ||
| Claim absolutePrestate; | ||
| address proposer; | ||
| address challenger; | ||
| } | ||
|
|
||
| /// @notice Dispute game configuration for a specific game type. | ||
| struct DisputeGameConfig { | ||
| bool enabled; | ||
| uint256 initBond; | ||
| GameType gameType; | ||
| bytes gameArgs; | ||
| } | ||
|
|
||
| /// @notice Contracts that represent the Superchain system. | ||
| struct SuperchainContracts { | ||
| ISuperchainConfig superchainConfig; | ||
| } | ||
|
|
||
| /// @notice Addresses of the deployed and wired contracts for an OP Chain. | ||
| struct ChainContracts { | ||
| ISystemConfig systemConfig; | ||
| IProxyAdmin proxyAdmin; | ||
| IAddressManager addressManager; | ||
| IL1CrossDomainMessenger l1CrossDomainMessenger; | ||
| IL1ERC721Bridge l1ERC721Bridge; | ||
| IL1StandardBridge l1StandardBridge; | ||
| IOptimismPortal2 optimismPortal; | ||
| IETHLockbox ethLockbox; | ||
| IOptimismMintableERC20Factory optimismMintableERC20Factory; | ||
| IDisputeGameFactory disputeGameFactory; | ||
| IAnchorStateRegistry anchorStateRegistry; | ||
| IDelayedWETH delayedWETH; | ||
| } | ||
|
|
||
| /// @notice Full configuration for deploying a new OP Chain. | ||
| struct FullConfig { | ||
| string saltMixer; | ||
| ISuperchainConfig superchainConfig; | ||
| address proxyAdminOwner; | ||
| address systemConfigOwner; | ||
| address unsafeBlockSigner; | ||
| address batcher; | ||
| Proposal startingAnchorRoot; | ||
| GameType startingRespectedGameType; | ||
| uint32 basefeeScalar; | ||
| uint32 blobBasefeeScalar; | ||
| uint64 gasLimit; | ||
| uint256 l2ChainId; | ||
| IResourceMetering.ResourceConfig resourceConfig; | ||
| DisputeGameConfig[] disputeGameConfigs; | ||
| } | ||
|
|
||
| struct ExtraInstruction { | ||
| string key; | ||
| bytes data; | ||
| } | ||
|
|
||
| struct UpgradeInput { | ||
| ISystemConfig systemConfig; | ||
| DisputeGameConfig[] disputeGameConfigs; | ||
| ExtraInstruction[] extraInstructions; | ||
| } | ||
|
|
||
| struct SuperchainUpgradeInput { | ||
| ISuperchainConfig superchainConfig; | ||
| ExtraInstruction[] extraInstructions; | ||
| } | ||
|
|
||
| event ProxyCreation(string name, address proxy); | ||
|
|
||
| error OPContractsManagerV2_InvalidGameConfigs(); | ||
| error OPContractsManagerV2_InvalidUpgradeInput(); | ||
| error OPContractsManagerV2_SuperchainConfigNeedsUpgrade(); | ||
| error OPContractsManagerV2_UnsupportedGameType(); | ||
| error OPContractsManagerV2_ProxyMustLoad(string _name); | ||
| error OPContractsManagerV2_DowngradeNotAllowed(address _contract); | ||
| error OPContractsManagerV2_InvalidUpgradeInstruction(); | ||
| error OPContractsManagerV2_ConfigLoadFailed(string _name); | ||
| error IdentityPrecompileCallFailed(); | ||
| error ReservedBitsSet(); | ||
| error BytesArrayTooLong(); | ||
| error SemverComp_InvalidSemverParts(); | ||
| error UnsupportedERCVersion(uint8 version); | ||
| error NotABlueprint(); | ||
| error DeploymentFailed(); | ||
| error EmptyInitcode(); | ||
| error UnexpectedPreambleData(bytes data); | ||
|
|
||
| function __constructor__( | ||
| IOPContractsManagerContainer _contractsContainer, | ||
| IOPContractsManagerStandardValidator _standardValidator | ||
| ) | ||
| external; | ||
|
|
||
| function blueprints() external view returns (IOPContractsManagerContainer.Blueprints memory); | ||
|
|
||
| function implementations() external view returns (IOPContractsManagerContainer.Implementations memory); | ||
|
|
||
| function contractsContainer() external view returns (IOPContractsManagerContainer); | ||
|
|
||
| function standardValidator() external view returns (IOPContractsManagerStandardValidator); | ||
|
|
||
| function version() external view returns (string memory); | ||
|
|
||
| /// @notice Upgrades Superchain-wide contracts. | ||
| function upgradeSuperchain(SuperchainUpgradeInput memory _inp) | ||
| external | ||
| returns (SuperchainContracts memory); | ||
|
|
||
| /// @notice Deploys and wires a complete OP Chain per the provided configuration. | ||
| function deploy(FullConfig memory _cfg) external returns (ChainContracts memory); | ||
|
|
||
| /// @notice Upgrades contracts on an existing OP Chain per the provided input. | ||
| function upgrade(UpgradeInput memory _inp) external returns (ChainContracts memory); | ||
|
|
||
| /// @notice Returns whether a development feature is enabled. | ||
| function isDevFeatureEnabled(bytes32 _feature) external view returns (bool); | ||
| } |
22 changes: 22 additions & 0 deletions
22
packages/contracts-bedrock/interfaces/universal/IStorageSetter.sol
This file contains hidden or 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,22 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| interface IStorageSetter { | ||
| struct Slot { | ||
| bytes32 key; | ||
| bytes32 value; | ||
| } | ||
|
|
||
| function version() external view returns (string memory); | ||
| function setBytes32(bytes32 _slot, bytes32 _value) external; | ||
| function setBytes32(Slot[] calldata _slots) external; | ||
| function getBytes32(bytes32 _slot) external view returns (bytes32 value_); | ||
| function setUint(bytes32 _slot, uint256 _value) external; | ||
| function getUint(bytes32 _slot) external view returns (uint256 value_); | ||
| function setAddress(bytes32 _slot, address _address) external; | ||
| function getAddress(bytes32 _slot) external view returns (address addr_); | ||
| function setBool(bytes32 _slot, bool _value) external; | ||
| function getBool(bytes32 _slot) external view returns (bool value_); | ||
|
|
||
| function __constructor__() external; | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.