Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring latest main to feat/cancun #61

Merged
merged 32 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6347cee
Bring more dependencies to workspace level (#35)
Nashtare Feb 14, 2024
e9dcb33
Add `mpt_trie` missing docs (#37)
4l0n50 Feb 15, 2024
0cd5748
Added some more tests and traces
BGluth Jan 29, 2024
b70af72
Fixed sub-set bug
BGluth Jan 29, 2024
efcff57
Added another large battery test
BGluth Jan 29, 2024
d7d6a81
Few small test fixes
BGluth Jan 31, 2024
9643885
Moved some types around in preparation for new logic
BGluth Feb 8, 2024
c59cdd9
Logic for trie queries
BGluth Feb 10, 2024
3323697
Added docs to query logic
BGluth Feb 10, 2024
cca640a
Some refactoring related to the query logic
BGluth Feb 10, 2024
ee14801
Added logic to reconstruct a key from a trie path
BGluth Feb 10, 2024
7383858
Added missing function `push_nibbles_back`
BGluth Feb 15, 2024
cf1f147
Finished segment to key + cleanup
BGluth Feb 15, 2024
3030cd4
Fixed a bug in `create_trie_subsets`
BGluth Feb 15, 2024
695c9a3
Subset tests now start the logger
BGluth Feb 15, 2024
1ed8454
Renamed `PathSegment` --> `TrieSegment`
BGluth Feb 15, 2024
0a8c16d
Fixed two clippy errors
BGluth Feb 15, 2024
e22b8e0
Fixed withdrawal accounts not being in the state trie
BGluth Feb 1, 2024
51a306e
Requested PR changes for #18
BGluth Feb 16, 2024
f97b90f
Merge pull request #43 from 0xPolygonZero/withdrawls_not_in_state_tri…
BGluth Feb 16, 2024
d0bc5ec
Code hash resolve fix + cleanup (#44)
BGluth Feb 16, 2024
b994373
fix(evm_arithmetization): fix padding constraint in keccak_stark (#48)
shuklaayush Feb 19, 2024
bc0d2db
fix(evm_arithmetization): constraint keccak round flags to bits (#51)
shuklaayush Feb 19, 2024
62b6f5a
Add SECURITY.md (#53)
Nashtare Feb 19, 2024
3bd89a1
Apply suggestions from code review
BGluth Feb 21, 2024
2d36eba
Merge pull request #39 from 0xPolygonZero/subtrie_pruning_optimization
BGluth Feb 21, 2024
4a38374
Prepare for release (#54)
Nashtare Feb 21, 2024
c68baf9
Update keywords and add crate description for trace_decoder
Nashtare Feb 21, 2024
735855e
Refactor access lists (#30)
Nashtare Feb 22, 2024
efd602f
Update CHANGELOG post #30 merge
Nashtare Feb 22, 2024
6fb1df2
Update mpt_trie API (#57)
hratoanina Feb 23, 2024
5f5485c
Merge remote-tracking branch 'origin/main' into cancun-main
Nashtare Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- Refactor accessed lists as sorted linked lists ([#30](https://github.com/0xPolygonZero/zk_evm/pull/30))
- Change visibility of `compact` mod ([#57](https://github.com/0xPolygonZero/zk_evm/pull/57))

## [0.1.0] - 2024-02-21
* Initial release.
13 changes: 12 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,30 @@ resolver = "2"
[workspace.dependencies]
bytes = "1.5.0"
enum-as-inner = "0.6.0"
env_logger = "0.10.0"
ethereum-types = "0.14.1"
hex = "0.4.3"
hex-literal = "0.4.1"
keccak-hash = "0.10.0"
log = "0.4.20"
num = "0.4.1"
rand = "0.8.5"
rlp = "0.5.2"
rlp-derive = "0.1.0"
serde = "1.0.166"
serde_json = "1.0.96"
thiserror = "1.0.49"

# plonky2-related dependencies
plonky2 = "0.2.0"
plonky2_maybe_rayon = "0.2.0"
plonky2_util = "0.2.0"
starky = "0.2.0"


[workspace.package]
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/0xPolygonZero/zk_evm"
homepage = "https://github.com/0xPolygonZero/zk_evm"
keywords = ["cryptography", "SNARK", "PLONK", "FRI", "plonky2", "EVM", "ETHEREUM"]
keywords = ["cryptography", "STARK", "plonky2", "ethereum", "zk"]
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# zk_evm

A collection of libraries to prove Ethereum blocks with Polygon Zero Type 1 zkEVM,
powered by [starky and plonky2](https://github.com/0xPolygonZero/plonky2) proving systems.


## Directory structure

This repository contains the following Rust crates:

* [mpt_trie](./mpt_trie/README.md): A collection of types and functions to work with Ethereum Merkle Patricie Tries.

* [trace_decoder](./trace_decoder/README.md): Flexible protocol designed to process Ethereum clients trace payloads into an IR format that can be
understood by the zkEVM prover.

* [evm_arithmetization](./evm_arithmetization/README.md): 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.

* [proof_gen](./proof_gen/README.md): A convenience library for generating proofs from inputs already in Intermediate Representation (IR) format.


## Documentation

Documentation is still incomplete and will be improved over time, a lot of useful material can
be found in the [docs](./docs/) section, including:

* [sequence diagrams](./docs/usage_seq_diagrams.md) for the proof generation flow
* [zkEVM specifications](./docs/arithmetization/zkevm.pdf), detailing the underlying EVM proving statement


## 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](http://jemalloc.net/) memory allocator due to its superior performance.

## License

Licensed under either of
Expand All @@ -11,4 +44,5 @@ 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.
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.
17 changes: 17 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Polygon Technology Security Information

## Link to vulnerability disclosure details (Bug Bounty).
- Websites and Applications: https://hackerone.com/polygon-technology
- Smart Contracts: https://immunefi.com/bounty/polygon

## Languages that our team speaks and understands.
Preferred-Languages: en

## Security-related job openings at Polygon.
https://polygon.technology/careers

## Polygon security contact details.
[email protected]

## The URL for accessing the security.txt file.
Canonical: https://polygon.technology/security.txt
26 changes: 6 additions & 20 deletions docs/usage_seq_diagrams.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Usage Diagrams
These are some hacked together diagrams showing how the protocol will (likely) be used. Also included what the old Edge proof generation process looked like as a reference.

## Proof Protocol
These are some diagrams showing how the protocol is implemented.

## Proof Generation

```mermaid
sequenceDiagram
proof protocol client->>proof scheduler: protocol_payload
proof scheduler->>protocol decoder (lib): protolcol_payload
Note over proof scheduler,protocol decoder (lib): "txn_proof_gen_ir" are the payloads sent to Paladin for a txn
protocol decoder (lib)->>proof scheduler: [txn_proof_gen_ir]
proof scheduler->>trace decoder (lib): protocol_payload
Note over proof scheduler,trace decoder (lib): "txn_proof_gen_ir" are the payloads sent to Paladin for a txn
trace decoder (lib)->>proof scheduler: [txn_proof_gen_ir]
proof scheduler->>paladin: [txn_proof_gen_ir]
Note over proof scheduler,paladin: Paladin schedules jobs on multiple machines and returns a block proof
loop txn_proof_gen_ir
Expand All @@ -19,18 +20,3 @@ sequenceDiagram
Note over proof scheduler,checkpoint contract: Note: Might send to an external service instead that compresses the proof
proof scheduler->>checkpoint contract: block_proof
```

## Edge Proof Generation

```mermaid
sequenceDiagram
edge->>zero provers (leader): block_trace
zero provers (leader)->>trace parsing lib: block_trace
Note over zero provers (leader),trace parsing lib: "txn_proof_gen_ir" are the payloads sent to each worker for a txn
trace parsing lib->>zero provers (leader): [txn_proof_gen_ir]
loop txn_proof_gen_ir
zero provers (leader)->>zero provers (worker): proof_gen_payload (txn, agg, block)
zero provers (worker)->>zero provers (leader): generated_proof (txn, agg, block)
end
zero provers (leader)->>checkpoint contract: block_proof
```
16 changes: 8 additions & 8 deletions evm_arithmetization/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ keywords.workspace = true
[dependencies]
anyhow = "1.0.40"
bytes = { workspace = true }
env_logger = "0.10.0"
ethereum-types = "0.14.0"
env_logger = { workspace = true }
ethereum-types = { workspace = true }
hex = { workspace = true, optional = true }
hex-literal = { workspace = true }
itertools = "0.11.0"
keccak-hash = { workspace = true }
log = { workspace = true }
plonky2_maybe_rayon = { git = "https://github.com/0xPolygonZero/plonky2.git", rev = "710225c9e0ac5822b2965ce74951cf000bbb8a2c" }
plonky2_maybe_rayon = { workspace = true }
num = { workspace = true }
num-bigint = "0.4.3"
once_cell = "1.13.0"
pest = "2.1.3"
pest_derive = "2.1.0"
plonky2 = { git = "https://github.com/0xPolygonZero/plonky2.git", rev = "710225c9e0ac5822b2965ce74951cf000bbb8a2c" }
plonky2_util = { git = "https://github.com/0xPolygonZero/plonky2.git", rev = "710225c9e0ac5822b2965ce74951cf000bbb8a2c" }
starky = { git = "https://github.com/0xPolygonZero/plonky2.git", rev = "710225c9e0ac5822b2965ce74951cf000bbb8a2c" }
rand = "0.8.5"
plonky2 = { workspace = true }
plonky2_util = { workspace = true }
starky = { workspace = true }
rand = { workspace = true }
rand_chacha = "0.3.1"
rlp = { workspace = true }
rlp-derive = { workspace = true }
serde = { workspace = true, features = ["derive"] }
static_assertions = "1.1.0"
hashbrown = { version = "0.14.0" }
tiny-keccak = "2.0.2"
serde_json = "1.0"
serde_json = { workspace = true }

# Local dependencies
mpt_trie = { version = "0.1.0", path = "../mpt_trie" }
Expand Down
Loading