This repository was archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Allow existence of vote on root in saved tower #13135
Merged
ryoqun
merged 1 commit into
solana-labs:master
from
ryoqun:persisted-tower-asserts-root-vote
Oct 26, 2020
Merged
Allow existence of vote on root in saved tower #13135
ryoqun
merged 1 commit into
solana-labs:master
from
ryoqun:persisted-tower-asserts-root-vote
Oct 26, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ryoqun
commented
Oct 24, 2020
Comment on lines
-924
to
-928
| // This is really special, only if tower is initialized (root = slot 0) for genesis and contains | ||
| // a vote (= slot 0) for the genesis, the slot 0 can repeat only once | ||
| let voting_from_genesis = *slot_in_tower == checked_slot && *slot_in_tower == 0; | ||
| // This is really special, only if tower is initialized and contains | ||
| // a vote for the root, the root slot can repeat only once | ||
| let voting_for_root = | ||
| *slot_in_tower == checked_slot && *slot_in_tower == tower_root; | ||
|
|
||
| if !voting_from_genesis { |
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.
Considering this false panic, it's so tempting to just give up this asserting entirely and call self.initialize_lockouts(|v| v.slot > tower_root); and get done by forcibly erasing any odd state. But, I rather want to keep this assertion by tweaking like this.
This is to catch a really ill-state of badly ordered vote account / tower if it ever happens in the future.
Codecov Report
@@ Coverage Diff @@
## master #13135 +/- ##
=========================================
- Coverage 82.1% 81.9% -0.3%
=========================================
Files 372 396 +24
Lines 86530 87057 +527
Branches 0 203 +203
=========================================
+ Hits 71085 71319 +234
- Misses 15445 15689 +244
- Partials 0 49 +49 |
0e37bad to
2072b90
Compare
carllin
approved these changes
Oct 26, 2020
|
good find! |
I'm merging this in spite of the quoted failing build. I'm sure this isn't related to this pr. |
mergify bot
pushed a commit
that referenced
this pull request
Oct 26, 2020
(cherry picked from commit 66c7a98)
ryoqun
added a commit
that referenced
this pull request
Oct 26, 2020
CriesofCarrots
pushed a commit
to CriesofCarrots/solana
that referenced
this pull request
Dec 4, 2020
CriesofCarrots
pushed a commit
to CriesofCarrots/solana
that referenced
this pull request
Dec 4, 2020
CriesofCarrots
pushed a commit
to CriesofCarrots/solana
that referenced
this pull request
Dec 4, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Some persisted tower related assertion incorrectly causes panics.
Currently, we incorrectly don't allow saved tower where root_slot and the first slot in the lockouts is same.
For normal vote accounts on the chain, this cannot be possible to occur.
But for tower, it's possible in this following scenario:
initial tower:
on validator restart (before this pr):
on validator restarrt (after this pr):
Well, I made the assertion too strict because of my misunderstanding....
And this is the example panic.
Summary of Changes
Simply allow such a saved tower because this is completely sane behavior of validator's voting.
Fixes #13128
Context: #10718
This is spin-off of #12671