-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[WIP] feat: Have predeploys use OVM solc only #475
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
Conversation
|
|
When building locally: |
|
Running it locally found: Nit: the filename should be |
|
@smartcontracts The state dump file fails to build so it is not created and served to |
…eat/predeploys-use-ovm-solc
|
This is the monorepo port of ethereum-optimism/contracts#300 |
|
After doing more debugging it seems integration tests are failing due to a bug in the compiler, probably related to optimism/integration-tests/test/rpc.spec.ts Lines 84 to 100 in d76f0ce
And then observing the L2Geth logs. It should fail at @ben-chain is going to help look into the compiler issue |
ben-chain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a good number of comments; this is looking great! Need to figure out how to get the two deleted tests back, though -- not obvious to me what the dependency problem is there, but I'm assuming that's what it is.
| OriginalTargetReached bool | ||
| OvmExecutionManager dump.OvmDumpAccount | ||
| OvmStateManager dump.OvmDumpAccount | ||
| OvmMockAccount dump.OvmDumpAccount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this file diff seems unrelated and probably should have been a separate PR
| pragma experimental ABIEncoderV2; | ||
|
|
||
| /* Interface Imports */ | ||
| import { iOVM_ERC20 } from "../../iOVM/predeploys/iOVM_ERC20.sol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be OVM_ETH as we do have a strict assumption that it will be that specific ERC20?
| Lib_SafeExecutionManagerWrapper.safeREQUIRE( | ||
| decodedTx.chainId == Lib_SafeExecutionManagerWrapper.safeCHAINID(), | ||
| require( | ||
| decodedTx.chainId == Lib_ExecutionManagerWrapper.ovmCHAINID(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could alternatively use Yul here now; so real preference from me though.
| // // Need to make sure that the gas is sufficient to execute the transaction. | ||
| // Lib_SafeExecutionManagerWrapper.safeREQUIRE( | ||
| // gasleft() >= Lib_SafeMathWrapper.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD), | ||
| // Lib_ExecutionManagerWrapper.safeREQUIRE( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this can be replaced with an explicit require, just like the nonce check above
| if iszero(created) { | ||
| let size := returndatasize() | ||
| revertdata := mload(0x40) | ||
| mstore(0x40, add(revertdata, and(add(add(size, 0x20), 0x1f), not(0x1f)))) | ||
| mstore(revertdata, size) | ||
| returndatacopy(add(revertdata, 0x20), 0x0, size) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is a little brittle, at minimum I think adding comments is required here. This could have been left as-is though, right? I have mixed feelings--on one hand, this block of assembly would make no sense in the EVM context, so it is a little confusing to read, and the functionality feels very "wrapper-ey" to me. OTOH, I get that it does add overhead to a reviewer's life.
| predeploys[name] || | ||
| `0xdeaddeaddeaddeaddeaddeaddeaddeaddead${i.toString(16).padStart(4, '0')}` | ||
|
|
||
| let def: any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One problem this just raised for me is that because of unsupported: evm we will now be in the situation that contracts which use kall cannot be referenced by EVM contracts. Solvable with interfaces but we should think about if there's something more clever to be done here.
| before(async () => { | ||
| Factory__OVM_ECDSAContractAccount = await ethers.getContractFactory( | ||
| 'OVM_ECDSAContractAccount' | ||
| Factory__OVM_ECDSAContractAccount = getContractFactory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL very glad that this works in either runtime
| Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with([true, '0x']) | ||
| Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with( | ||
| (gasLimit, target, data) => { | ||
| if (target === '0x4200000000000000000000000000000000000006') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: getting this from the predeploys export would improve readability on this test
| ) | ||
| Mock__OVM_ExecutionManager.smocked.ovmSTATICCALL.will.return.with( | ||
| (gasLimit, target, data) => { | ||
| if (target === '0x0000000000000000000000000000000000000001') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (target === '0x0000000000000000000000000000000000000001') { | |
| // smock ecrecover precompile | |
| if (target === '0x0000000000000000000000000000000000000001') { |
| Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with([false, '0x']) | ||
| Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with( | ||
| (gasLimit, target, data) => { | ||
| if (target === '0x4200000000000000000000000000000000000006') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto on lookup from predeploys
|
Going to be dropping this PR in favor of several smaller PRs. Leaving this up as reference for myself. |
|
@smartcontracts closing - can still view this as a closed PR |
>>> Not ready for review <<<
Description
Working on this in a draft PR so I can have CI run.
Fixes #495