-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
spec 1.1.6 - Applying proposer boost to fork-choice #3540
Conversation
Code Climate has analyzed commit 067debc and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Codecov Report
@@ Coverage Diff @@
## master #3540 +/- ##
==========================================
- Coverage 37.40% 37.16% -0.24%
==========================================
Files 311 321 +10
Lines 8374 8696 +322
Branches 1299 1348 +49
==========================================
+ Hits 3132 3232 +100
- Misses 5093 5319 +226
+ Partials 149 145 -4 |
since lighthouse's proposer score computation is still pretty cheap, reverted to that approach in order to keep the forkChoice closer to lighthouse's implementation.
|
…lls to applyScoreChanges
if (proposerIndex == undefined) throw Error("InvalidProposerIndex"); | ||
const proposerBoostScore = | ||
this.proposerBoost.score ?? | ||
computeProposerBoostScoreFromBalances(this.justifiedBalances, { |
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.
this function should be called once per justified balances at most, we can even precompute it in getEffectiveBalances()
to avoid an extra for
loop over justified balances, and send both proposerBoostScore
and justifiedBalances
to forkchoice over onBlock()
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.
yes, good idea 👍
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.
actually it could require a bit more bookeeping as there is one place where justified is updated with the bestJustifiedBalances, so will also have to track bestProposerBoostScore
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.
@tuyennhv now score is calculated atmost once per justified balances
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.
Excellent! Looks great 🔥 🔥 I've committed on top to make the feature flag visible
Motivation
In order to prevent some attack scenarios, timely receipt of the block needs to be rewarded with proper boost as per CL spec 1.1.6 (the calculation of which was fixed in spec 1.1.7)
This PR implements following CL spec 1.1.6 changes along with spec 1.1.7 calc fixes
--chain.proposerBoostEnabled
Closes #3506, #3438,
Partially closes #3483