-
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
Conversation
console/network/src/lib.rs
Outdated
const MAX_PROGRAM_DEPTH: usize = 1024; | ||
/// The maximum number of imports. | ||
const MAX_IMPORTS: usize = 2048; |
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
reads program2
reads ... reads program32
If we program0
to reads program1
, then we need a greater MAX_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
One question less related this issue: Would it be better to set a larger 'TRANSACTION_DEPTH', (e.g. 8)? This will make it easier to increase 'MAX_TRANSITION' in the future. We can still keep 'MAX_TRANSITION' as 32 for now. |
This has problems because it will change the Merklization to be much slower, and require a larger inclusion circuit for proving. Ultimately, these impact runtime for transaction generation. |
This PR,
MAX_TRANSITIONS - 1
calls.get_number_of_function_calls
.