Skip to content
lefterislazarPublic

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Repository files navigation

This repository contains a formal model of the EVM in Lean 4. It is an EVM-focused port of Nethermind's EVMYulLean to a newer version of Lean, with the Yul model removed. The aim is to simplify proof development over the model.

Everything here is work in progress and is subject to change therefore.

The changes in this repository are intended to ease proof development over the EVM model, with some tradeoffs against executable performance. They do not relax the behavioral compatibility target. The conformance suite has changed, and the model is now tested against the EEST: execution-spec-tests.

For a summary of the main differences from Nethermind's upstream project, see nethermind-changes.md.

Project structure

Forks

The semantics is parametric in the execution-layer fork, from Cancun to Osaka:

Ethereum/Fork.lean

EVM

The model of the EVM state EVM.State:

Ethereum/State.lean

The semantic function step:

Ethereum/Semantics.lean

Cryptography tests

Cryptography primitives are tested on their own, against vectors from independent reference implementations (hashlib, pycryptodome, libsecp256k1 through coincurve, OpenSSL through cryptography, py_ecc) and the TrieTests of ethereum/tests, together with algebraic checks such as the bilinearity of the pairings:

lake exe crypto-tests

The vectors live in CryptoTests/Vectors.lean and are generated by scripts/gen-crypto-vectors.py, using the Python packages of requirements.txt; it downloads the trie tests at a pinned commit.

Conformance testing

The model is tested against the blockchain fixtures of execution-spec-tests, pinned to release tests@v21.0.2. The test running infrastructure can be found in:

Conform/

Run the conformance tests with:

lake test 2> out_discard.txt

We recommend redirecting stderr into a file to not pollute the output.

The first run downloads the pinned fixtures. The pins and the fetching are in lakefile.lean.

This runs every fixture network from Cancun on.

lake test -- --help lists conformance parameters.

License

This repository is based on Nethermind's EVMYulLean, which is licensed under the Apache License, Version 2.0. This modified copy is distributed under the Apache License, Version 2.0; see LICENSE.

Notable modifications include porting the project to a newer Lean version, stripping the Yul portions, and adapting the remaining EVM model and project structure for proof development. See NOTICE for attribution and modification notes.

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages