Skip to content

add trace not enabled error #2080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: stav/move_prover_input_info_to_seperate_file
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions cairo-vm-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,13 @@
}

if let Some(path) = args.prover_input_info {
let prover_input_info = cairo_runner.get_prover_input_info().map_err(|error| {
eprintln!("{error}");
CairoRunError::Runner(error)
})?;
let prover_input_info = cairo_runner.get_prover_input_info()?;
let bytes = prover_input_info.serialize()?;
std::fs::write(path, bytes)?;
}

if let Some(path) = args.prover_input_info_json {
let prover_input_info = cairo_runner.get_prover_input_info().map_err(|error| {
eprintln!("{error}");
CairoRunError::Runner(error)
})?;
let prover_input_info = cairo_runner.get_prover_input_info()?;

Check warning on line 256 in cairo-vm-cli/src/main.rs

View check run for this annotation

Codecov / codecov/patch

cairo-vm-cli/src/main.rs#L256

Added line #L256 was not covered by tests
let json = prover_input_info.serialize_json()?;
std::fs::write(path, json)?;
}
Expand Down
3 changes: 2 additions & 1 deletion vm/src/prover_input_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ impl ProverInputInfo {
}
}

// TODO(Stav): add TraceNotEnabled error.
#[derive(Debug, Error)]
pub enum ProverInputInfoError {
#[error("Failed to (de)serialize data using bincode")]
SerdeBincode(#[from] bincode::error::EncodeError),
#[error("Failed to (de)serialize data using json")]
SerdeJson(#[from] serde_json::Error),
#[error("Trace was not enabled")]
TraceNotEnabled,
}
6 changes: 3 additions & 3 deletions vm/src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{

use crate::{
hint_processor::hint_processor_definition::{HintProcessor, HintReference},
prover_input_info::ProverInputInfo,
prover_input_info::{ProverInputInfo, ProverInputInfoError},
types::{
errors::{math_errors::MathError, program_errors::ProgramError},
exec_scope::ExecutionScopes,
Expand Down Expand Up @@ -1491,12 +1491,12 @@ impl CairoRunner {

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

let relocatable_memory = self
Expand Down
Loading