diff --git a/evm_arithmetization/src/generation/jumpdest.rs b/evm_arithmetization/src/generation/jumpdest.rs index 48d6b613c..dc180c74d 100644 --- a/evm_arithmetization/src/generation/jumpdest.rs +++ b/evm_arithmetization/src/generation/jumpdest.rs @@ -106,6 +106,10 @@ impl JumpDestTableProcessed { let witness_context = *batch_ctx - self.ctx_offset; self.witness_contexts.remove(&witness_context); } + + pub fn max_batch_ctx(&self) -> usize { + self.witness_contexts.keys().max().copied().unwrap_or(0) + } } impl JumpDestTableWitness { diff --git a/evm_arithmetization/src/generation/prover_input.rs b/evm_arithmetization/src/generation/prover_input.rs index 07baacdf2..efeefc563 100644 --- a/evm_arithmetization/src/generation/prover_input.rs +++ b/evm_arithmetization/src/generation/prover_input.rs @@ -826,18 +826,17 @@ impl GenerationState { fn generate_jumpdest_table(&mut self) -> Result<(), ProgramError> { let tx_in_batch_idx = self.next_txn_index - 1; let prev_max_witness_ctx: usize = self - .inputs - .jumpdest_table + .jumpdest_tables .get(tx_in_batch_idx - 1) .map(|x| x.as_ref()) .flatten() .map(|x| x.max_batch_ctx()) .unwrap_or(0); - log::info!("Maximum CTX in previous tx: {}", prev_max_witness_ctx); - log::info!("TXIDX: {}", tx_in_batch_idx); + log::info!("TX BATCH: {:#?}", self.inputs.txn_hashes); log::info!("BATCH LEN: {}", self.inputs.txn_hashes.len()); log::info!("TXN_NUM_BEFORE: {}", self.inputs.txn_number_before); - log::info!("TX BATCH: {:#?}", self.inputs.txn_hashes); + log::info!("Maximum CTX in previous tx: {}", prev_max_witness_ctx); + log::info!("TXIDX: {}", tx_in_batch_idx); log::info!("TX HASH: {:#?}", self.inputs.txn_hashes[tx_in_batch_idx]); let rpcw = self.inputs.jumpdest_table[tx_in_batch_idx].clone(); let rpcp: Option = @@ -860,14 +859,16 @@ impl GenerationState { self.jumpdest_tables[tx_in_batch_idx] = None; let (simp, simw) = simulate_cpu_and_get_user_jumps("terminate_common", &*self) .ok_or(ProgramError::ProverInputError(InvalidJumpdestSimulation))?; - // self.jumpdest_table = Some(simp.clone()); log::info!("SIMW {:#?}", &simw); log::info!("SIMP {:#?}", &simp); - // if let Some(rpcp) = rpcp { - // dbg!(rpcp.as_ref().map(|x| x.normalize()), Some(&simp)); - // assert_eq!(rpcp.is_super(&simp)); - // } + if let Some(rpcp) = rpcp { + if &rpcp != &simp { + log::warn!("MISMATCH"); + dbg!(Some(&rpcp), Some(&simp)); + } + } + self.jumpdest_tables[tx_in_batch_idx] = Some(simp); return Ok(()); } diff --git a/zero/src/bin/rpc.rs b/zero/src/bin/rpc.rs index 5ca8e46a4..5186c668d 100644 --- a/zero/src/bin/rpc.rs +++ b/zero/src/bin/rpc.rs @@ -237,6 +237,7 @@ async fn main() -> anyhow::Result<()> { // With the default configuration trace information is written // to stdout, but we already use stdout to write our payload (the witness). .with_writer(std::io::stderr) + // .json() .with_ansi(false) .with_filter(EnvFilter::from_default_env()), )