-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[HackerOne-2354265] Restrict number of imports, program depth, and call depth. #2352
Merged
+378
−22
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
23b3343
Add MAX_CALL_DEPTH and MAX_IMPORT_DEPTH
d0cd 8e33429
Add bound on number of imports in a program
d0cd 44aeb08
Cache number of function calls
d0cd bcd21c6
Restrict maximum nmber of calls to MAX_TRANSITIONS on Stack::initialize
d0cd adc7859
Restrict program depth
d0cd 48cfe4c
Update MAX_IMPORTS
d0cd 09a82d2
Merge branch 'mainnet' into fix/import-depth
d0cd c342108
Fix test
d0cd 38a05d9
Address feedback
d0cd 4e7c4f4
Add benches
d0cd 6c8441c
Add Cargo.lock
d0cd 5fce390
Merge branch 'mainnet' into fix/import-depth
d0cd 9c83b3b
Reduce MAX_IMPORTS AND PROGRAM_DEPTH
d0cd 84ca922
Parameterize tests
d0cd 6bbf84d
Fix test
d0cd 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 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 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 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 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 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide some context on why these depths and imports are where they're at?
Based on our design, I believe we're constraining other parameters already at the 32 mark. It would make sense to constraint both of these parameters alongside the 32 mark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
MAX_PROGRAM_DEPTH
was decided based off of Ethereum's MAX_CALL_DEPTH.I went with this as a healthy upper bound. I see no issue with restricting
MAX_PROGRAM_DEPTH
to 32.MAX_IMPORTS
should be larger because a user may want to create a program that reads the mappings of a large number of other programs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah actually, suppose that
program1
readsprogram2
reads ... readsprogram32
If we
program0
to readsprogram1
, then we need a greaterMAX_PROGRAM_DEPTH
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline, waiting for a change to 64 and 64