-
Notifications
You must be signed in to change notification settings - Fork 132
*: prepare proposer duty #4179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
*: prepare proposer duty #4179
Conversation
60036af to
74de907
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new "prepare proposer" duty that runs one slot before block proposal duties to track peer participation and improve leader election. The feature aims to exclude offline or malicious nodes from being elected as leaders during proposer consensus by using participation data from the prior slot.
Key Changes:
- Added DutyPrepareProposer duty type with associated data structures (PrepareProposerData and PrepareProposerDefinition)
- Implemented participation tracking in QBFT consensus to record which peers are visible/connected during prepare_proposer duties
- Modified leader election to use participation data when available, skipping offline peers for proposer duties
- Added comprehensive unit tests covering participation storage, leader election, and data expiration
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| core/types.go | Adds DutyPrepareProposer enum value (14) and string representation |
| core/unsigneddata.go | Defines PrepareProposerData structure with TargetSlot and VisiblePeers fields, includes JSON marshaling |
| core/dutydefinition.go | Defines PrepareProposerDefinition with TargetSlot field and JSON marshaling |
| core/scheduler/scheduler.go | Schedules prepare_proposer duty at slot N-1 when proposer duty exists at slot N (feature-flagged) |
| core/fetcher/fetcher.go | Handles PrepareProposer duty by creating PrepareProposerData from definitions |
| core/deadline.go | Configures 2-slot deadline for PrepareProposer duties (same as attesters/aggregators) |
| core/consensus/qbft/qbft.go | Implements participation tracking, stores visible peers from consensus, modifies leader election to use participation data |
| core/consensus/qbft/qbft_internal_test.go | Adds comprehensive tests for participation tracking, leader election, and expiration behavior |
| core/consensus/qbft/sniffed_internal_test.go | Updates test to accommodate new isLeader parameter in newDefinition signature |
| app/featureset/featureset.go | Adds PrepareProposer feature flag with alpha status |
| core/scheduler/testdata/*.golden | Updates golden test files to include prepare_proposer duties in expected output |
| core/scheduler/scheduler_test.go | Updates test expectations to account for additional prepare_proposer duties (2 more duties in spread tests) |
Comments suppressed due to low confidence (1)
core/consensus/qbft/qbft.go:917
- The comment "cleans up entries older than 2 slots" could be more precise. The actual logic keeps data for the current slot and the previous slot (slot-1), deleting entries from slot-2 and earlier. Consider clarifying to "cleans up entries from 2 or more slots ago" or "keeps only current slot and previous slot data".
resp[i] = "*"
}
💡 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 #4179 +/- ##
==========================================
- Coverage 56.27% 56.20% -0.08%
==========================================
Files 245 245
Lines 31288 31395 +107
==========================================
+ Hits 17607 17645 +38
- Misses 11364 11432 +68
- Partials 2317 2318 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.



The idea for PrepareProposer duty.
category: feature
ticket: none
feature_flag: prepare_proposer