-
Notifications
You must be signed in to change notification settings - Fork 636
Adds --recalculate-accounts-lt-hash to leder-tool create-snapshot
#7305
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7305 +/- ##
=========================================
- Coverage 82.8% 82.8% -0.1%
=========================================
Files 801 801
Lines 363392 363410 +18
=========================================
- Hits 300960 300954 -6
- Misses 62432 62456 +24 🚀 New features to boost your workflow:
|
runtime/src/snapshot_minimizer.rs
Outdated
&bank, | ||
bank.slot(), | ||
DashSet::from_iter([pubkey_to_keep]), | ||
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.
should we add a test with false
so it doesn't break?
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.
Yeah, I can add that. I didn't think it was very valuable, as then it's a "regular" snapshot load. Wdyt? Just for test coverage? Or should I check the accounts lt hash remains unchanged?
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.
yeah think just check the lt hash remains unchanged if we have that option. and IS changed if the option is there?
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.
Done in 25fe7e2.
ledger-tool/src/main.rs
Outdated
@@ -1463,6 +1469,21 @@ fn main() { | |||
.value_name("ENDING_SLOT") | |||
.help("Ending slot for minimized snapshot creation"), | |||
) | |||
.arg( | |||
Arg::with_name("no_recalculate_accounts_lt_hash") |
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.
Kind of curious about default behavior here.
Is it better to have not recalculate by default? Seems that was effectively the original intention of minimized snapshots - make sure you get same result as network but just faster to replicate replay of slot range.
recaclulating it serves a different purpose - it's effectively creating a new self-contained snapshot to start from.
wdyt?
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.
Yeah... I guess it depends on what the main usage of minimized snapshots is then.
We could revert the PR that added the accounts lt hash recalculation. Note that this means loading the minimized snapshots will always fail the startup accounts verification, and the user must then pass a hidden cli flag to skip this startup verification.
With recalculation, then loading the minimized snapshot will succeed, but bank hashes will be different. Are there use cases where people want this? The minimized snapshot could still be used to process the transactions from the ledger, and basically everything other than the bank hash.
I dunno which one to prioritize though. Who's the right person to make this call?
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.
With recalculation, then loading the minimized snapshot will succeed, but bank hashes will be different. Are there use cases where people want this? The minimized snapshot could still be used to process the transactions from the ledger, and basically everything other than the bank hash.
I'm not aware of any uses cases. Even if you are playing the "user" transactions properly, having an incorrect bank hash will lead to votes getting dropped in subsequent slots. I think Andrew's comment captures the intent of this feature:
"make sure you get same result as network but just faster to replicate replay of slot range."
We could revert the PR that added the accounts lt hash recalculation. Note that this means loading the minimized snapshots will always fail the startup accounts verification, and the user must then pass a hidden cli flag to skip this startup verification.
Is there any way to tell a minimized snapshot from a regular snapshot ? I don't believe there is, but figured I'd ask to make sure as this would make things easier
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'm not aware of any uses cases. Even if you are playing the "user" transactions properly, having an incorrect bank hash will lead to votes getting dropped in subsequent slots. I think Andrew's comment captures the intent of this feature: "make sure you get same result as network but just faster to replicate replay of slot range."
Maybe this means we revert the change to alway recalculate then?
Is there any way to tell a minimized snapshot from a regular snapshot ? I don't believe there is, but figured I'd ask to make sure as this would make things easier
Not that I'm aware of, unfortunately. Otherwise we could programmatically skip the startup accounts verification.
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.
My gut tells me if we revert we may find someone does want the forced recalculation case. Maybe we just reverse the CLI option you have here to do the recalc instead of skip it?
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.
Maybe we just reverse the CLI option you have here to do the recalc instead of skip it?
That works for me.
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.
Done. The CLI option has been reversed in 340a465.
leder-tool create-snapshot
leder-tool create-snapshot
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
Problem
Creating a minimized snapshot with
ledger-tool create-snapshot
breaks firedancer's regression testing, because we currently recalculate the accounts lt hash. Since we recalculate the accounts lt hash, this causes the bank hashes to change. And since FD is testing against known/expected bank hashes, their tests fail.See #7087 for more context.
Summary of Changes
Switches the default to not recalculate the accounts lt hash, and adds
--recalculate-accounts-lt-hash
toleder-tool create-snapshot
when creating a minimized snapshot, which does recalculate the accounts lt hash.Fixes #7087
Note, since this issue is in v2.3, I plan to backport as well.