feat: update vc to submit beacon committee selections once per epoch#8669
feat: update vc to submit beacon committee selections once per epoch#8669
Conversation
Summary of ChangesHello @nflaig, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the handling of beacon and sync committee selections for distributed validator clients. The core change involves shifting the submission of selection proofs from a per-slot operation within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the submission of beacon committee selections to occur once per epoch, rather than per slot. This is achieved by relocating the runDistributedAggregationSelectionTasks logic from AttestationService to AttestationDutiesService. A similar refactoring has been applied to sync committee duties, moving logic from SyncCommitteeService to SyncCommitteeDutiesService. The changes are logical and align with the goal of reducing submission frequency.
I have one suggestion to improve the robustness of the new implementation in attestationDuties.ts.
Performance Report🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
|
|
||
| this.logger.debug("Submitting partial beacon committee selection proofs", {epoch, count: partialSelections.length}); | ||
|
|
||
| const res = await this.api.validator.submitBeaconCommitteeSelections({selections: partialSelections}); |
There was a problem hiding this comment.
we call this with duties for a whole epoch, could consider batching the request but generally assume vc and charon run on the same host without any proxy in-between that could cause issues due to large request body size
| * 3. Mutate duty objects to set selection proofs for aggregators | ||
| * 4. Resubscribe validators as aggregators on beacon committee subnets | ||
| * | ||
| * See https://docs.google.com/document/d/1q9jOTPcYQa-3L8luRvQJ-M0eegtba4Nmon3dpO79TMk/mobilebasic |
There was a problem hiding this comment.
the google doc is no longer accessible
There was a problem hiding this comment.
Committee Aggregations with Distributed Validators describes the flow as well but I don't think it's necessary to reference it in the code (there are enough comments)
|
Changes look good from Obol side, we should aim to have this in our next release |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #8669 +/- ##
============================================
- Coverage 52.05% 51.99% -0.07%
============================================
Files 848 848
Lines 65742 65626 -116
Branches 4808 4797 -11
============================================
- Hits 34219 34119 -100
+ Misses 31454 31438 -16
Partials 69 69 🚀 New features to boost your workflow:
|
…8708) Since #8669 we might call the committee selection apis even if we don't have any duties which is unnecessary and charon doesn't like it. ``` lodestar-1 | Dec-19 16:16:47.001[] error: Error on sync committee aggregation selection slot=13278082 - JSON is not an array lodestar-1 | Error: JSON is not an array lodestar-1 | at value_fromJsonArray (file:///usr/app/node_modules/@chainsafe/ssz/src/type/arrayBasic.ts:162:11) lodestar-1 | at ListCompositeType.fromJson (file:///usr/app/node_modules/@chainsafe/ssz/src/type/array.ts:121:12) lodestar-1 | at ApiResponse.value (file:///usr/app/packages/api/src/utils/client/response.ts:115:51) lodestar-1 | at SyncCommitteeDutiesService.runDistributedAggregationSelectionTasks (file:///usr/app/packages/validator/src/services/syncCommitteeDuties.ts:385:36) lodestar-1 | at processTicksAndRejections (node:internal/process/task_queues:103:5) ```
These errors aren't really critical and might be common right now because we moved from per slot to per epoch in #8669 and not all validator clients doing the same will cause calls to time out if signature threshold in DVT middleware is not reached.
| const {slot, validatorIndex, committeeIndex, committeeLength} = dutyAndProof.duty; | ||
| const logCtxValidator = {slot, index: committeeIndex, validatorIndex}; | ||
|
|
||
| const combinedSelection = combinedSelections.find((s) => s.validatorIndex === validatorIndex && s.slot === slot); |
There was a problem hiding this comment.
optional: we can create a map of combinedSelection by ValidatorIndex before the for loop then use it here
There was a problem hiding this comment.
makes sense to do it here since attestation duties can be quite a lot depending on validator count, see #8710
|
🎉 This PR is included in v1.39.0 🎉 |
Motivation
Closes #8606
Description
This updates our implementation to be compliant with latest spec ethereum/beacon-APIs#368.
For sync committee aggregation selection (unchanged)
submitSyncCommitteeSelectionsat the start of the slotCONTRIBUTION_DUE_BPSinto the slot (8 seconds)For attestation aggregation selection
submitBeaconCommitteeSelectionsat the start of the epoch for current and next epoch (2 separate calls)SLOT_DURATION_MS(12 seconds)prepareBeaconCommitteeSubnetonce the above call either resolved or failed, this should be fine as it's not that time sensitive (one epoch lookahead)submitBeaconCommitteeSelectionswith duties of affected epochPrevious PR #5344