Repository navigation
feat: improve metrics setup - #46
Merged
Merged
Conversation
MegaRedHand
added a commit
that referenced
this pull request
Oct 20, 2026
… restart Beacon fork choice kept the per-block unrealized justified checkpoint (consensus-specs' store.unrealized_justifications[block_root]) only in an in-memory BeaconScratch map. A restart emptied that map with nothing to refill it: once a pre-restart block was a leaf from an epoch older than the store's clock, get_voting_source needed its entry and hit a hard SpecAssert on every tick, freezing get_head. Operators saw a follower that imported blocks and gossiped fine but never advanced its head after a restart or resume. Add a new storage table, BeaconUnrealizedJustifications, keyed by block root with (slot, Checkpoint) as the value. Root-keyed rather than slot||root like LiveChain/BlockProof: both readers of this table (get_voting_source, is_ffg_competitive) look up a root with no slot in hand, so a root-only key keeps that lookup a single point read; the slot rides in the value only for the pruner, which is fine since the table only ever holds the unfinalized window's worth of leaves between two finalizations. The in-memory map stays as a write-through cache in front of the table, since get_voting_source reads it for every block from a prior epoch. The write happens right after compute_pulled_up_tip's caller (on_block) has already committed the block's own insert_signed_block/insert_state, not in the same atomic batch: compute_pulled_up_tip needs the block's post-state, which insert_state hands off to the background state writer rather than committing synchronously. A crash in that narrow window leaves one block without its entry, surfacing as the same SpecAssert an unpatched build raised on every block, now scoped to a single block instead of the whole unfinalized window. Pruned on finalization inside update_checkpoints' Chain::Beacon arm, reusing the block_entry(&finalized.root) lookup PR #46 introduced for LiveChain pruning, on the same horizon (the finalized block's own slot rather than the stored checkpoint's epoch-start slot), so the finalized block's own entry always survives a resume with nothing imported past it yet. Bumps DB_VERSION to 4: a directory written by the previous version has no row in the new table for any block it already imported, which would otherwise look identical to "no unrealized justification computed yet" rather than "this directory predates the table".
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.
This PR improves the metrics stack we have, to make it easier to use. It also adds a mention on how to fix a common issue in MacOS.
Also fixes the validator count metric, which was showing total validator count instead of managed validator count.