Do not wait for startup verification before calling shrink in ABS#6402
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6402 +/- ##
=========================================
- Coverage 82.8% 82.8% -0.1%
=========================================
Files 848 848
Lines 379488 379481 -7
=========================================
- Hits 314544 314509 -35
- Misses 64944 64972 +28 🚀 New features to boost your workflow:
|
|
is this a simplifying change or does it unblock something? |
Currently it's just for simplifying. But overall it is meant to make it easier to reason about this ABS loop, which makes it easier to prove we've fixed #6295.
100%
Yes. Please see the "Justification" part in the PR description that shows where we grab the storages for startup verification. We didn't used to do that, which is why we needed to gate calling
Yes, thank you. I want to make sure I don't forget anything from the past either! One reason I wanted your review on this one too. |
588426f to
7f1b574
Compare
|
Had to resolve merge conflicts due to #6396, hence the force-push. No code was changed. |
|
Master is broken, so CI is failing. Will need to rebase again once a fix is merged. Edit: PR #6412 is the fix. |
7f1b574 to
843e902
Compare
Problem
AccountsBackgroundService conditionally calls
shrinkbased on if startup verification is complete or not, but this is no longer necessary.Originally, we didn't want to shrink in ABS until startup verification was complete because we needed to ensure the startup accounts hash calculation was able to get the right storages. If shrink was called before the accounts hash calculation was run, then accounts could be removed, which could cause startup verification to erroneously fail due to calculating a different hash. Here's the PR where we added the conditional around
shrink: solana-labs#34209 (and it includes reasoning why this impl was chosen vs getting the storages early and passing them intoverify_accounts_hash()).Now, startup verification grabs the storages before verification even begins, so there is no risk of those storages getting removed/changed. This means we can unconditionally shrink in ABS.
Summary of Changes
Unconditionally shrink in ABS.
Justification
We load blockstore (i.e. create bank/bank forks) before creating AccountsBackgroundService (top of this snippet is where we create bank forks, and the bottom of the snippet is where we create AccountsBackgroundService):
agave/core/src/validator.rs
Lines 785 to 925 in 6fcda9b
After loading the bank we do verification. In this snippet we see that accounts verification is the first thing called:
agave/runtime/src/bank.rs
Lines 5993 to 6037 in 6fcda9b
Inside accounts verification we get the snapshot storages (added in #1202, which is the "proper" fix as described in solana-labs#34209):
agave/runtime/src/bank.rs
Lines 5518 to 5521 in 6fcda9b
These snippets are meant to show that we do hold the storages required for account verification before ABS can be called, this rendering the PR safe.