Skip to content

Commit

Permalink
Add explicit panic message
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Jul 27, 2024
1 parent c84b723 commit 40f594b
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions evm_arithmetization/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,8 @@ impl<F: RichField> SegmentDataIterator<F> {

// Run the interpreter to get `registers_after` and the partial data for the
// next segment.
if let Ok((updated_registers, mem_after)) =
set_registers_and_run(segment_data.registers_after, &mut self.interpreter)
{
let run = set_registers_and_run(segment_data.registers_after, &mut self.interpreter);
if let Ok((updated_registers, mem_after)) = run {
let partial_segment_data = Some(build_segment_data(
segment_index + 1,
Some(updated_registers),
Expand All @@ -578,9 +577,27 @@ impl<F: RichField> SegmentDataIterator<F> {
segment_data.registers_after = updated_registers;
Some((segment_data, partial_segment_data))
} else {
panic!("Segment generation failed");
let inputs = &self.interpreter.get_generation_state().inputs;
let block = inputs.block_metadata.block_number;
let txn_range = match inputs.txn_hashes.len() {
0 => "Dummy".to_string(),
1 => format!("{:?}", inputs.txn_number_before),
_ => format!(
"{:?}_{:?}",
inputs.txn_number_before,
inputs.txn_number_before + inputs.txn_hashes.len()
),
};
panic!(
"Segment generation {:?} for block {:?} ({}) failed with error {:?}",
segment_index,
block,
txn_range,
run.unwrap_err()
);
}
}
}
}

impl<F: RichField> Iterator for SegmentDataIterator<F> {
Expand Down

0 comments on commit 40f594b

Please sign in to comment.