From 4255b5de34e2b9b37f18f4b6732f5a265c48ffc9 Mon Sep 17 00:00:00 2001 From: Robin Salen <30937548+Nashtare@users.noreply.github.com> Date: Thu, 14 Mar 2024 16:10:02 +0900 Subject: [PATCH 1/2] Add dependency graph (#107) --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 0c03cb3c0..7e05e69d3 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,38 @@ It uses starky and plonky2 as proving backend: https://github.com/0xPolygonZero/ * [proof_gen](./proof_gen/README.md): A convenience library for generating proofs from inputs already in Intermediate Representation (IR) format. +## Dependency graph + +Below is a simplified view of the dependency graph, including the proving systems backend and the application layer defined within [zero-bin](https://github.com/0xPolygonZero/zero-bin). + +```mermaid +flowchart TD + subgraph ps [proving systems] + A1{{plonky2}} + A2{{starky}} + end + + subgraph zk_evm [zk_evm] + B[mpt_trie] + C[evm_arithmetization] + D[trace_decoder] + E[proof_gen] + A1 --> C + A1 --> E + A2 --> C + B --> C + B ---> D + C ---> D + C --> E + D --> E + end + + F{zero-bin} + A1 --> F + C --> F + D --> F + E --> F +``` ## Documentation From e39389264750c8375b609b291fe6775c19caef1a Mon Sep 17 00:00:00 2001 From: Linda Guiga <101227802+LindaGuiga@users.noreply.github.com> Date: Mon, 18 Mar 2024 11:14:12 +0100 Subject: [PATCH 2/2] Add clock to GenerationStateCheckpoint and fix interpreter rollback (#109) * Add clock to GenerationStateCheckpoint and fix interpreter rollback * Add CHANGELOG entry --- CHANGELOG.md | 1 + evm_arithmetization/src/cpu/kernel/interpreter.rs | 2 ++ evm_arithmetization/src/generation/state.rs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26cce7fc8..978f4dd4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix post-txn trie debugging output for multi-logs receipts ([#86](https://github.com/0xPolygonZero/zk_evm/pull/86)) - Fixed *most* failing blocks caused by the merged in aggressive pruning changes ([#97](https://github.com/0xPolygonZero/zk_evm/pull/97)) - Fixed trie hash collision issue when constructing storage tries [#75](https://github.com/0xPolygonZero/zk_evm/pull/75) +- Fix interpreter rollback by adding the clock to generation state checkpoints ([#109] https://github.com/0xPolygonZero/zk_evm/pull/109) ## [0.1.1] - 2024-03-01 diff --git a/evm_arithmetization/src/cpu/kernel/interpreter.rs b/evm_arithmetization/src/cpu/kernel/interpreter.rs index 9dedd0e57..593b4a3f8 100644 --- a/evm_arithmetization/src/cpu/kernel/interpreter.rs +++ b/evm_arithmetization/src/cpu/kernel/interpreter.rs @@ -748,6 +748,7 @@ impl State for Interpreter { GenerationStateCheckpoint { registers: self.generation_state.registers, traces: self.generation_state.traces.checkpoint(), + clock: self.get_clock(), } } @@ -814,6 +815,7 @@ impl State for Interpreter { fn push_keccak_sponge(&mut self, _op: KeccakSpongeOp) {} fn rollback(&mut self, checkpoint: GenerationStateCheckpoint) { + self.clock = checkpoint.clock; self.generation_state.rollback(checkpoint) } diff --git a/evm_arithmetization/src/generation/state.rs b/evm_arithmetization/src/generation/state.rs index 630a21523..e919eba80 100644 --- a/evm_arithmetization/src/generation/state.rs +++ b/evm_arithmetization/src/generation/state.rs @@ -424,6 +424,7 @@ impl State for GenerationState { GenerationStateCheckpoint { registers: self.registers, traces: self.traces.checkpoint(), + clock: self.get_clock(), } } @@ -591,6 +592,7 @@ impl Transition for GenerationState { pub(crate) struct GenerationStateCheckpoint { pub(crate) registers: RegistersState, pub(crate) traces: TraceCheckpoint, + pub(crate) clock: usize, } /// Withdrawals prover input array is of the form `[addr0, amount0, ..., addrN,