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:
- 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). - Full support for current EVM instruction set.
- We can intercept contract calls so that we can later implement precompiles.
- 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
gethto 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
gethfor use as reference (and document how to do so) #3558 (closed) - Run standard tests on EVM kernel #3555 (closed)
- Set up
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
Loading
Loading
Loading
Loading