Repository navigation
fix: recompute head after pulling up checkpoints #9864
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1737,18 +1737,24 @@ export class ForkChoice implements IForkChoice { | |
| justifiedCheckpoint: CheckpointWithHex, | ||
| finalizedCheckpoint: CheckpointWithHex, | ||
| getJustifiedBalances: () => JustifiedBalances | ||
| ): void { | ||
| ): boolean { | ||
| let updated = false; | ||
|
|
||
| // Update justified checkpoint. | ||
| if (justifiedCheckpoint.epoch > this.fcStore.justified.checkpoint.epoch) { | ||
| this.fcStore.justified = {checkpoint: justifiedCheckpoint, balances: getJustifiedBalances()}; | ||
| this.justifiedProposerBoostScore = null; | ||
| updated = true; | ||
| } | ||
|
|
||
| // Update finalized checkpoint. | ||
| if (finalizedCheckpoint.epoch > this.fcStore.finalizedCheckpoint.epoch) { | ||
| this.fcStore.finalizedCheckpoint = finalizedCheckpoint; | ||
| this.justifiedProposerBoostScore = null; | ||
| updated = true; | ||
| } | ||
|
|
||
| return updated; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -2060,11 +2066,17 @@ export class ForkChoice implements IForkChoice { | |
| } | ||
|
|
||
| // If a new epoch, pull-up justification and finalization from previous epoch | ||
| this.updateCheckpoints( | ||
| const didUpdateCheckpoints = this.updateCheckpoints( | ||
| this.fcStore.unrealizedJustified.checkpoint, | ||
| this.fcStore.unrealizedFinalizedCheckpoint, | ||
| () => this.fcStore.unrealizedJustified.balances | ||
| ); | ||
|
|
||
| // recompute head if we pull-up checkpoints because the head's dependent root could be changed | ||
| // this is to make sure isProposerBoostSameDependentRoot() correct on block 0 of the next epoch | ||
| if (didUpdateCheckpoints) { | ||
| this.updateHead(); | ||
|
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.
When fast confirmation is enabled and not paused, an epoch-boundary checkpoint update calls the expensive Useful? React with 👍 / 👎.
Member
Author
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. thanks, fixed in the latest commit |
||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.