Skip to content

Commit 547dca1

Browse files
committed
add trace not enabled error
1 parent a5b3c9d commit 547dca1

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

cairo-vm-cli/src/main.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,13 @@ fn run(args: impl Iterator<Item = String>) -> Result<(), Error> {
247247
}
248248

249249
if let Some(path) = args.prover_input_info {
250-
let prover_input_info = cairo_runner.get_prover_input_info().map_err(|error| {
251-
eprintln!("{error}");
252-
CairoRunError::Runner(error)
253-
})?;
250+
let prover_input_info = cairo_runner.get_prover_input_info()?;
254251
let bytes = prover_input_info.serialize()?;
255252
std::fs::write(path, bytes)?;
256253
}
257254

258255
if let Some(path) = args.prover_input_info_json {
259-
let prover_input_info = cairo_runner.get_prover_input_info().map_err(|error| {
260-
eprintln!("{error}");
261-
CairoRunError::Runner(error)
262-
})?;
256+
let prover_input_info = cairo_runner.get_prover_input_info()?;
263257
let json = prover_input_info.serialize_json()?;
264258
std::fs::write(path, json)?;
265259
}

vm/src/prover_input_info.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ impl ProverInputInfo {
3333
}
3434
}
3535

36-
// TODO(Stav): add TraceNotEnabled error.
3736
#[derive(Debug, Error)]
3837
pub enum ProverInputInfoError {
3938
#[error("Failed to (de)serialize data using bincode")]
4039
SerdeBincode(#[from] bincode::error::EncodeError),
4140
#[error("Failed to (de)serialize data using json")]
4241
SerdeJson(#[from] serde_json::Error),
42+
#[error("Trace was not enabled")]
43+
TraceNotEnabled,
4344
}

vm/src/vm/runners/cairo_runner.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818

1919
use crate::{
2020
hint_processor::hint_processor_definition::{HintProcessor, HintReference},
21-
prover_input_info::ProverInputInfo,
21+
prover_input_info::{ProverInputInfo, ProverInputInfoError},
2222
types::{
2323
errors::{math_errors::MathError, program_errors::ProgramError},
2424
exec_scope::ExecutionScopes,
@@ -1492,12 +1492,12 @@ impl CairoRunner {
14921492

14931493
/// Collects relevant information for the prover from the runner, including the
14941494
/// relocatable form of the trace, memory, public memory, and built-ins.
1495-
pub fn get_prover_input_info(&self) -> Result<ProverInputInfo, RunnerError> {
1495+
pub fn get_prover_input_info(&self) -> Result<ProverInputInfo, ProverInputInfoError> {
14961496
let relocatable_trace = self
14971497
.vm
14981498
.trace
14991499
.as_ref()
1500-
.ok_or(RunnerError::Trace(TraceError::TraceNotEnabled))?
1500+
.ok_or(ProverInputInfoError::TraceNotEnabled)?
15011501
.clone();
15021502

15031503
let relocatable_memory = self

0 commit comments

Comments
 (0)