Skip to content

Commit 5b08179

Browse files
committed
Keep None memory cells for the prover input info
1 parent 3aed532 commit 5b08179

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#### Upcoming Changes
44

5+
* fix: Keep None values in memory segments for the prover input info [#2021](https://github.com/lambdaclass/cairo-vm/pull/2021)
6+
57
* refactor: Clap attribute macros from #[clap(...)] to #[arg(...)] and #[command(...)] in v4.x [#2003] (https://github.com/lambdaclass/cairo-vm/pull/2003)
68

79
* fix: Fix `WriteReturnFp` error due to a bad loading of initial gas [#2015](https://github.com/lambdaclass/cairo-vm/pull/2015)

vm/src/vm/runners/cairo_runner.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ impl CairoRunner {
15021502
.memory
15031503
.data
15041504
.iter()
1505-
.map(|segment| segment.iter().filter_map(|cell| cell.get_value()).collect())
1505+
.map(|segment| segment.iter().map(|cell| cell.get_value()).collect())
15061506
.collect();
15071507

15081508
let public_memory_offsets = self
@@ -1540,8 +1540,8 @@ impl CairoRunner {
15401540
pub struct ProverInputInfo {
15411541
/// A vector of trace entries, i.e. pc, ap, fp, where pc is relocatable.
15421542
pub relocatable_trace: Vec<TraceEntry>,
1543-
/// A vector of segments, where each segment is a vector of maybe relocatable values.
1544-
pub relocatable_memory: Vec<Vec<MaybeRelocatable>>,
1543+
/// A vector of segments, where each segment is a vector of maybe relocatable values or holes (`None`).
1544+
pub relocatable_memory: Vec<Vec<Option<MaybeRelocatable>>>,
15451545
/// A map from segment index to a vector of offsets within the segment, representing the public memory addresses.
15461546
pub public_memory_offsets: HashMap<usize, Vec<usize>>,
15471547
/// A map from the builtin segment index into its name.
@@ -5581,8 +5581,14 @@ mod tests {
55815581
offset: 0,
55825582
});
55835583
assert_eq!(prover_info.relocatable_trace, expected_trace);
5584-
assert_eq!(prover_info.relocatable_memory[0][3], expected_in_memory_0_3);
5585-
assert_eq!(prover_info.relocatable_memory[1][0], expected_in_memory_1_0);
5584+
assert_eq!(
5585+
prover_info.relocatable_memory[0][3],
5586+
Some(expected_in_memory_0_3)
5587+
);
5588+
assert_eq!(
5589+
prover_info.relocatable_memory[1][0],
5590+
Some(expected_in_memory_1_0)
5591+
);
55865592
assert!(prover_info.public_memory_offsets.is_empty());
55875593
assert_eq!(
55885594
prover_info.builtins_segments,

0 commit comments

Comments
 (0)