-
Notifications
You must be signed in to change notification settings - Fork 745
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
Reduce frequency of polling unknown validators to avoid overwhelming the Beacon Node #5628
Reduce frequency of polling unknown validators to avoid overwhelming the Beacon Node #5628
Conversation
097dafd
to
ce914d1
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.
Nice, LGTM. Just a minor question
I'll do a bit of manual testing next week before we merge this! |
@chong-he found an issue during testing and it looks like the VC re-queries the BN during the first slot of the epoch, I'll look into this. |
Upon investigating the logs, I think it is working as intended, and the poll in the first slot of epoch is skipped. Will wait for CK to confirm. However, I think there's likelihood that this could happen due to the async nature of this function, in the scenario where BN returns a response really late - basically if iterating through all the validators takes close to 12 seconds, then we could be querying in a new slot, which could potentially be first slot of a new epoch. This is because of the calculation outside the for loop: lighthouse/validator_client/src/duties_service.rs Lines 483 to 502 in ce914d1
For more accuracy, I'll move the calculation into the for loop given we await on each validator query and the slot status could be inaccurate if we have a large list or slow BN. |
Apologies! I was looking at the wrong slot time. The VC does not re-query on the first slot in the next epoch (even though we start the VC in the first slot). It waits until the 12s has lapsed and only re-query the BN about the status (i.e., query at the second slot of an epoch). The VC also only query once per epoch, which is a great improvement. All good upon testing, this PR is good to go |
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.
Looks good. Nice improvement
I think we should include this in 5.2
Co-authored-by: Michael Sproul <[email protected]>
sorry looks like cargo fmt is failing because I messed up the indentation in my suggestion |
My bad, should've checked myself :P thanks! |
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 52e3112 |
Issue Addressed
Addresses #4388.
A large number of unknown validators on a VC is known to overwhelm the beacon node because the VC triggers a retrieval for each validator per slot. This PR reduces the frequency to one query per unknown validator each epoch.
Proposed Changes
For more details and rationale, see comment here.