diff --git a/zero_bin/ops/src/lib.rs b/zero_bin/ops/src/lib.rs index 30b05609c..9555b41d2 100644 --- a/zero_bin/ops/src/lib.rs +++ b/zero_bin/ops/src/lib.rs @@ -4,14 +4,13 @@ use std::time::Instant; #[cfg(not(feature = "test_only"))] use evm_arithmetization::generation::TrimmedGenerationInputs; use evm_arithmetization::proof::PublicValues; -use evm_arithmetization::prover::SegmentDataIterator; -use evm_arithmetization::GenerationInputs; -#[cfg(not(feature = "test_only"))] -use paladin::operation::FatalStrategy; +#[cfg(feature = "test_only")] +use evm_arithmetization::{prover::testing::simulate_execution_all_segments, GenerationInputs}; use paladin::{ - operation::{FatalError, Monoid, Operation, Result}, + operation::{FatalError, FatalStrategy, Monoid, Operation, Result}, registry, RemoteExecute, }; +#[cfg(feature = "test_only")] use proof_gen::types::Field; use proof_gen::{ proof_gen::{generate_block_proof, generate_segment_agg_proof, generate_transaction_agg_proof}, @@ -30,7 +29,9 @@ registry!(); #[cfg(feature = "test_only")] #[derive(Deserialize, Serialize, RemoteExecute)] -pub struct BatchTestOnly {} +pub struct BatchTestOnly { + pub save_inputs_on_error: bool, +} #[cfg(feature = "test_only")] impl Operation for BatchTestOnly { @@ -38,7 +39,8 @@ impl Operation for BatchTestOnly { type Output = (); fn execute(&self, inputs: Self::Input) -> Result { - let _ = SegmentDataIterator::::new(&inputs.0, Some(inputs.1)).collect::>(); + simulate_execution_all_segments::(inputs.0, inputs.1) + .map_err(|err| FatalError::from_anyhow(err, FatalStrategy::Terminate))?; Ok(()) } diff --git a/zero_bin/prover/src/lib.rs b/zero_bin/prover/src/lib.rs index 02e0bce0c..90f30881a 100644 --- a/zero_bin/prover/src/lib.rs +++ b/zero_bin/prover/src/lib.rs @@ -144,6 +144,12 @@ impl BlockProverInput { use futures::StreamExt; use paladin::directive::{Directive, IndexedStream}; + let ProverConfig { + max_cpu_len_log, + batch_size, + save_inputs_on_error, + } = prover_config; + let block_number = self.get_block_number(); info!("Testing witness generation for block {block_number}."); @@ -151,13 +157,15 @@ impl BlockProverInput { let txs = self.block_trace.into_txn_proof_gen_ir( &ProcessingMeta::new(resolve_code_hash_fn), other_data.clone(), - prover_config.batch_size, + batch_size, )?; - let batch_ops = ops::BatchTestOnly {}; + let batch_ops = ops::BatchTestOnly { + save_inputs_on_error, + }; let simulation = Directive::map( - IndexedStream::from(txs.into_iter().zip(repeat(prover_config.max_cpu_len_log))), + IndexedStream::from(txs.into_iter().zip(repeat(max_cpu_len_log))), &batch_ops, );