From 231042acb63133cf55235f9bec28ef13113ce559 Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Thu, 1 Dec 2022 11:21:40 -0800 Subject: [PATCH] Pop --- evm/src/witness/operation.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/evm/src/witness/operation.rs b/evm/src/witness/operation.rs index ee403e90..ea2e4126 100644 --- a/evm/src/witness/operation.rs +++ b/evm/src/witness/operation.rs @@ -118,7 +118,14 @@ pub(crate) fn generate_pop( state: &mut GenerationState, mut row: CpuColumnsView, ) -> Result<(), ProgramError> { - todo!() + if state.registers.stack_len == 0 { + return Err(ProgramError::StackUnderflow); + } + + state.registers.stack_len -= 1; + state.traces.push_memory(log_in0); + state.traces.push_cpu(row); + Ok(()) } pub(crate) fn generate_jump( @@ -193,7 +200,8 @@ pub(crate) fn generate_push( // In any subsequent cycles, we read up to 1 + NUM_GP_CHANNELS bytes. for mut addrs_chunk in &addrs.chunks(1 + NUM_GP_CHANNELS) { let mut row = CpuColumnsView::default(); - // TODO: Set other row fields, like push=1? + row.is_cpu_cycle = F::ONE; + row.op.push = F::ONE; let first_addr = addrs_chunk.next().unwrap(); let (_, first_read) = mem_read_code_with_log_and_fill(first_addr, state, &mut row);