Skip to content

Commit

Permalink
stav: extract information for the prover from the runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Stavbe committed Mar 5, 2025
1 parent 3de653d commit 192dff9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* feat: Add `ProverInfo` and extract the relevant information for it from the runner [#1982](https://github.com/lambdaclass/cairo-vm/pull/1982)

#### [2.0.0] - 2025-02-26

* fix: Check overflow in cairo pie address calculation [#1945](https://github.com/lambdaclass/cairo-vm/pull/1945)
Expand Down
22 changes: 22 additions & 0 deletions vm/src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,28 @@ impl CairoRunner {
})
.collect()
}

pub fn get_info_for_prover_input(&self) -> Result<ProverInfo, RunnerError> {
Ok(ProverInfo {
relocatble_trace: self
.vm
.trace.clone()
.ok_or(RunnerError::Trace(TraceError::TraceNotEnabled))?,
relocatble_memory: self.vm.segments.memory.data.clone(),
public_memory_addresses: self.vm.segments.public_memory_offsets.clone(),
builtins_segments: self.get_builtin_segment_info_for_pie()?
})
}
}

//* ----------------------
//* ProverInfo
//* ----------------------
pub struct ProverInfo {
pub relocatble_trace: Vec<TraceEntry>,
pub relocatble_memory: Vec<Vec<MemoryCell>>,
pub public_memory_addresses: HashMap<usize, Vec<(usize, usize)>>,
pub builtins_segments: HashMap<BuiltinName, cairo_pie::SegmentInfo>,
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down

0 comments on commit 192dff9

Please sign in to comment.