Skip to content

Commit b85e5c6

Browse files
authored
Stav/remove clone trace (#2127)
2 parents 15de4b2 + 9277002 commit b85e5c6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

CHANGELOG.md

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

33
#### Upcoming Changes
4+
* BREAKING CHANGE: `get_prover_input_info()` now requires `&mut self` and takes ownershop on the trace instead of cloning it. [#2127](https://github.com/lambdaclass/cairo-vm/pull/2127)
5+
46
* Refactor: Replaced HashMap with BTreeMap to guarantee deterministic ordering of the data [#2023] (https://github.com/lambdaclass/cairo-vm/pull/2023)
57

68
* 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)

vm/src/vm/runners/cairo_runner.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,13 +1506,13 @@ impl CairoRunner {
15061506

15071507
/// Collects relevant information for the prover from the runner, including the
15081508
/// relocatable form of the trace, memory, public memory, and built-ins.
1509-
pub fn get_prover_input_info(&self) -> Result<ProverInputInfo, ProverInputInfoError> {
1509+
/// Takes ownership of the trace from the VM.
1510+
pub fn get_prover_input_info(&mut self) -> Result<ProverInputInfo, ProverInputInfoError> {
15101511
let relocatable_trace = self
15111512
.vm
15121513
.trace
1513-
.as_ref()
1514-
.ok_or(ProverInputInfoError::TraceNotEnabled)?
1515-
.clone();
1514+
.take()
1515+
.ok_or(ProverInputInfoError::TraceNotEnabled)?;
15161516

15171517
let relocatable_memory = self
15181518
.vm
@@ -5565,7 +5565,7 @@ mod tests {
55655565
fn get_prover_input_info() {
55665566
let program_content =
55675567
include_bytes!("../../../../cairo_programs/proof_programs/common_signature.json");
5568-
let runner = crate::cairo_run::cairo_run(
5568+
let mut runner = crate::cairo_run::cairo_run(
55695569
program_content,
55705570
&CairoRunConfig {
55715571
trace_enabled: true,
@@ -5658,7 +5658,7 @@ mod tests {
56585658
fn test_output_not_builtin_segment() {
56595659
let program_content =
56605660
include_bytes!("../../../../cairo_programs/proof_programs/split_felt.json");
5661-
let runner = crate::cairo_run::cairo_run(
5661+
let mut runner = crate::cairo_run::cairo_run(
56625662
program_content,
56635663
&CairoRunConfig {
56645664
trace_enabled: true,
@@ -5770,7 +5770,7 @@ mod tests {
57705770
layout: LayoutName::all_cairo_stwo,
57715771
..Default::default()
57725772
};
5773-
let runner = crate::cairo_run::cairo_run(program_content, &config, &mut crate::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor::new_empty()).unwrap();
5773+
let mut runner = crate::cairo_run::cairo_run(program_content, &config, &mut crate::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor::new_empty()).unwrap();
57745774
let prover_input_info = runner.get_prover_input_info().unwrap();
57755775

57765776
// Using bincode.

0 commit comments

Comments
 (0)