Skip to content

feat: improve metrics setup - #46

Merged
MegaRedHand merged 7 commits into
mainfrom
improve-metrics-setup
Jan 23, 2026
Merged

MegaRedHand merged 7 commits into
mainfrom
improve-metrics-setup

Conversation

@MegaRedHand

Copy link
Copy Markdown
Collaborator

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.

@MegaRedHand
MegaRedHand merged commit eb08775 into main Jan 23, 2026
2 checks passed
@MegaRedHand
MegaRedHand deleted the improve-metrics-setup branch January 23, 2026 15:05
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".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant