-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Port SequencerEntrypoint to use ovm solc #535
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
9 commits
Select commit
Hold shift + click to select a range
d46e81a
port SequencerEntrypoint to use ovm solc
smartcontracts ef5c085
Minor tweaks and comments
smartcontracts 783be8c
have hardhat-ovm invalidate cache on commit to solc-bin
smartcontracts 5f081b4
remove temporary solc version override
smartcontracts d880088
have cache invalidation on a per-version basis
smartcontracts 3687018
remove ethereumjs-util dep
smartcontracts 047eb33
fix lint error
smartcontracts 795d87a
use allow_kall_2 compiler until build is fixed
smartcontracts 2f2459e
add changeset
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@eth-optimism/contracts": patch | ||
| "@eth-optimism/hardhat-ovm": patch | ||
| --- | ||
|
|
||
| Use optimistic-solc to compile the SequencerEntrypoint. Also introduces a cache invalidation mechanism for hardhat-ovm so that we can push new compiler versions. |
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
128 changes: 128 additions & 0 deletions
128
...ontracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.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,128 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| // @unsupported: evm | ||
| pragma solidity >0.5.0 <0.8.0; | ||
|
|
||
| /* Library Imports */ | ||
| import { Lib_ErrorUtils } from "../utils/Lib_ErrorUtils.sol"; | ||
|
|
||
| /** | ||
| * @title Lib_ExecutionManagerWrapper | ||
| * | ||
| * Compiler used: solc | ||
| * Runtime target: OVM | ||
| */ | ||
| library Lib_ExecutionManagerWrapper { | ||
|
|
||
| /********************** | ||
| * Internal Functions * | ||
| **********************/ | ||
|
|
||
| /** | ||
| * Performs a safe ovmGETNONCE call. | ||
| * @return _nonce Result of calling ovmGETNONCE. | ||
| */ | ||
| function ovmGETNONCE() | ||
| internal | ||
| returns ( | ||
| uint256 _nonce | ||
| ) | ||
| { | ||
| bytes memory returndata = _safeExecutionManagerInteraction( | ||
| abi.encodeWithSignature( | ||
| "ovmGETNONCE()" | ||
| ) | ||
| ); | ||
|
|
||
| return abi.decode(returndata, (uint256)); | ||
| } | ||
|
|
||
| /** | ||
| * Performs a safe ovmINCREMENTNONCE call. | ||
| */ | ||
| function ovmINCREMENTNONCE() | ||
| internal | ||
| { | ||
| _safeExecutionManagerInteraction( | ||
| abi.encodeWithSignature( | ||
| "ovmINCREMENTNONCE()" | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Performs a safe ovmCREATEEOA call. | ||
| * @param _messageHash Message hash which was signed by EOA | ||
| * @param _v v value of signature (0 or 1) | ||
| * @param _r r value of signature | ||
| * @param _s s value of signature | ||
| */ | ||
| function ovmCREATEEOA( | ||
| bytes32 _messageHash, | ||
| uint8 _v, | ||
| bytes32 _r, | ||
| bytes32 _s | ||
| ) | ||
| internal | ||
| { | ||
| _safeExecutionManagerInteraction( | ||
| abi.encodeWithSignature( | ||
| "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)", | ||
| _messageHash, | ||
| _v, | ||
| _r, | ||
| _s | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Calls the ovmL1TXORIGIN opcode. | ||
| * @return Address that sent this message from L1. | ||
| */ | ||
| function ovmL1TXORIGIN() | ||
| internal | ||
| returns ( | ||
| address | ||
| ) | ||
| { | ||
| bytes memory returndata = _safeExecutionManagerInteraction( | ||
| abi.encodeWithSignature( | ||
| "ovmL1TXORIGIN()" | ||
| ) | ||
| ); | ||
|
|
||
| return abi.decode(returndata, (address)); | ||
| } | ||
|
|
||
|
|
||
| /********************* | ||
| * Private Functions * | ||
| *********************/ | ||
|
|
||
| /** | ||
| * Performs an ovm interaction and the necessary safety checks. | ||
| * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash). | ||
| * @return _returndata Data sent back by the OVM_ExecutionManager. | ||
| */ | ||
| function _safeExecutionManagerInteraction( | ||
| bytes memory _calldata | ||
| ) | ||
| private | ||
| returns ( | ||
| bytes memory | ||
| ) | ||
| { | ||
| bytes memory returndata; | ||
| assembly { | ||
| // kall is a custom yul builtin within optimistic-solc that allows us to directly call | ||
| // the execution manager (since `call` would be compiled). | ||
| kall(add(_calldata, 0x20), mload(_calldata), 0x0, 0x0) | ||
| let size := returndatasize() | ||
| returndata := mload(0x40) | ||
| mstore(0x40, add(returndata, and(add(add(size, 0x20), 0x1f), not(0x1f)))) | ||
| mstore(returndata, size) | ||
| returndatacopy(add(returndata, 0x20), 0x0, size) | ||
| } | ||
| return returndata; | ||
| } | ||
| } |
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
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.