-
Notifications
You must be signed in to change notification settings - Fork 4k
feat: break out OPCMv2 utils into helper contracts #18454
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
470ec8c
feat: break out OPCMv2 utils into helper contracts
smartcontracts 120a708
fix: go ci issues
smartcontracts 624fc54
fix: more ci issues
smartcontracts 9907e4c
fix: forge lint
smartcontracts f8ead44
fix: go verify artifacts
smartcontracts 12d56c3
feat: add tests for OPCMUtils
smartcontracts c69f47e
fix: broken tests
smartcontracts 4a23d65
fix: more test tweaks
smartcontracts 5146012
fix: mark functions as external
smartcontracts 5b1a09f
feat: add tests for implementations and blueprints
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
96 changes: 96 additions & 0 deletions
96
packages/contracts-bedrock/interfaces/L1/opcm/IOPContractsManagerUtils.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,96 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import { IOPContractsManagerContainer } from "interfaces/L1/opcm/IOPContractsManagerContainer.sol"; | ||
| import { IProxyAdmin } from "interfaces/universal/IProxyAdmin.sol"; | ||
| import { IAddressManager } from "interfaces/legacy/IAddressManager.sol"; | ||
|
|
||
| interface IOPContractsManagerUtils { | ||
| struct ProxyDeployArgs { | ||
| IProxyAdmin proxyAdmin; | ||
| IAddressManager addressManager; | ||
| uint256 l2ChainId; | ||
| string saltMixer; | ||
| } | ||
|
|
||
| struct ExtraInstruction { | ||
| string key; | ||
| bytes data; | ||
| } | ||
|
|
||
| event ProxyCreation(string name, address proxy); | ||
|
|
||
| error OPContractsManagerUtils_DowngradeNotAllowed(address _contract); | ||
| error OPContractsManagerUtils_ConfigLoadFailed(string _name); | ||
| error OPContractsManagerUtils_ProxyMustLoad(string _name); | ||
| error ReservedBitsSet(); | ||
| error UnsupportedERCVersion(uint8 version); | ||
| error SemverComp_InvalidSemverParts(); | ||
| error DeploymentFailed(); | ||
| error UnexpectedPreambleData(bytes data); | ||
| error NotABlueprint(); | ||
| error EmptyInitcode(); | ||
| error BytesArrayTooLong(); | ||
| error IdentityPrecompileCallFailed(); | ||
|
|
||
| function implementations() external view returns (IOPContractsManagerContainer.Implementations memory); | ||
| function blueprints() external view returns (IOPContractsManagerContainer.Blueprints memory); | ||
| function contractsContainer() external view returns (IOPContractsManagerContainer); | ||
| function chainIdToBatchInboxAddress(uint256 _l2ChainId) external pure returns (address); | ||
| function computeSalt( | ||
| uint256 _l2ChainId, | ||
| string memory _saltMixer, | ||
| string memory _contractName | ||
| ) | ||
| external | ||
| pure | ||
| returns (bytes32); | ||
| function hasInstruction( | ||
| ExtraInstruction[] memory _instructions, | ||
| string memory _key, | ||
| bytes memory _data | ||
| ) | ||
| external | ||
| pure | ||
| returns (bool); | ||
|
|
||
| function getInstructionByKey( | ||
| ExtraInstruction[] memory _instructions, | ||
| string memory _key | ||
| ) | ||
| external | ||
| pure | ||
| returns (ExtraInstruction memory); | ||
|
|
||
| function loadBytes( | ||
| address _source, | ||
| bytes4 _selector, | ||
| string memory _name, | ||
| ExtraInstruction[] memory _instructions | ||
| ) | ||
| external | ||
| view | ||
| returns (bytes memory); | ||
|
|
||
| function loadOrDeployProxy( | ||
| address _source, | ||
| bytes4 _selector, | ||
| ProxyDeployArgs memory _args, | ||
| string memory _contractName, | ||
| ExtraInstruction[] memory _instructions | ||
| ) | ||
| external | ||
| returns (address payable); | ||
|
|
||
| function upgrade( | ||
| IProxyAdmin _proxyAdmin, | ||
| address _target, | ||
| address _implementation, | ||
| bytes memory _data, | ||
| bytes32 _slot, | ||
| uint8 _offset | ||
| ) | ||
| external; | ||
|
|
||
| function __constructor__(IOPContractsManagerContainer _contractsContainer) external; | ||
| } |
9 changes: 9 additions & 0 deletions
9
packages/contracts-bedrock/interfaces/L1/opcm/IOPContractsManagerUtilsCaller.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,9 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import { IOPContractsManagerUtils } from "interfaces/L1/opcm/IOPContractsManagerUtils.sol"; | ||
|
|
||
| interface IOPContractsManagerUtilsCaller { | ||
| function __constructor__(IOPContractsManagerUtils _utils) external; | ||
| function utils() external view returns (IOPContractsManagerUtils); | ||
| } |
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.
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.