← Back to Pull requests

test: enable `light_client/data_collection` spec tests #10792

Open
unknown opened this pull request with 278 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 26, 2026 05:49 UTC
Author

Part of #7348
working on decentralized CL sync with Etan (@etan-status), which needs Lodestar to pass the light_client/data_collection spec tests

Motivation

light_client/data_collection has been skipped since the tests were introduced by consensus-specs#3553 (canonical-only light client data collection, shipped in v1.5.0-beta.0). The suite imports blocks, moves the head across branches, and checks the bootstraps, the best update per sync committee period, the latest finality and optimistic updates, and the latest finalized checkpoint after every head change.

LightClientServer could not be driven that way: it derived and stored data as blocks were imported, and had no notion of the head moving to another branch.

Changes

  • refactor(lightclient): split collection from canonical selection. Collection keeps a per block cache, including the best update derivable along each block's branch. A new updateHead(headBlockRoot, finalizedCheckpoint) reconciles the served best update per period, which may now also be removed, and recomputes the latest finality and optimistic updates from the given head. A new initAnchor registers a block that is never imported, such as genesis. updateHead and initAnchor have no caller outside the tests yet, so served data on a linear chain is the same as before. The per block cache that replaces the previous 32 entry map is pruned on import below the highest finalized block seen, with a cap of 4 sync committee periods while finality stalls.

  • test: add the data_collection handler and remove the skip. The handler replays the vectors through stateTransition on a real database, drives updateHead from the new_head steps, and registers genesis through initAnchor. The chain config parsing is shared with the sync handler.

  • test: build the genesis block with the existing createGenesisBlock.
  • Wiring updateHead and initAnchor into the node, so that served data actually follows fork choice in production, is left for a follow-up PR that closes #7348.

    Testing

  • light_client spec tests, minimal preset: 97/97, including data_collection 11/11

  • light_client spec tests, mainnet preset: 27/27

  • test/unit/chain/lightclient: 84/84
  • Diff: 278 lines (+208 / -70) across 3 files Reviewer: JackCC703 Review duration: 6793m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.40) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 278 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.337
    Real PR Conversation Timeline
    1 comments
    "Review active on #10792"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.6% (MEDIUM) · Higher = larger blast radius
    39.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.6% · Safe to merge
    22.6%