fix(epoch): correct missed payload accounting - #849
Conversation
This comment has been minimized.
This comment has been minimized.
|
Superseded by 83fad12: the historical repair and its completion marker were removed during cleanup. The final PR now contains only the two direct accounting/range fixes. |
There was a problem hiding this comment.
Summary
The PR correctly fixes post-Gloas payload accounting: buildDbEpoch/buildDbBlock now count a payload as proposed only when the successor chain includes it (late/orphaned reveals become MissedPayloads), a one-shot startup repair rebuilds finalized epoch payload_count from canonical slot payload_status rows, and the epochs API now aggregates exactly the requested epoch instead of pulling in the previous epoch's last slot. I traced the counting logic against the repair query (enum values and ranges match), the one-shot marker's transactionality, and the GetDbBlocksForSlots range across all cache/DB/finalized paths — the fix is correct and the tests are meaningful (real sqlite DB, re-corrupt marker check, devnet regression range). No blockers found.
Issues
- 🟡
handlers/api/epochs_v1.go:174— slotLimit=lastSlot-firstSlot relies on GetDbBlocksForSlots' undocumented +1 behavior — see the thread on that line
Reviewed @ b64d0d9f
"A pessimist is a well-informed optimist." — Hungarian saying
SummaryThe PR fixes two real Gloas/EIP-7732 payload-accounting bugs: /v1/epochs now aggregates exactly the requested epoch (GetDbBlocksForSlots walks down from its first arg and returns slotLimit+1 slots, so passing lastSlot plus a range guard is the correct fix, matching handlers/epoch.go), and buildDbEpoch no longer counts a late/orphaned-reveal payload as proposed, consistent with the slot PayloadStatus rows it already wrote as Orphaned. Both changes are correct and internally consistent; my findings are about what the final diff no longer contains versus the PR summary. Issues
Reviewed @ |
Summary
Reproduction
On glamsterdam devnet-8, slot 78528 in epoch 2454 had a payload revealed at 7.244 seconds, but the successor block skipped its hash. Dora classified the slot payload as orphaned while the epoch aggregate reported proposedpayloads=32 and missedpayloads=0.
With the corrected accounting, the epoch result is proposedpayloads=31 and missedpayloads=1 when rebuilt.
Verification