Skip to content

Commit e7be0d8

Browse files
Stavbegabrielbosio
authored andcommitted
add trace not enabled error
1 parent 4c0d860 commit e7be0d8

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
@@ -248,19 +248,13 @@ fn run(args: impl Iterator<Item = String>) -> Result<(), Error> {
248248
}
249249

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

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

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,
@@ -1493,12 +1493,12 @@ impl CairoRunner {
14931493

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

15041504
let relocatable_memory = self

0 commit comments

Comments
 (0)