Conversation
g11tech
reviewed
Feb 23, 2026
pkgs/node/src/forkchoice.zig
Outdated
| // This can happen when the updateHeadUnlocked is not yet called for the new block | ||
| // and the target is calculated before the head is updated | ||
| // OnBlock calls update the latest_justified and attestation occurs on interval before the head is updated | ||
| const justified = self.fcStore.latest_justified; |
Member
There was a problem hiding this comment.
the condition above is the same no?
Collaborator
Author
There was a problem hiding this comment.
yes, I think Kai somehow removed this from devnet3 PR and I thought this condition was missing altogether, removing the redundancy here.
Member
There was a problem hiding this comment.
this condition is not needed, the previous while look should automatically take care of it
g11tech
reviewed
Feb 23, 2026
|
|
||
| // Ensure target is not behind the justified source checkpoint | ||
| // This prevents creating invalid attestations where target slot is behind the justified source slot | ||
| // This can happen when the updateHeadUnlocked is not yet called for the new block |
Member
There was a problem hiding this comment.
what condition is update head not called for the new block, we always call it when the new block is added no?
#593) * chain: queue gossip blocks that arrive before forkchoice ticks to their slot When a peer gossips a block for slot N and our local interval timer hasn't yet advanced the forkchoice clock to N*INTERVALS_PER_SLOT, forkChoice.onBlockUnlocked returns FutureSlot and the block is dropped. Fix by queuing such blocks in BeamChain.pending_blocks (an ArrayList of SSZ-cloned SignedBlockWithAttestation). After validateBlock passes, we check if block.slot * INTERVALS_PER_SLOT > fcStore.time; if so the block is cloned into the queue instead of being processed immediately. In onInterval, after forkChoice.onInterval has advanced the clock, the new processPendingBlocks helper iterates the queue and replays every entry whose slot is now reachable (slot * INTERVALS_PER_SLOT <= fc_time) by calling onBlock + onBlockFollowup in the normal way. Entries still in the future stay in the queue for the next tick. https://claude.ai/code/session_0116R4pk8fiu5Ve5PAfjE3op * node: call processPendingBlocks from onInterval and fetch missing roots Move the processPendingBlocks call out of chain.onInterval and into node.onInterval so that any missing attestation-head roots discovered while replaying queued blocks can be immediately fetched via fetchBlockByRoots, mirroring the pattern used after onGossip in handleGossipProcessingResult. - Make processPendingBlocks pub and change its return type from void to []types.Root, accumulating all missing roots across every replayed block into a single caller-owned slice. - Remove the processPendingBlocks call from chain.onInterval (it now belongs to the node layer). - In node.onInterval, call chain.processPendingBlocks() right after chain.onInterval() and pass the returned roots to fetchBlockByRoots. https://claude.ai/code/session_0116R4pk8fiu5Ve5PAfjE3op --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Uh oh!
There was an error while loading. Please reload this page.