Skip to content

Commit

Permalink
Fix: set up builtins initial stack based on program builtins
Browse files Browse the repository at this point in the history
Problem: when using `allow-missing-builtins` for a program, some
builtins requested by the program may not be part of the layout. This
results in an incorrect configuration of the initial stack of the
program as the program will expect pointers for all builtins, even
though it may not access them later down the line. An example of this
is any program that invokes another program (ex: the bootloader).

Solution: copy the Python VM implementation. We now iterate over the
program builtins and set the initial stack of the builtin if it is set
up in the VM and a default value of (0, 0) otherwise. When finalizing
the stack, we iterate over all Cairo builtins and decrement the stack
pointer if the builtin appears in the program and not in the layout.
  • Loading branch information
odesenfans committed Feb 24, 2024
1 parent 3547089 commit c7367cb
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 87 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* fix: set up builtins initial stack based on program builtins [#1632](https://github.com/lambdaclass/cairo-vm/pull/1632)

#### [1.0.0-rc1] - 2024-02-23

* Bump `starknet-types-core` dependency version to 0.0.9 [#1628](https://github.com/lambdaclass/cairo-vm/pull/1628)
Expand Down
Loading

0 comments on commit c7367cb

Please sign in to comment.