-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix max_cpu_len_log #714
Fix max_cpu_len_log #714
Conversation
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.
I think we'd rather want to have a warn
/ error
msg about the CPU target length being too small, and set it to NUM_EXTRA_CYCLES_AFTER.next_power_of_two()
or simply abort early.
We need small CPU target length for empty segment tests, where we aim to use the minimal number of CPU cycles in the first segment. |
As mentioned, if you are happy with the current empty table proving test, where we use |
I'm a bit confused because |
This change only affects the behavior when max_cpu_len_log is less than 7, where we cannot represent the full length of the CPU segment. I planed to modify it so that it specifies the maximum actual CPU cycles we want in the CPU table. It would help with the empty segment test, where we aim to use the minimal number of CPU cycles in the segment. |
Anyways, I think we are good with 46 cycles + 82 (NUM_EXTRA_CYCLES_AFTER) in the first segment for empty table testing, so I have made the changes to abort early. |
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.
I think it'd be a tad cleaner to have it as a hard assert!
in the Interpreter initialization (method new()
) which is used for both simulation and actual proving (mentioning assert!
because it's probably not worth changing the method signatures to return a Result
instead of Self
given that this failure case is a hard no-go anyway).
Done |
Address the ‘attempt to subtract with overflow’ issue that occurs when
max_cpu_len_log
is set to a small value (less than 7).This PR will also help with the empty segment test, where we aim to use the minimal number of CPU cycles in the segment.