-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add initializeSegments method logic #3
Comments
Closed
i am going through it. can you assign me this? |
Hey @jaipaljadeja, I went through this issue and found it to be doable. If you are not working on this, can I pick this up? |
@ClementWalter can you assign this to kennee please? |
Thank you jaipaal. Appreciate it! |
@KeneePatel it's yours now |
Merged
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why
The Cairo VM uses memory segments to track values. In short and almost true, a memory segment is just a list of values, ie. here a list of
felt
(felt
is the only native type of cairo, think offelt
asuint252
).A run of the VM actually consists in filling values in memory segments; allocating a segment just means creating an empty list at index i in the segments manager of the VM, much like
could be a memory with 3 initialized segments (with indexes 0, 1 and 42).
Segments can be allocated during the run (when the dev uses the
alloc()
function) or by the VM itself at the beginning of a run for given builtins. In cairo0, these builtins are declared at the tile level using the% builtin
directive, and at the function level using corresponding implicit arguments.The list of builtins actually available is:
Each builtin requires its own memory segment as these builtins actually enforces some rules over the segment. For example, the
range_check
segment will enforce that every values contained in this segment are actually no greater than2**128
.Consequently, when initializing the VM for running a program, one needs to create as much memory segments as required.
What
The Cairo VM gs uses native sheet columns as memory segments.
The function should add the corresponding column with their header as names next to the
Execution
columnHow
Follow the python VM https://github.com/starkware-libs/cairo-lang/blob/efa9648f57568aad8f8a13fbf027d2de7c63c2c0/src/starkware/cairo/lang/vm/cairo_runner.py#L216
Note that program_base is always the first segment, and Execution the second.
Add a menu in the UI to actually trigger the call
The CairoVM will for now only run the main entrypoint, so the final fp and pc segments should be added last, and their reference be added in the execution segment.
The text was updated successfully, but these errors were encountered: