From 417ca3d883f72dcf85626ce4a8b8b52aa8a6092b Mon Sep 17 00:00:00 2001 From: Sai Deng Date: Thu, 10 Oct 2024 22:09:08 -0700 Subject: [PATCH] fix --- evm_arithmetization/src/generation/state.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/evm_arithmetization/src/generation/state.rs b/evm_arithmetization/src/generation/state.rs index 0fefc624d..2bf47d4e6 100644 --- a/evm_arithmetization/src/generation/state.rs +++ b/evm_arithmetization/src/generation/state.rs @@ -185,14 +185,18 @@ pub(crate) trait State { { let halt_offsets = self.get_halt_offsets(); - let cycle_limit = max_cpu_len_log.map(|max_len_log| { - let target_len = 1 << max_len_log; - if target_len > NUM_EXTRA_CYCLES_AFTER { - target_len - NUM_EXTRA_CYCLES_AFTER - } else { - target_len + if let Some(max_len_log) = max_cpu_len_log { + if (1 << max_len_log) < NUM_EXTRA_CYCLES_AFTER { + bail!( + "Target length (2^{}) is less than NUM_EXTRA_CYCLES_AFTER ({})", + max_len_log, + NUM_EXTRA_CYCLES_AFTER + ); } - }); + } + + let cycle_limit = + max_cpu_len_log.map(|max_len_log| (1 << max_len_log) - NUM_EXTRA_CYCLES_AFTER); let mut final_registers = RegistersState::default(); let mut running = true;