*: rework deadliner#4552
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the core.Deadliner API from a boolean return to a tri-state core.DeadlineStatus (scheduled, expired, exempt) and updates call sites to react appropriately (notably preventing storage of already-expired partial signatures). It also extends deadline durations for attestation/aggregation-related duties to better tolerate timing mismatches between validator clients.
Changes:
- Introduce
core.DeadlineStatusand updateDeadliner.Addto returnExpired|Scheduled|Exempt, propagating the new semantics across core components and mocks. - Prevent
core/parsigdb.MemDB.StoreExternalfrom storing partial signatures for already-expired duties (which otherwise cannot be trimmed and would leak). - Increase deadlines for attester/aggregator duties to one epoch, and prepare duties to two epochs, updating unit tests accordingly.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
dkg/exchanger.go |
Updates a no-op deadliner implementation to the new DeadlineStatus API. |
core/tracker/tracker.go |
Adjusts tracker deadliner gating logic for tri-state statuses. |
core/tracker/tracker_internal_test.go |
Updates tracker test deadliner to new return type. |
core/priority/prioritiser.go |
Updates prioritiser deadliner checks and related error/log strings. |
core/parsigdb/memory.go |
Drops externally received partial sigs for already-expired duties to avoid untrimmed leaks. |
core/parsigdb/memory_internal_test.go |
Adds coverage ensuring StoreExternal drops expired duties but stores scheduled/exempt. |
core/mocks/deadliner.go |
Regenerates/updates mock deadliner to return DeadlineStatus. |
core/dutydb/memory.go |
Updates storage gating to use tri-state deadliner responses. |
core/dutydb/memory_test.go |
Updates test deadliner to return DeadlineStatus. |
core/dutydb/memory_internal_test.go |
Updates noop deadliner in internal test to return DeadlineStatus. |
core/deadline.go |
Introduces DeadlineStatus, updates Deadliner contract and implementation, and increases duty deadline durations using slotsPerEpoch. |
core/deadline_test.go |
Updates tests for tri-state return type and revised duty deadlines. |
core/consensus/qbft/qbft.go |
Updates QBFT deadliner gating and messaging to tri-state. |
core/consensus/qbft/qbft_test.go |
Updates mock expectations to return DeadlineScheduled. |
core/consensus/qbft/qbft_internal_test.go |
Updates mock expectations to return DeadlineScheduled. |
core/aggsigdb/memory_test.go |
Updates noop deadliner used by tests to return DeadlineStatus. |
core/aggsigdb/memory_internal_test.go |
Updates test deadliner to return DeadlineStatus. |
Files not reviewed (1)
- core/mocks/deadliner.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4552 +/- ##
==========================================
+ Coverage 56.98% 57.08% +0.09%
==========================================
Files 245 245
Lines 33150 33200 +50
==========================================
+ Hits 18892 18951 +59
+ Misses 11870 11858 -12
- Partials 2388 2391 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pinebit
left a comment
There was a problem hiding this comment.
as long as this passes the tests and copilot is happy, it looks good
|



Previously deadliner has been using only true or false, if a duty was successfully scheduled for a deadline. We have scenarios where some duties never expire (e.g.: exits), that were returning
false. Because of that, in some cases, this response from the deadliner was skipped.This PR refactors the deadliner to return 3 statuses - scheduled, expired or exempt. The deadliner call
.Addis refactored throughout the code to take into consideration the response. In the previous version it could've caused some issues at places likecore/parsigdb/memory.go:StoreExternal, where we would add partial sigs to the DB, even if they were expired. Potentially storing them forever, as they were not added to the deadliner. Back in the days this was probably done in order to accommodate sigs for exits.This PR also increases the time of the deadline of attestations and aggregations. This was done so it accommodates some potential mismatches in timings between VCs (especially for preapre_aggregator duties).
category: bug
ticket: none