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.
Introduction
This PR introduces a modified version of the Fast Confirmation Rule algorithm introduced in #3339.
Modified algorithm starts its confirmed chain from a safe checkpoint and attempts to advance a confirmed block
at the beginning of each slot by finding the most recent confirmed block in the canonical chain. Then the
confirmed_rootis kept in theStoreand is used as the starting point of the algorithm run during the next slot. This iterative approach is one of the main differences comparing to the original version.A new version also have a few modifications improving the algorithm performance, i.e. reducing distance to the most recent confirmed block in e.g. empty slot case.
There is A Short Explainer covering the logic and rationale of the modified version of the algorithm.
Performance
Changeset
Storeis extended with three fields, one of them isconfirmed_rootand the other two are required for the algorithm needs. Alternatively, there can be a separateFCRStoreclass, however, it reduces readability of the spec.get_latest_message_epochis introduced, because Gloas replacesepochwithslot, but the algorithm needs access toLatestMessage.epochon_slot_after_attestations_appliedhandler that basically does two things:get_latest_confirmedfunction and updatesstore.confirmed_rootStoremore convenientget_latest_confirmedfunction which does several underlying callssafeblock is switched fromstore.justified_checkpoint.roottostore.confirmed_rootDependencies
Comparing to the Fork Choice implementation the algorithm has the following dependencies:
Testing
Tests are planned to be a part of a separate PR. The main idea behind tests is to extend the Fork Choice test format with
on_slot_after_attestations_appliedhandler andconfirmed_rootproperty check and defined a separate FCR generator.ToDo
get_weightandget_proposer_score#4746