This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Port unconfirmed duplicate tracking logic from ProgressMap to ForkChoice #17779
Merged
Conversation
This file contains 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
jstarry
reviewed
Jun 9, 2021
Comment on lines
97
to
99
// The latest ancestor of this node that has been marked invalid | ||
latest_invalid_ancestor: Option<Slot>, |
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.
Can you also mention that this will be set to the ForkInfo
's own slot if it's a duplicate?
f1f0f3f
to
7a62cc1
Compare
Codecov Report
@@ Coverage Diff @@
## master #17779 +/- ##
========================================
Coverage 82.6% 82.6%
========================================
Files 431 431
Lines 121044 121178 +134
========================================
+ Hits 100035 100167 +132
- Misses 21009 21011 +2 |
jstarry
previously approved these changes
Jun 11, 2021
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.
lgtm
…duplicates from progress map to fork choice
…ed to fork choice
mergify bot
added a commit
that referenced
this pull request
Jun 11, 2021
…ice (#17779) (#17889) (cherry picked from commit c8535be) Co-authored-by: carllin <[email protected]>
Closed
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
Keeping the duplicate/duplicate confirmed tracking logic in ProgressMap is unwieldy for a number of reasons:
Requires a separate update in
cluster_slot_state_verifier
to update the ProgressMap, and then separately mark certain forks valid/invalid in ForkChoice:solana/core/src/cluster_slot_state_verifier.rs
Lines 212 to 217 in 18ec675
Updating the ProgressMap for duplicate/duplicate confirmed tracking requires passing in ancestors/descendants:
solana/core/src/progress_map.rs
Line 477 in 18ec675
cluster_slot_state_verifier::check_slot_agrees_with_cluster()
solana/core/src/cluster_slot_state_verifier.rs
Lines 242 to 243 in 18ec675
Furthermore, there are correctness issues that can arise because we track all the duplicate ancestor information in the ProgressMap and not ForkChoice. These stem from the fact that the fork choice only knows that a specific block was marked valid/invalid, but doesn't know if descendants of that block are valid/invalid. For example, consider the following order of events:
Given a fork
0 -> 1 -> 2 -> 3
is_candidate
flag to falsesolana/core/src/heaviest_subtree_fork_choice.rs
Line 819 in 18ec675
is_candidate
flag is not set.Now 3) is not an issue when considering the overall best slot returned by fork choice:
solana/core/src/heaviest_subtree_fork_choice.rs
Lines 175 to 177 in 18ec675
2
. However, functions likeheaviest_slot_on_same_voted_fork()
:solana/core/src/heaviest_subtree_fork_choice.rs
Line 688 in 18ec675
2
, and didn't contain the aggregate information that2
was marked invalid.Summary of Changes
Port duplicate fork/duplicate confirmed status tracking and tests to fork choice
Fixes #