-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
feat: proposer boost reorg #6298
Closed
Closed
Changes from 20 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
6473e0b
Add presets
ensi321 87a0b6d
Add timeliness to protoBlock
ensi321 f0581bf
Rename proposerBoostScore to committeeFraction
ensi321 2da8dfc
Implement getProposerHead
ensi321 1d0d2f7
Add proposerBoostReorgEnabled flag
ensi321 c9d7582
Add updateAndGetHead
ensi321 16c056b
Add predictProposerHead()
ensi321 5d4fc9b
Refactor forkChoice. Add comment
ensi321 7d0095c
Predict proposer head if proposing next slot
ensi321 7ea9e02
Add todo
ensi321 b9aee5c
Lint
ensi321 90cb85a
Add logger to forkChoice
ensi321 a031b40
newHead calculation varies depending if we are proposer
ensi321 bd1fd42
Add timeliness to tests
ensi321 01609e8
Merge branch 'unstable' into proposer-boost-reorg
ensi321 a2b06a2
Lint
ensi321 2124d27
Fix getProposerHead
ensi321 d341d02
Add test
ensi321 b1b1eaa
Lint
ensi321 d6a73e7
Fix
ensi321 d273339
Lint
ensi321 3037e54
Merge branch 'unstable' into proposer-boost-reorg
ensi321 a7b9d44
Fix consensusBlockValue unit in debug log
ensi321 a50c276
lint
ensi321 b8ec80f
Fix typo
ensi321 8d44cfd
Merge branch 'unstable' into proposer-boost-reorg
ensi321 feb6de7
Fix naming conflict
ensi321 5d0990d
Revert changes in `importBlock` as per suggestion
ensi321 9a1d577
Merge branch 'unstable' into proposer-boost-reorg
ensi321 439f7e9
Update test
ensi321 b805fd2
fix test
ensi321 0ee4dff
Disable reorg by default
ensi321 e542037
updatedHeadRoot
ensi321 a7bd0f8
Split recomputeForkChoiceHead into 3 fns
ensi321 5e75849
Improve metrics
ensi321 04f83a2
Avoid setting forkchoice.head in getProposerHead
ensi321 944f234
Use the correct commonBlockBody to produce block
ensi321 1b233c3
Lint
ensi321 e55fa43
Fix unit test
ensi321 39b1113
Fix unit test
ensi321 7d02297
Remove extra update forkchoice head
ensi321 a5c4bce
fix: refactor and e2e test
twoeths 852220c
chore: address PR comment
twoeths 3fef364
Update packages/beacon-node/test/e2e/chain/proposerBoostReorg.test.ts
ensi321 07a11d5
Merge pull request #3 from tuyennhv/proposer-boost-reorg-e2e-test
ensi321 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ import { | |
isBlindedBeaconBlock, | ||
Gwei, | ||
} from "@lodestar/types"; | ||
import {CheckpointWithHex, ExecutionStatus, IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; | ||
import {CheckpointWithHex, ExecutionStatus, IForkChoice, ProtoBlock, UpdateHeadOpt} from "@lodestar/fork-choice"; | ||
import {ProcessShutdownCallback} from "@lodestar/validator"; | ||
import {Logger, isErrorAborted, pruneSetToMax, sleep, toHex} from "@lodestar/utils"; | ||
import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params"; | ||
|
@@ -252,7 +252,8 @@ export class BeaconChain implements IBeaconChain { | |
clock.currentSlot, | ||
cachedState, | ||
opts, | ||
this.justifiedBalancesGetter.bind(this) | ||
this.justifiedBalancesGetter.bind(this), | ||
logger | ||
); | ||
const regen = new QueuedStateRegenerator({ | ||
config, | ||
|
@@ -642,12 +643,12 @@ export class BeaconChain implements IBeaconChain { | |
}; | ||
} | ||
|
||
recomputeForkChoiceHead(): ProtoBlock { | ||
recomputeForkChoiceHead(mode: UpdateHeadOpt = UpdateHeadOpt.GetCanonicialHead, slot?: Slot): ProtoBlock { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it takes me a while to figure out the use of different params here. I prefer to keep this function as is and add:
that'd be cleaner to me, each function has its own purpose. Would like to know opinions from @wemeetagain @g11tech too |
||
this.metrics?.forkChoice.requests.inc(); | ||
const timer = this.metrics?.forkChoice.findHead.startTimer(); | ||
|
||
try { | ||
return this.forkChoice.updateHead(); | ||
return this.forkChoice.updateAndGetHead(mode, slot); | ||
} catch (e) { | ||
this.metrics?.forkChoice.errors.inc(); | ||
throw e; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
need to get the result (proposer head) from this function, put it in
chain.produceBlindedBlock()
in order to build block with expectedparent_root
same to the other 2
chain.recomputeForkChoiceHead ()
calls below