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 #821

Open
wants to merge 69 commits into
base: dev
Choose a base branch
from
Open

feat: Evm equivalence #821

wants to merge 69 commits into from

Conversation

jrchatruc
Copy link
Contributor

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 and others added 30 commits August 7, 2024 17:00
IAvecilla and others added 26 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
* Cleanup EvmInterpreterFunctions

* Cleanup in logs

* Remove unneded changes

* Use rawMimicCall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants