-
Notifications
You must be signed in to change notification settings - Fork 4.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
Remove duplicate SnapshotConfig validation code #32290
Conversation
Instead, use the is_snapshot_config_valid() helper function.
assert!(accounts_hash_interval_slots > 0); | ||
assert!(full_snapshot_archive_interval_slots > 0); | ||
assert!(incremental_snapshot_archive_interval_slots > 0); |
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.
For consistency between solana-validator
and local-cluster tests (or really any other callers), we could move the checks these assertions perform into is_snapshot_config()
valid. Currently, checking that these values are nonzero is done in the CLI parsing / logic in validator/src/main.rs
.
I don't feel too strongly on that point - I care more about ripping out the duplicate logic that we get with is_snapshot_config_valid()
Codecov Report
@@ Coverage Diff @@
## master #32290 +/- ##
=======================================
Coverage 82.0% 82.0%
=======================================
Files 772 772
Lines 209480 209480
=======================================
+ Hits 171863 171889 +26
+ Misses 37617 37591 -26 |
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.
Change looks good to me. It appears that is_snapshot_config_valid
has more strict logic that what was here before, but that's probably reasonable.
A couple of thoughts:
is_snapshot_config_valid
usesSlot::MAX
instead ofDISABLED_SNAPSHOT_ARCHIVE_INTERVAL
- why is
is_snapshot_config_valid
in validator instead of snapshot_config?
Are you potentially looking at your local branch that isn't at tip? here is the tip: Lines 2259 to 2284 in 13aff74
Good point - could shift it to a method on |
🤯 woops. Yeah you're right. |
Historically the only snapshot config validation was done in validator, then slowly added into other places. Also, IIRC, there was divergence on what was valid, depending on validator vs local-cluster tests/etc. Probably fine to make this a method on |
Got it, thanks for the context. I think it is god to have the validation aligned; if there is a strong reason for something in local-cluster to be different, I'm open to it. Otherwise, I think it is better if our test path mirrors the real path as close as possible.
🤝 - Maybe next I'm waiting on a ledger-tool run |
Instead, use the is_snapshot_config_valid() helper function.
Instead, use the is_snapshot_config_valid() helper function.
Instead, use the is_snapshot_config_valid() helper function.
Summary of Changes
Use the is_snapshot_config_valid() helper function instead of repeated logic.