Skip to content

Commit

Permalink
Runner: use CairoProgram::assemble_ex for producing bytecode, which i…
Browse files Browse the repository at this point in the history
…ncludes constants data (#1864)

Co-authored-by: Pedro Fontana <[email protected]>
  • Loading branch information
m-kus and pefontana authored Nov 6, 2024
1 parent 39ad790 commit 84e513d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 8 additions & 4 deletions cairo1-run/src/cairo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,14 @@ pub fn cairo_run_program(
cairo_run_config.copy_to_output(),
);

let data: Vec<MaybeRelocatable> = 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<MaybeRelocatable> = casm_program
.assemble_ex(&entry_code.instructions, &libfunc_footer)
.bytecode
.into_iter()
.map(Into::<Felt252>::into)
.map(Into::<MaybeRelocatable>::into)
.collect();

let program = if cairo_run_config.proof_mode {
Expand Down

0 comments on commit 84e513d

Please sign in to comment.