-
Notifications
You must be signed in to change notification settings - Fork 311
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
Do not run elapsed slots loop in tests #2411
Conversation
#[cfg(not(feature = "dev-context-only-utils"))] | ||
let run_loop = true; | ||
|
||
if self.epoch.saturating_sub(account_rent_epoch) > 2u64.saturating_pow(30) { |
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.
why was 2^30 chosen?
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.
2^30 still executes quickly. 2^35 takes more than a minute.
#[cfg(feature = "dev-context-only-utils")] | ||
let mut run_loop = true; | ||
#[cfg(not(feature = "dev-context-only-utils"))] | ||
let run_loop = true; |
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.
ok, so non-test cases (ie. normal validator), we will always run the loop.
Does the fuzzer run the validator (or sub-pieces) with dev-context-only-utils
?
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.
Yes, it does.
My preference is to have the test work around the production code, instead of vice versa. Is is possible to reduce the range for the epochs in the fuzzer? |
Yes, I can follow this approach. |
I'll follow @brooksprumo's advice to limit the range of rent epochs in the fuzzer. |
Problem
A loop that calculates the number of elapsed slots between two epochs depend on the difference between the start and the end epoch:
agave/sdk/src/rent_collector.rs
Line 93 in bb70670
This loop can get quite slow (>20 minutes) if the difference between them is too large (around 2^40). Although this case may not happen on the network, it slows down fuzzing efforts.
Summary of Changes
I added a condition to avoid running the loop when the number of iterations is too high.