From 0514cd9646fa9f182c96dfb7bbd2e5e9672f782d Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Thu, 16 Jun 2022 23:37:51 -0700 Subject: [PATCH] addressed comments --- evm/src/cpu/columns.rs | 1 - evm/src/memory/memory_stark.rs | 27 +++++++++------------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/evm/src/cpu/columns.rs b/evm/src/cpu/columns.rs index 3c90c673..296744c4 100644 --- a/evm/src/cpu/columns.rs +++ b/evm/src/cpu/columns.rs @@ -163,7 +163,6 @@ const NUM_MEMORY_VALUE_LIMBS: usize = 8; pub(crate) const CLOCK: usize = SIMPLE_LOGIC_DIFF_INV + 1; - const USES_MEMOP_START: usize = CLOCK + 1; pub const fn uses_memop(op: usize) -> usize { debug_assert!(op < NUM_MEMORY_OPS); diff --git a/evm/src/memory/memory_stark.rs b/evm/src/memory/memory_stark.rs index d74c65e8..09e3320d 100644 --- a/evm/src/memory/memory_stark.rs +++ b/evm/src/memory/memory_stark.rs @@ -124,25 +124,16 @@ pub fn generate_first_change_flags( let mut segment_first_change = Vec::new(); let mut virtual_first_change = Vec::new(); for idx in 0..num_ops - 1 { - let this_context_first_change = if context[idx] != context[idx + 1] { - F::ONE - } else { - F::ZERO - }; - let this_segment_first_change = if segment[idx] != segment[idx + 1] { - F::ONE * (F::ONE - this_context_first_change) - } else { - F::ZERO - }; - let this_virtual_first_change = if virtuals[idx] != virtuals[idx + 1] { - F::ONE * (F::ONE - this_context_first_change) * (F::ONE - this_segment_first_change) - } else { - F::ZERO - }; + let this_context_first_change = context[idx] != context[idx + 1]; + let this_segment_first_change = + segment[idx] != segment[idx + 1] && !this_context_first_change; + let this_virtual_first_change = virtuals[idx] != virtuals[idx + 1] + && !this_segment_first_change + && !this_context_first_change; - context_first_change.push(this_context_first_change); - segment_first_change.push(this_segment_first_change); - virtual_first_change.push(this_virtual_first_change); + context_first_change.push(F::from_bool(this_context_first_change)); + segment_first_change.push(F::from_bool(this_segment_first_change)); + virtual_first_change.push(F::from_bool(this_virtual_first_change)); } context_first_change.push(F::ZERO);