-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Update is_locked_out cache when adopting on chain vote state #33341
Update is_locked_out cache when adopting on chain vote state #33341
Conversation
e167aca
to
9558abd
Compare
Codecov Report
@@ Coverage Diff @@
## master #33341 +/- ##
=======================================
Coverage 81.9% 81.9%
=======================================
Files 798 798
Lines 216579 216642 +63
=======================================
+ Hits 177481 177572 +91
+ Misses 39098 39070 -28 |
core/src/replay_stage.rs
Outdated
for slot in frozen_banks.iter().map(|b| b.slot()) { | ||
let stats = progress | ||
.get_fork_stats_mut(slot) | ||
.expect("All frozen banks must exist in the Progress map"); | ||
stats.is_locked_out = tower.is_locked_out( | ||
slot, | ||
ancestors | ||
.get(&slot) | ||
.expect("Ancestors map should contain slot for is_locked_out() check"), | ||
); |
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.
this is a good catch!
Don't all of these tower based checks
solana/core/src/replay_stage.rs
Lines 3252 to 3261 in 9558abd
stats.vote_threshold = | |
tower.check_vote_stake_threshold(bank_slot, &stats.voted_stakes, stats.total_stake); | |
stats.is_locked_out = tower.is_locked_out( | |
bank_slot, | |
ancestors | |
.get(&bank_slot) | |
.expect("Ancestors map should contain slot for is_locked_out() check"), | |
); | |
stats.has_voted = tower.has_voted(bank_slot); | |
stats.is_recent = tower.is_recent(bank_slot); |
Might be easier to move all those tower-based checks into a separate function that we can call from both places so that we don't miss this in the future for any added checks
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.
good catch, added all of these as well
9558abd
to
d897b2f
Compare
d897b2f
to
8f00433
Compare
* Update is_locked_out cache when adopting on chain vote state * extend to all cached tower checks * upgrade error to panic (cherry picked from commit 85cc6ac) # Conflicts: # core/src/consensus.rs
* Update is_locked_out cache when adopting on chain vote state * extend to all cached tower checks * upgrade error to panic (cherry picked from commit 85cc6ac) # Conflicts: # core/src/consensus.rs
…backport of #33341) (#33402) * Update is_locked_out cache when adopting on chain vote state (#33341) * Update is_locked_out cache when adopting on chain vote state * extend to all cached tower checks * upgrade error to panic (cherry picked from commit 85cc6ac) # Conflicts: # core/src/consensus.rs * Fix conflicts --------- Co-authored-by: Ashwin Sekar <[email protected]>
…backport of #33341) (#33403) * Update is_locked_out cache when adopting on chain vote state (#33341) * Update is_locked_out cache when adopting on chain vote state * extend to all cached tower checks * upgrade error to panic (cherry picked from commit 85cc6ac) # Conflicts: # core/src/consensus.rs * Fix conflicts --------- Co-authored-by: Ashwin Sekar <[email protected]>
…backport of solana-labs#33341) (solana-labs#33402) * Update is_locked_out cache when adopting on chain vote state (solana-labs#33341) * Update is_locked_out cache when adopting on chain vote state * extend to all cached tower checks * upgrade error to panic (cherry picked from commit 85cc6ac) # Conflicts: # core/src/consensus.rs * Fix conflicts --------- Co-authored-by: Ashwin Sekar <[email protected]>
Problem
The
is_locked_out
cache is not updated when we adopt the on chain vote state.This can cause a similar situation to #32880 (detailed in #32944) because we attempt to vote on a block we are locked out on which will fail.
Summary of Changes
Fixes #