-
Notifications
You must be signed in to change notification settings - Fork 198
Resolve constants by full path #2192
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
Draft
JulianGCalderon
wants to merge
20
commits into
2.x.y
Choose a base branch
from
resolve-constants-by-full-path
base: 2.x.y
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
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c4c6643
Add support for accessible scopes
JulianGCalderon 0eb7bc9
Add constant_collision.cairo example
JulianGCalderon a9177ea
Pass identifiers instead of only constants to hint data
JulianGCalderon a508094
Modify functions that already used get_constant_from_var
JulianGCalderon 6c5b43f
Import String
JulianGCalderon 4a8eba3
Update changelog
JulianGCalderon aea7959
Minor improvement to code
JulianGCalderon 737f9d4
Adapt other methods
JulianGCalderon 572a083
Remove local variables from Cairo program
JulianGCalderon 573cc47
Properly implements the alias resolution - fix tests
JulianGCalderon fe3e707
Implement get_identifier_from_scoped_name
JulianGCalderon 9b35055
Improve identifier lookup
JulianGCalderon e2dfdb2
Remove unused function!
JulianGCalderon 04524d0
Use stdlib HashSet
JulianGCalderon 1225b2d
Add box
JulianGCalderon d993cac
Replace break with return for clarity
JulianGCalderon 4343976
Restore split_felt_bad_constants
JulianGCalderon f62696e
Only take into account constants and aliases
JulianGCalderon a874df7
Rename function!
JulianGCalderon 93be705
Format
JulianGCalderon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
%builtins range_check | ||
|
||
from starkware.cairo.common.math import assert_le | ||
from starkware.cairo.common.math import split_felt | ||
|
||
func override_constants{range_check_ptr}() { | ||
const MAX_HIGH = -1; | ||
const MAX_LOW = -1; | ||
return (); | ||
} | ||
func split_felt_ok{range_check_ptr}(value) -> (high: felt, low: felt) { | ||
const MAX_HIGH = (-1) / 2 ** 128; | ||
const MAX_LOW = 0; | ||
let low = [range_check_ptr]; | ||
let high = [range_check_ptr + 1]; | ||
let range_check_ptr = range_check_ptr + 2; | ||
|
||
%{ | ||
from starkware.cairo.common.math_utils import assert_integer | ||
assert ids.MAX_HIGH < 2**128 and ids.MAX_LOW < 2**128 | ||
assert PRIME - 1 == ids.MAX_HIGH * 2**128 + ids.MAX_LOW | ||
assert_integer(ids.value) | ||
ids.low = ids.value & ((1 << 128) - 1) | ||
ids.high = ids.value >> 128 | ||
%} | ||
|
||
assert value = high * (2 ** 128) + low; | ||
if (high == MAX_HIGH) { | ||
assert_le(low, MAX_LOW); | ||
} else { | ||
assert_le(high, MAX_HIGH - 1); | ||
} | ||
return (high=high, low=low); | ||
} | ||
|
||
func main{range_check_ptr: felt}() { | ||
let (m, n) = split_felt_ok(5784800237655953878877368326340059594760); | ||
assert m = 17; | ||
assert n = 8; | ||
return (); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.