forked from lambdaclass/cairo-vm
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Always use a normal segment for first SegmentArena segment #45
Draft
notlesh
wants to merge
10
commits into
notlesh/snos-rc-2024-09-13
Choose a base branch
from
notlesh/segment-arena-relocation-fix
base: notlesh/snos-rc-2024-09-13
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Always use a normal segment for first SegmentArena segment #45
notlesh
wants to merge
10
commits into
notlesh/snos-rc-2024-09-13
from
notlesh/segment-arena-relocation-fix
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We've discovered that using the `cairo-vm` crate in our projects brings in a lot of unnecessary dependencies and in the end leads to our binary being linked with the `libbz2` library. Turns out that neither of these is actually required and this happens because the `zip` crate has a large number of features enabled by default. This change disables all `zip` features except `deflate` which the code actually uses.
* Fix Zero segment location. * Fixed has_zero_segment naming * Fix prover input. * Fixed version reading when no version is supplied * Added change to changelog. * fix test_from_serializable() * fix panic_impl error * fix cairo version * remove outdated test * Enable ensure-no_std on test * Add correct test * Rename tset * Add comment --------- Co-authored-by: Alon Titelman <[email protected]> Co-authored-by: Omri Eshhar <[email protected]> Co-authored-by: Julián González Calderón <[email protected]> Co-authored-by: OmriEshhar1 <[email protected]>
* update cairo-lang to 2.8.0 * working * format * typo * fix lints * update rusttoolchain * remove duplicated imports * remove unused imports * remove zip unused dependencies * uncomment * undo dependecy upgrade * update readme --------- Co-authored-by: Pedro Fontana <[email protected]>
* Update pip cairo-lang to 0.13.2 * Update CHANGELOG --------- Co-authored-by: Pedro Fontana <[email protected]>
Benchmark Results for unmodified programs 🚀
|
* Add debug scripts * Add debugging document * Add changelog * Revert changelog * Improve script usage code blocks * Remove extra space
* Fix Zero segment location. * Fixed has_zero_segment naming * Fix prover input. * Fixed version reading when no version is supplied * Added change to changelog. * fix test_from_serializable() * fix panic_impl error * fix cairo version * remove outdated test * Enable ensure-no_std on test * Add correct test * Rename tset * Add comment --------- Co-authored-by: Alon Titelman <[email protected]> Co-authored-by: Omri Eshhar <[email protected]> Co-authored-by: Julián González Calderón <[email protected]> Co-authored-by: OmriEshhar1 <[email protected]>
6 tasks
Benchmark Results for modified programs 🚀
|
* add default value for MAX_HIGH and MAX_LOW * update tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: Starknet OS expects SegmentArena segments to all be temporary except the first segment, which must be normal. This is so that relocation rules for all segments can chain back into the first.
Solution: Use temporary segments only if it's not the first.
Description
The Starknet OS verifies the continuity of the segments in
SegmentArena
s here, which requires relocation rules to be properly set up.The requirements for this to work are that each
src_ptr
is a temporary segment and eachdest_ptr
is a non-temporary segment (or a temporary segment with an existing rule mapping it to a non-temporary segment).cairo-vm
uses a number of hints to accomplish this, and these are injected by the sierra-to-casm compiler. However, it relies on one additional hint which is not injected anywhere in the case of SNOS.This hint seems to ensure the same condition needed in SNOS: that the initial segment is a normal segment and that all other segments are temporary segments with relocation rules pointing back to the initial one.
SNOS handles this by simply allocating the initial segment as a normal one as explained here. This seems to alleviate the need to later recreate the segment in
relocate_all_segments()
, allowing the implementation to work in SNOS without the hint mentioned above.Checklist