diff --git a/evm_arithmetization/src/cpu/kernel/interpreter.rs b/evm_arithmetization/src/cpu/kernel/interpreter.rs index a031b48c4..173f8e5e0 100644 --- a/evm_arithmetization/src/cpu/kernel/interpreter.rs +++ b/evm_arithmetization/src/cpu/kernel/interpreter.rs @@ -924,20 +924,6 @@ impl State for Interpreter { } } - /// Inserts a preinitialized segment, given as a [Segment], - /// into the `preinitialized_segments` memory field. - fn insert_preinitialized_segment(&mut self, segment: Segment, values: MemorySegmentState) { - self.generation_state - .memory - .insert_preinitialized_segment(segment, values); - } - - fn is_preinitialized_segment(&self, segment: usize) -> bool { - self.generation_state - .memory - .is_preinitialized_segment(segment) - } - fn incr_gas(&mut self, n: u64) { self.generation_state.incr_gas(n); } diff --git a/evm_arithmetization/src/generation/state.rs b/evm_arithmetization/src/generation/state.rs index 55c99e498..0c428bc41 100644 --- a/evm_arithmetization/src/generation/state.rs +++ b/evm_arithmetization/src/generation/state.rs @@ -23,8 +23,8 @@ use crate::memory::segments::Segment; use crate::util::u256_to_usize; use crate::witness::errors::ProgramError; use crate::witness::memory::MemoryChannel::GeneralPurpose; +use crate::witness::memory::MemoryOpKind; use crate::witness::memory::{MemoryAddress, MemoryContextState, MemoryOp, MemoryState}; -use crate::witness::memory::{MemoryOpKind, MemorySegmentState}; use crate::witness::operation::{generate_exception, Operation}; use crate::witness::state::RegistersState; use crate::witness::traces::{TraceCheckpoint, Traces}; @@ -85,8 +85,11 @@ pub(crate) trait State { /// Checks whether we have reached the `halt` label in kernel mode. fn at_halt(&self) -> bool { + let halt = KERNEL.global_labels["halt"]; + let halt_final = KERNEL.global_labels["halt_final"]; let registers = self.get_registers(); - registers.is_kernel && registers.program_counter == KERNEL.global_labels["halt"] + registers.is_kernel + && (registers.program_counter == halt || registers.program_counter == halt_final) } /// Returns the context in which the jumpdest analysis should end. @@ -153,13 +156,7 @@ pub(crate) trait State { /// Return the offsets at which execution must halt fn get_halt_offsets(&self) -> Vec; - /// Inserts a preinitialized segment, given as a [Segment], - /// into the `preinitialized_segments` memory field. - fn insert_preinitialized_segment(&mut self, segment: Segment, values: MemorySegmentState); - - fn is_preinitialized_segment(&self, segment: usize) -> bool; - - fn update_interpreter_final_registers(&mut self, final_registers: RegistersState) {} + fn update_interpreter_final_registers(&mut self, _final_registers: RegistersState) {} fn get_full_memory(&self) -> Option { None @@ -176,10 +173,8 @@ pub(crate) trait State { { let halt_offsets = self.get_halt_offsets(); - let halt_pc = KERNEL.global_labels["halt"]; - let halt_final_pc = KERNEL.global_labels["halt_final"]; let mut final_registers = RegistersState::default(); - let mut final_mem = self.get_mut_generation_state().memory.clone(); + let final_mem = self.get_generation_state().memory.clone(); let mut running = true; let mut final_clock = 0; loop { @@ -499,16 +494,6 @@ impl State for GenerationState { } } - fn insert_preinitialized_segment(&mut self, _segment: Segment, _values: MemorySegmentState) { - panic!( - "A `GenerationState` cannot have a nonempty `preinitialized_segment` field in memory." - ) - } - - fn is_preinitialized_segment(&self, _segment: usize) -> bool { - false - } - fn incr_gas(&mut self, n: u64) { self.registers.gas_used += n; } diff --git a/evm_arithmetization/src/memory/memory_stark.rs b/evm_arithmetization/src/memory/memory_stark.rs index 360a40f2b..d7ba43eff 100644 --- a/evm_arithmetization/src/memory/memory_stark.rs +++ b/evm_arithmetization/src/memory/memory_stark.rs @@ -225,7 +225,7 @@ impl, const D: usize> MemoryStark { /// a trace in column-major form. /// Also generates the `STALE_CONTEXTS`, `STALE_CONTEXTS_FREQUENCIES` and /// `MEM_AFTER_FILTER` columns. - fn generate_trace_col_major(trace_col_vecs: &mut [Vec], stale_contexts: Vec) { + fn generate_trace_col_major(trace_col_vecs: &mut [Vec]) { let height = trace_col_vecs[0].len(); trace_col_vecs[COUNTER] = (0..height).map(|i| F::from_canonical_usize(i)).collect(); @@ -397,7 +397,7 @@ impl, const D: usize> MemoryStark { let mut trace_col_vecs = transpose(&trace_row_vecs); // A few final generation steps, which work better in column-major form. - Self::generate_trace_col_major(&mut trace_col_vecs, stale_contexts); + Self::generate_trace_col_major(&mut trace_col_vecs); let final_rows = transpose(&trace_col_vecs); diff --git a/evm_arithmetization/src/witness/state.rs b/evm_arithmetization/src/witness/state.rs index 2a5853c6f..7553d47a1 100644 --- a/evm_arithmetization/src/witness/state.rs +++ b/evm_arithmetization/src/witness/state.rs @@ -5,14 +5,6 @@ use crate::cpu::kernel::aggregator::KERNEL; const KERNEL_CONTEXT: usize = 0; -/// Structure for the state of the registers before and after -/// the current execution. -#[derive(Copy, Clone, Default)] -pub struct PublicRegisterStates { - registers_before: RegistersState, - registers_after: RegistersState, -} - #[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)] pub struct RegistersState { pub program_counter: usize, diff --git a/evm_arithmetization/src/witness/transition.rs b/evm_arithmetization/src/witness/transition.rs index 8ea2f44be..b63dda1f7 100644 --- a/evm_arithmetization/src/witness/transition.rs +++ b/evm_arithmetization/src/witness/transition.rs @@ -10,7 +10,7 @@ use crate::cpu::membus::NUM_GP_CHANNELS; use crate::cpu::stack::{ EQ_STACK_BEHAVIOR, IS_ZERO_STACK_BEHAVIOR, JUMPI_OP, JUMP_OP, MIGHT_OVERFLOW, STACK_BEHAVIORS, }; -use crate::generation::state::{GenerationState, State}; +use crate::generation::state::State; use crate::memory::segments::Segment; use crate::witness::errors::ProgramError; use crate::witness::gas::gas_to_charge; @@ -305,8 +305,6 @@ where fn final_exception(&mut self) -> anyhow::Result<()> { let checkpoint = self.checkpoint(); - let gen_state = self.get_mut_generation_state(); - let (row, _) = self.base_row(); generate_exception(EXC_STOP_CODE, self, row) diff --git a/evm_arithmetization/src/witness/util.rs b/evm_arithmetization/src/witness/util.rs index 9973e306f..9fef377ed 100644 --- a/evm_arithmetization/src/witness/util.rs +++ b/evm_arithmetization/src/witness/util.rs @@ -146,15 +146,6 @@ pub(crate) fn mem_write_log( ) } -pub(crate) fn mem_write_log_timestamp_zero( - address: MemoryAddress, - state: &GenerationState, - val: U256, -) -> MemoryOp { - // `Code` corresponds to channel number 0. - MemoryOp::new(MemoryChannel::Code, 0, address, MemoryOpKind::Write, val) -} - pub(crate) fn mem_read_code_with_log_and_fill( address: MemoryAddress, state: &GenerationState,