From 84e513df69255177eaeb5254b1b895608ec18bb4 Mon Sep 17 00:00:00 2001 From: Michael Zaikin Date: Wed, 6 Nov 2024 17:40:34 +0000 Subject: [PATCH] Runner: use CairoProgram::assemble_ex for producing bytecode, which includes constants data (#1864) Co-authored-by: Pedro Fontana --- CHANGELOG.md | 3 +++ cairo1-run/src/cairo_run.rs | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 806d9da4d6..9c3abb2a6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ #### [2.0.0-rc0] - 2024-10-22 +* fix: [#1864](https://github.com/lambdaclass/cairo-vm/pull/1864): + * Runner: include data from constants segment to the bytecode when assembling program + * chore: bump `cairo-lang-` dependencies to 2.9.0-dev.0 [#1858](https://github.com/lambdaclass/cairo-vm/pull/1858/files) * chore: update Rust required version to 1.81.0 [#1857](https://github.com/lambdaclass/cairo-vm/pull/1857) diff --git a/cairo1-run/src/cairo_run.rs b/cairo1-run/src/cairo_run.rs index f22a6edd9a..8a293c680e 100644 --- a/cairo1-run/src/cairo_run.rs +++ b/cairo1-run/src/cairo_run.rs @@ -204,10 +204,14 @@ pub fn cairo_run_program( cairo_run_config.copy_to_output(), ); - let data: Vec = instructions - .flat_map(|inst| inst.assemble().encode()) - .map(|x| Felt252::from(&x)) - .map(MaybeRelocatable::from) + // The bytecode includes all program instructions plus entry/footer, + // plus data from the constants segments. + let data: Vec = casm_program + .assemble_ex(&entry_code.instructions, &libfunc_footer) + .bytecode + .into_iter() + .map(Into::::into) + .map(Into::::into) .collect(); let program = if cairo_run_config.proof_mode {