https://github.com/nethermindeth/evmyullean
Executable formal model of the EVM and Yul in Lean 4.
https://github.com/nethermindeth/evmyullean
Last synced: about 1 year ago
JSON representation
Executable formal model of the EVM and Yul in Lean 4.
- Host: GitHub
- URL: https://github.com/nethermindeth/evmyullean
- Owner: NethermindEth
- License: apache-2.0
- Created: 2024-07-18T15:44:08.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-09T07:58:33.000Z (about 1 year ago)
- Last Synced: 2025-04-09T08:39:14.294Z (about 1 year ago)
- Language: Lean
- Homepage:
- Size: 2.38 MB
- Stars: 54
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
This repository contains a formal model of the EVM and Yul in Lean 4.
Where applicable, the underlying EVM primops are used directly by the Yul model.
Everything here is work in progress and is subject to change therefore.
# Requirements
- Python packages: coincurve, typing-extensions, pycryptodome, eth-typing, py-ecc
# Project structure
## Primops
The `Operation` describing all of the primitive operations:
```
EvmYul/Operations.lean
```
The semantic function `primCall` associated with the ADT:
```
EvmYul/Yul/PrimOps.lean
```
## EVM
The model of the EVM state `EVM.State`:
```
EvmYul/EVM/State.lean
```
The semantic function `step`:
```
EvmYul/EVM/Semantics.lean
```
## Yul
The ADT `Stmt` mutually defined with `Expr` and `FunctionDefinition` describing Yul:
```
EvmYul/Yul/Ast.lean
```
The model of the Yul state `YUL.State`:
```
EvmYul/Yul/State.lean
```
The semantic function `exec` mutually defined with `eval` (and some misc. functions):
```
EvmYul/Yul/Interpreter.lean
```
## Conformance testing
A git submodule with EVM conformance tests is in:
```
EthereumTests/
```
The test running infrastructure can be found in:
```
Conform/
```
To execute conformance tests, make sure the `EthereumTests` directory is the appropriate git submodule and run:
```
lake test -- 2> out_discard.txt
```
where `` is the number of threads running conformance tests in parallel. Note that the default is `1`.
We recommend redirecting `stderr` into a file to not pollute the output.