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/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 diff --git a/evm_arithmetization/src/cpu/kernel/interpreter.rs b/evm_arithmetization/src/cpu/kernel/interpreter.rs index 7ee504902..49bd7058e 100644 --- a/evm_arithmetization/src/cpu/kernel/interpreter.rs +++ b/evm_arithmetization/src/cpu/kernel/interpreter.rs @@ -906,6 +906,7 @@ impl State for Interpreter { GenerationStateCheckpoint { registers: self.generation_state.registers, traces: self.generation_state.traces.checkpoint(), + clock: self.get_clock(), } } @@ -972,6 +973,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 5ea5facad..8ac87c26e 100644 --- a/evm_arithmetization/src/generation/state.rs +++ b/evm_arithmetization/src/generation/state.rs @@ -481,6 +481,7 @@ impl State for GenerationState { GenerationStateCheckpoint { registers: self.registers, traces: self.traces.checkpoint(), + clock: self.get_clock(), } } @@ -643,6 +644,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,