Skip to content
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

Keep None memory cells for the prover input info #2021

Merged
merged 1 commit into from
Mar 25, 2025
Merged
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
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

* fix: Keep None values in memory segments for the prover input info [#2021](https://github.com/lambdaclass/cairo-vm/pull/2021)

* refactor: Clap attribute macros from #[clap(...)] to #[arg(...)] and #[command(...)] in v4.x [#2003] (https://github.com/lambdaclass/cairo-vm/pull/2003)

* fix: Fix `WriteReturnFp` error due to a bad loading of initial gas [#2015](https://github.com/lambdaclass/cairo-vm/pull/2015)
Expand Down
16 changes: 11 additions & 5 deletions vm/src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ impl CairoRunner {
.memory
.data
.iter()
.map(|segment| segment.iter().filter_map(|cell| cell.get_value()).collect())
.map(|segment| segment.iter().map(|cell| cell.get_value()).collect())
.collect();

let public_memory_offsets = self
Expand Down Expand Up @@ -1540,8 +1540,8 @@ impl CairoRunner {
pub struct ProverInputInfo {
/// A vector of trace entries, i.e. pc, ap, fp, where pc is relocatable.
pub relocatable_trace: Vec<TraceEntry>,
/// A vector of segments, where each segment is a vector of maybe relocatable values.
pub relocatable_memory: Vec<Vec<MaybeRelocatable>>,
/// A vector of segments, where each segment is a vector of maybe relocatable values or holes (`None`).
pub relocatable_memory: Vec<Vec<Option<MaybeRelocatable>>>,
/// A map from segment index to a vector of offsets within the segment, representing the public memory addresses.
pub public_memory_offsets: HashMap<usize, Vec<usize>>,
/// A map from the builtin segment index into its name.
Expand Down Expand Up @@ -5581,8 +5581,14 @@ mod tests {
offset: 0,
});
assert_eq!(prover_info.relocatable_trace, expected_trace);
assert_eq!(prover_info.relocatable_memory[0][3], expected_in_memory_0_3);
assert_eq!(prover_info.relocatable_memory[1][0], expected_in_memory_1_0);
assert_eq!(
prover_info.relocatable_memory[0][3],
Some(expected_in_memory_0_3)
);
assert_eq!(
prover_info.relocatable_memory[1][0],
Some(expected_in_memory_1_0)
);
assert!(prover_info.public_memory_offsets.is_empty());
assert_eq!(
prover_info.builtins_segments,
Expand Down
Loading