Closed
Milestone

EVM on WASM: Run EVM interpreter from kernel

Goal

Run EVM contract(s) with an EVM interpreter compiled to WASM. Interpreter is called from the kernel_next function in the WASM kernel (this implies limited access to std library as per transactions kernel).

Success

We can run an EVM interpreter from kernel_next where:

  1. Compiling/linking the EVM interpreter doesn't need anything from Rust std (with exceptions allowed in the kernel) or other functionality not supported by the WASM PVM (eg, floating point operations, random numbers).
  2. Full support for current EVM instruction set.
  3. We can intercept contract calls so that we can later implement precompiles.
  4. We get log output from contract calls.

Knowledge gathering

  • List of all current EVM instructions we need to support. See this list of instructions.
  • Detailed list of all EVM instructions and opcodes that require information from outside the EVM interpreter. An EVM contract can access information such as block hash, block number, timestamp, proof-of-work difficulty, et.c. We'll need to provide this data to the EVM interpreter, and we have to choose an interpreter that allows us to support this. A list has been compiled here.
  • Overview of up coming Ethereum EIPs and how the affect instruction semantics (move to proof-of-stake et.c.).

Implementation

  • A crate in the workspace of the WASM kernel for the EVM kernel.
    • Setup basic Rust/Cargo files for the EVM kernel #3547 (closed)
  • Add transaction kernel functionality to EVM kernel, with one additional transaction type: EVM contract calls (dummy handler).
    • Add TX kernel to EVM kernel #3583 (closed)
  • Add EVM interpreter to EVM kernel
    • Use SputnikVM to handle EVM contract calls. #3549 (closed)
    • Use geth to handle EVM contract calls. #3550 (closed)
  • Call precompiled contract as an EVM contract.
    • A simple precompiled contract computing identity function and write to log #3552 (closed)
  • Confidence that the EVM interpreter is completely correct.
    • Set up geth for use as reference (and document how to do so) #3558 (closed)
    • Run standard tests on EVM kernel #3555 (closed)

Confidence

  • Test of simple contract calls
  • Test of contract calling other contracts
  • Test log output
  • Test contract call intercept
  • EVM test suite.

Further reading

See page in notion: https://www.notion.so/trilitech/EVM-on-WASM-on-Rollups-8d6ab0840ad24199aa46735bf5787189

  • Work items 8
  • Merge requests 0
  • Participants 1
  • Labels 0
Loading
Loading
Loading
Loading
100% complete
100%
Start date
No start date
None
Due date
No due date
8
Work items 8 New issue
Open: 0 Closed: 8
16
Total weight
16
0
Merge requests 0
Open: 0 Closed: 0 Merged: 0
0
Releases
None
Reference: tezos/tezos%"EVM on WASM: Run EVM interpreter from kernel"