-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
fix: improve forkchoice #7142
fix: improve forkchoice #7142
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #7142 +/- ##
============================================
+ Coverage 49.04% 49.15% +0.10%
============================================
Files 596 596
Lines 39743 39711 -32
Branches 2065 2058 -7
============================================
+ Hits 19493 19519 +26
+ Misses 20209 20151 -58
Partials 41 41 |
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.
changes lgtm
* fix: reuse deltas in computeDeltas * fix: remodel queuedAttestations * fix: call forkchoice.updateTime() once per clock slot * fix: recomputeForkChoiceHead() at slot boundary * fix: improve computeDeltas() - handle newBalances = oldBalances * fix: do not compute forkchoice head at slot boundary * fix: prepareNextSlot unit test
🎉 This PR is included in v1.23.0 🎉 |
Motivation
Improve forkchoice
Description
Some different small optimizations for forkchoice:
updateTime()
is designed to called once per slot and we do that per clock slot, so no need to do that again when producing block. No need to process queued attestations again in the same slot because:votes
alreadyprocessAttestationQueue()
:get_head()
metric by entry point and we have no idea for the time to recompute head forprepare_next_slot
vsimport_block
, we should label by"caller"
insteadcomputeDeltas()
:deltas
array over timenewBalances === oldBalances
to speed up the computation a little bitMetric look like (will add in a separate PR):
