Skip to content
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

feat: Evm equivalence #685

Closed
wants to merge 69 commits into from

Conversation

jrchatruc
Copy link
Contributor

@jrchatruc jrchatruc commented Aug 9, 2024

What ❔

This PR includes only the necessary changes from #364 starting from the current dev branch.

The main changes are:

  • New EvmGasManager.sol and EvmInterpreter.yul contracts were added.
  • A yarn sc preprocess:interpreter command to preprocess the interpreter from its three template files (EvmInterpreterFunctions.template.yul, EvmInterpereterLoop.template.yul and EvmInterpreter.template.yul)
  • The CodeOracle was updated to handle decommitments of EVM contracts (i.e. the case where the version byte of the code hash is 2).
  • The execute method of the DefaultAccount now checks the second byte to see if the constructor is being called and dispatches it to the createEVM method on the deployer if so.
  • The ContractDeployer has a few more methods required for equivalence:
    • setDeployedCode, used by the interpreter to publish evm bytecodes and store code hashes
    • createEVMInternal and internal functions it calls, used by the interpreter for CREATE opcodes
  • ContractDeployer also now maintains an evmCodeHash mapping of EVM code hashes.
  • AccountCodeStorage now checks for EVM contracts on getCodeHash and queries the mapping above if so.
  • The check done by the bootloader on regular transactions (type 0) that the reserved1 byte should be zero was removed, as it now corresponds to evm contracts.

Why ❔

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.

@jrchatruc jrchatruc marked this pull request as ready for review August 20, 2024 17:57
@jrchatruc jrchatruc changed the title Evm equivalence (updated with latest changes) feat: Evm equivalence (updated with latest changes) Aug 20, 2024
IAvecilla and others added 24 commits August 27, 2024 15:50
* Revert fetch deployed code len optimization

* Calculate hashes:fix
* Optimize EvmGasManager

* Fix typo

* Simplify consumeEvmFrame

* Update hashes
* Remove invalid todos adding overflow checks

* Remove old memory check

* Add preprocessed evm interpreter

* Remove unnecesary memory checks

* Update hash for evm interpreter
* Revert consumeEvmFrame EvmGasManager optimization

* Update hashes
@jrchatruc jrchatruc mentioned this pull request Sep 17, 2024
3 tasks
@jrchatruc jrchatruc changed the title feat: Evm equivalence (updated with latest changes) feat: Evm equivalence Sep 17, 2024
* Cleanup EvmInterpreterFunctions

* Cleanup in logs

* Remove unneded changes

* Use rawMimicCall
@jrchatruc
Copy link
Contributor Author

Closed in favor of #821

@jrchatruc jrchatruc closed this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants