Skip to content

Commit b2a9287

Browse files
committed
Remove dependancy in cairo pie when collectiog builtin segments info
1 parent f8e3a82 commit b2a9287

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Cairo-VM Changelog
22

33
#### Upcoming Changes
4+
* fix: Updated the logic for collecting builtin segment data for prover input info, removing dependency on the existence of stop pointers. [#2022](https://github.com/lambdaclass/cairo-vm/pull/2022)
45

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

vm/src/vm/runners/cairo_runner.rs

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,17 +1516,27 @@ impl CairoRunner {
15161516
})
15171517
.collect();
15181518

1519-
let builtins_segments = self
1520-
.get_builtin_segment_info_for_pie()?
1521-
.into_iter()
1522-
.map(|(name, info)| (info.index as usize, name))
1519+
let builtins_segments: Vec<_> = self
1520+
.vm
1521+
.builtin_runners
1522+
.iter()
1523+
.filter(|builtin| {
1524+
!matches!(
1525+
builtin,
1526+
BuiltinRunner::SegmentArena(_) | BuiltinRunner::Output(_)
1527+
)
1528+
})
1529+
.map(|builtin| {
1530+
let (index, _) = builtin.get_memory_segment_addresses();
1531+
(index, builtin.name())
1532+
})
15231533
.collect();
15241534

15251535
Ok(ProverInputInfo {
15261536
relocatable_trace,
15271537
relocatable_memory,
15281538
public_memory_offsets,
1529-
builtins_segments,
1539+
builtins_segments: builtins_segments.into_iter().collect(),
15301540
})
15311541
}
15321542
}
@@ -5595,4 +5605,26 @@ mod tests {
55955605
HashMap::from([(2, BuiltinName::ecdsa)])
55965606
);
55975607
}
5608+
5609+
#[test]
5610+
fn test_output_not_builtin_segment() {
5611+
let program_content =
5612+
include_bytes!("../../../../cairo_programs/proof_programs/split_felt.json");
5613+
let runner = crate::cairo_run::cairo_run(
5614+
program_content,
5615+
&CairoRunConfig {
5616+
trace_enabled: true,
5617+
layout: LayoutName::all_cairo,
5618+
..Default::default()
5619+
},
5620+
&mut BuiltinHintProcessor::new_empty(),
5621+
)
5622+
.unwrap();
5623+
let prover_info = runner.get_prover_input_info().unwrap();
5624+
5625+
assert!(!prover_info
5626+
.builtins_segments
5627+
.values()
5628+
.any(|v| *v == BuiltinName::output));
5629+
}
55985630
}

0 commit comments

Comments
 (0)