MCPcopy Index your code
hub / github.com/0xPolygonZero/zk_evm

github.com/0xPolygonZero/zk_evm @v0.7.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.0 ↗ · + Follow
2,459 symbols 8,028 edges 260 files 697 documented · 28%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

zk_evm

A collection of libraries to prove Ethereum blocks with Polygon Zero Type 1 zkEVM, powered by starky and plonky2 proving systems.

Directory structure

This repository contains the following Rust crates:

  • mpt_trie: A collection of types and functions to work with Ethereum Merkle Patricie Tries.

  • smt_trie: A collection of types and functions to work with Polygon Hermez Sparse Merkle Trees (SMT).

  • trace_decoder: Flexible protocol designed to process Ethereum clients trace payloads into an IR format that can be understood by the zkEVM prover.

  • evm_arithmetization: Defines all the STARK constraints and recursive circuits to generate succinct proofs of EVM execution. It uses starky and plonky2 as proving backend: https://github.com/0xPolygonZero/plonky2.

  • zero_bin: A composition of paladin and evm_arithmetization to generate EVM block proofs.

Dependency graph

Below is a simplified view of the dependency graph, including the proving system backends and the application layer defined within zero-bin.

%%{init: {'theme':'dark'}}%%
flowchart LR
    subgraph ps [proving systems]
    A1{{plonky2}}
    A2{{starky}}
    end

    ps --> zk_evm

    subgraph zk_evm [zk_evm]
    B[mpt_trie]
    C[evm_arithmetization]
    D[trace_decoder]

    B --> C
    B ---> D
    C ---> D

    F{zero-bin}
    C --> F
    D --> F
    end

Documentation

Documentation is still incomplete and will be improved over time. You can look at the sequence diagrams for the proof generation flow, or go through the zkEVM book for explanations on the zkEVM design and architecture.

Branches

The default branch for the repo is the develop branch which is not stable but under active development. Most PRs should target develop. If you need a stable branch then a tagged version of main is what you're after. It should be assumed that develop will break and should only be used for development.

Building

The zkEVM stack currently requires the nightly toolchain, although we may transition to stable in the future. Note that the prover uses the Jemalloc memory allocator due to its superior performance.

License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

DiskResource (Interface)
A trait for generic resources that may be written to and read from disk, each with their own serialization and deseriali [4 …
zero/src/prover_state/persistence.rs
Stack (Interface)
(no doc) [7 implementers]
evm_arithmetization/src/extension_tower.rs
TryFromIterator (Interface)
Conversion from an [`Iterator`] within an allocator. By implementing `TryFromIteratorIn` for a type, you define how it [2 …
mpt_trie/src/utils.rs
Observer (Interface)
Observer API for the trace decoder. Observer is used to collect various debugging and metadata info from the trace decod [2 …
trace_decoder/src/observer.rs
Db (Interface)
(no doc) [1 implementers]
smt_trie/src/db.rs
TestDerefColumns (Interface)
(no doc) [1 implementers]
proc_macro/tests/compile/test_impls.rs
BlockIntervalProvider (Interface)
(no doc) [1 implementers]
zero/src/block_interval.rs
FieldExt (Interface)
(no doc) [5 implementers]
evm_arithmetization/src/extension_tower.rs

Core symbols most depended-on inside this repo

map
called by 484
trace_decoder/src/core.rs
clone
called by 396
zero/src/rpc/retry.rs
iter
called by 240
evm_arithmetization/src/tries.rs
push
called by 215
evm_arithmetization/src/cpu/columns/general.rs
insert
called by 190
evm_arithmetization/src/tries.rs
try_into
called by 149
mpt_trie/src/nibbles.rs
into_iter
called by 138
mpt_trie/src/utils.rs
run
called by 136
evm_arithmetization/src/cpu/kernel/interpreter.rs

Shape

Function 1,318
Method 789
Class 258
Enum 73
Interface 21

Languages

Rust100%
TypeScript1%

Modules by API surface

mpt_trie/src/nibbles.rs102 symbols
evm_arithmetization/src/fixed_recursive_verifier.rs68 symbols
mpt_trie/src/trie_ops.rs66 symbols
evm_arithmetization/src/generation/prover_input.rs65 symbols
evm_arithmetization/src/cpu/kernel/interpreter.rs55 symbols
evm_arithmetization/src/generation/state.rs54 symbols
mpt_trie/src/trie_subsets.rs48 symbols
evm_arithmetization/src/cpu/kernel/assembler.rs41 symbols
evm_arithmetization/src/cpu/cpu_stark.rs41 symbols
evm_arithmetization/src/tries.rs35 symbols
evm_arithmetization/src/extension_tower.rs35 symbols
evm_arithmetization/src/proof.rs32 symbols

For agents

$ claude mcp add zk_evm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page