Skip to content
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

Refactor validator client #2416

Merged
merged 24 commits into from Apr 26, 2021
Merged

Refactor validator client #2416

merged 24 commits into from Apr 26, 2021

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Apr 24, 2021

Motivation

Our validator client worked but was sub-optimal. This PR attempts to solve existing issues from their root, and pave the way for future optimizations

Description

Known fixed issues:

  • Handles pre-genesis properly. Will fetch both proposer and attester duties before genesis. Is able to attest block 0 and propose block 1.
  • Fix bug where the validator will consistently not propose on the first block of the epoch. Closes Validators miss proposing blocks at epoch transition #2380

Improvements:

  • Batch all operations possible. Create a single attestation and aggregate per committee, then sign by everyone and send once.
  • Re-fetch block duties on slot to handle re-orgs safely.
  • Fetch fork only once per epoch and cache the result for future epochs in case of failure.
  • Fetch validator indices in parallel to attester duties. Will refetch duties if it finds new indices.
  • Throttle operations so if an AttesterService slot cycle takes too long, skips the next. This prevents overloading the node continuously.

Simplify AttestationService validator flow

Compute wait times with better precision

Simplify BlockProposingService validator flow

Re-export all util in index

Revert private property accessing

Follow Lighthouse approach for the validator client

Add validatorStore and fork service

Remove wait for block on att service

Reorg duties services

Add dependentRoot functionality

Block service

Clean-up services

Simplify start / stop methods

Remove clock from apiClient

Clean-up apiClient class

Update validator clock tests

Update duties tests

Add more duties tests

Add tests for new validator services

Update validator initialization

Update lodestar tests

Temp patch to pass tests

Fix differenceHex util function

Re-org validator API client

Make validator REST client requests abortable

Log validator indexes in sim tests

Test fork service

Remove runningTasks booleans

Don't log ErrorAborted in validator client

Log time to wait in sim test
@codeclimate
Copy link

codeclimate bot commented Apr 24, 2021

Code Climate has analyzed commit de90ae1 and detected 8 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 8

View more on Code Climate.

Copy link
Contributor

@3xtr4t3rr3str14l 3xtr4t3rr3str14l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a big'un! i only reviewed the packages/lodestar/* half of it (except for the commented function in packages/validator, but will try to look at the validator half later.

@wemeetagain wemeetagain merged commit 84a03e0 into master Apr 26, 2021
@wemeetagain wemeetagain deleted the dapplion/review-vc-2 branch April 26, 2021 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validators miss proposing blocks at epoch transition
3 participants