fix: update lean_head_slot metric on head slot update#163
Conversation
🤖 Kimi Code ReviewReview SummaryThe changes look correct and improve metric accuracy. The new Positive Points
Minor Suggestions
The PR correctly addresses the issue where head slot metrics could become stale when the fork choice changes due to attestation processing rather than block reception. Automated review by Kimi (Moonshot AI) · custom prompt |
🤖 Codex Code Review
The metric semantics change itself looks correct: updating head slot from actual store head (instead of incoming block slot) is an improvement and avoids misleading values on non-head blocks. No direct fork-choice/attestation/finalization/XMSS/SSZ correctness regressions are visible in this diff. Automated review by OpenAI Codex · custom prompt |
🤖 Claude Code ReviewThe diff is small and focused. The changes are clear and the context is sufficient for a thorough review. PR 163 Review — Fix
|
Greptile SummaryFixed Key Changes:
Impact:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| crates/blockchain/src/lib.rs | Updates lean_head_slot metric to use actual fork choice head slot instead of incoming block slot, and adds metric update on every tick to capture attestation-driven head changes |
| crates/storage/src/store.rs | Adds head_slot() convenience accessor following existing safe_target_slot() pattern to retrieve the slot of the current fork choice head |
Last reviewed commit: 3911c58
Summary
lean_head_slotwas set to the incoming block's slot instead of the fork choice head slot, reporting wrong values during reorgs or late block arrivals.safe_target_slotmetric.Store::head_slot()helper: Convenience accessor following the existingsafe_target_slot()pattern.Test plan
make lintpasses (no unused variable warnings)make testpasses (all workspace tests)lean_head_slotshould never jump backwards when old blocks arrive, and should advance even during slots with no new blocks when attestation promotion changes the head