Open
Conversation
* is_one_confirmed * committee weight calculations with epoch * separating attestation weight from proposer boost as required by FCR * integration hooks * ancestor scanning * DAG-aligned pruning and property based tests along with backward compatibility of tests
…in FCR Key changes include: - Introduced `is_block_confirmed` method to check the confirmation status of a block without exposing internal metadata. - Implemented `mark_descendants_confirmed` method to recursively mark all descendants of a confirmed block, ensuring consistency across the block DAG.
Key changes include: - Added `is_ancestor` method in both `FastConfirmation` and `ForkChoice` to determine if one block is an ancestor of another, enhancing the confirmation logic. - Updated documentation to clarify the purpose and arguments of the `is_ancestor` method.
Key changes include: - Added `COMMITTEE_WEIGHT_ESTIMATION_ADJUSTMENT_FACTOR` to apply a safety margin in committee weight estimates, ensuring FCR safety guarantees. - Implemented `adjust_committee_weight_estimate_to_ensure_safety` method to encapsulate the logic for adjusting committee weight estimates. - Introduced `get_checkpoint_weight` method to estimate FFG support for checkpoints using LMD-GHOST votes, ensuring confirmed blocks are not filtered out by FFG justification changes. - Added comprehensive tests for both `adjust_committee_weight_estimate_to_ensure_safety` and `get_checkpoint_weight` functionalities, covering various scenarios including edge cases and precision handling.
…wing confirmation to proceed based on LMD-GHOST support only. - Added detailed documentation regarding architectural limitations and the current state of FFG integration, clarifying the need for future enhancements. - Removed unused `ffg_support_lru` cache from `FcrStore` to streamline the implementation and reduce complexity. - Introduced new tests for `get_ffg_weight_till_slot` and `will_current_epoch_checkpoint_be_justified` functionalities, ensuring comprehensive coverage of FCR confirmation logic. - Enhanced existing tests for consistency and clarity, particularly in the context of Byzantine threshold adjustments.
- Simplified the ancestor verification logic by utilizing the existing `is_descendant` method with swapped arguments, enhancing code clarity and maintainability.
…epoch for improved FCR logic clarity. - Added checks to prevent confirmation of blocks from future epochs, ensuring safety in the confirmation process. - Revised comments to better reflect the purpose of `checkpoint_state`. - Removed redundant variable declarations to streamline the code and improve readability.
… improved balance handling and voting source calculation. Enhanced logic to derive voting source epoch based on effective balances and added fallback mechanism. Updated related function calls for consistency. Cleaned up comments and removed unused variables in tests for clarity.
…ssion - Introduced a test to ensure that a checkpoint is only supported if the vote's target checkpoint matches the expected target, verifying the correct handling of mismatched target roots. - Added a test for minimal slot progression across epoch boundaries, confirming that the estimator behaves as expected when transitioning between epochs.
… retrieval - Updated the `get_checkpoint_state` method to return `Arc<BeaconState<E>>` instead of `&BeaconState<E>`, improving memory management and ownership semantics. - Enhanced logic to retrieve checkpoint states from both hot and cold storage, ensuring more efficient state access and fallback mechanisms. - Refactored `get_total_active_balance_at_epoch` to utilize cold state roots directly, optimizing balance retrieval at epoch boundaries.
…poch boundaries - Added logic to promote the confirmed checkpoint to the unrealized justified checkpoint if it belongs to the previous epoch and is later than the current confirmed block, aligning with spec-defined safety measures. - Improved the conditional checks for advancing the confirmed root by incorporating checks for unrealized justification epochs, ensuring robust handling of checkpoint conditions across epoch transitions.
…ed `safe_head_root` for O(1) access, improving performance and leveraging structural sharing for efficient updates. Added `SafeHeadMetrics` struct for monitoring, and updated methods to utilize the new safe head functionality. This refactor optimizes the confirmation logic while maintaining compliance with specifications and improving sync safety.
…d-to-confirmed gap slots. - Added a counter for confirmation rule restarts, labeled by reason (stale or reorg). - Implemented tail-case confirmation metrics, categorized by epoch boundary and delay bucket. - Updated the `mark_confirmed` function to utilize the new metrics for improved observability.
…etween the head slot and the current slot. This metric is represented as a gauge, indicating 1 when the head slot equals the current slot, and 0 otherwise.
… delay artifacts in metrics. Updated `block_creation_slot` to use the block's real slot when available, ensuring accurate metadata creation for confirmed blocks.
also, fixed proposer delta
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Core FCR Implementation:
find_latest_confirmed_descendant()andget_latest_confirmed()get_weight_legacy()maintains existing test compatibilityWith Tests
get_checkpoint_weight()validator_vote_supports_checkpoint()get_ffg_weight_till_slot()will_current_epoch_checkpoint_be_justified()will_no_conflicting_checkpoint_be_justified()StateProvider trait- Abstracted historical state access for FFG analysis. Decouplesfork_choicefrom store crate for FFG analysisHotColdDBStateProvider- Newtype wrapper implementing StateProvider for store integrationSlight Deviation from spec
The spec compliance is nearly complete.
proto_array.get_weight(..., None, /*no boost*/)for S (attestation support), and the weighting checkpoint state only for W (maximum possible support). Because in Lighthouse, S is the authoritativenode.weightrecomputed on everyget_head()viacompute_deltas()under the justified view. This avoids a second, ad-hoc vote-eval pipeline and keeps S consistent with fork-choice. The _checkpoint_state parameter in proto_array.get_weight is intentionally ignored.get_total_active_balance()when available; otherwise we fall back tofc_store.justified_balances().total_effective_balance. Python spec always uses a state; Lighthouse can sometimes lack a historical checkpoint state through the StateProvider. We fail-safe by falling back to the justified balances rather than block the algorithm.checkpoint_states- The spec assumesstore.checkpoint_states[...]is available. We abstracted state access via aStateProviderand treat missing states conservatively (returning false for justification checks if state unavailable). This is to keep fork_choice crate independent of store and avoid a DB/schema change. It also lets us operate even when historical states are not cached.Functions that are NOT needed in Lighthouse:
get_forkchoice_store()- Lighthouse usesForkChoice::new()with FCR parametersget_block_slot()- Access viaproto_array.get_block().slotget_block_epoch()- Useslot.epoch(E::slots_per_epoch())get_weight()- Useproto_array.get_weight()with FCR parameterson_tick_per_slot_after_attestations_applied()- Integrated intoForkChoice::on_tick()