Skip to content

Request a block's unknown parent by root on gossip arrival#17057

Merged
terencechain merged 3 commits into
developfrom
request-unknown-parent-block
Jul 1, 2026
Merged

Request a block's unknown parent by root on gossip arrival#17057
terencechain merged 3 commits into
developfrom
request-unknown-parent-block

Conversation

@terencechain

Copy link
Copy Markdown
Collaborator

When a gossiped block arrives with an unknown parent, request the parent by root immediately instead of waiting up to a third of a slot for the pending blocks queue to process it. This matches the on demand by root requests already used for blob sidecars and execution payload envelopes.

@terencechain terencechain force-pushed the request-unknown-parent-block branch from 55c86c9 to 19b1887 Compare June 29, 2026 22:15
satushh
satushh previously approved these changes Jul 1, 2026
}
s.pendingQueueLock.Unlock()
err := errors.Errorf("unknown parent for block with slot %d and parent root %#x", blk.Block().Slot(), blk.Block().ParentRoot())
parentRoot := blk.Block().ParentRoot()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use this parentRoot above instead of calling blk.Block().ParentRoot() twice. in Line 195

s.pendingQueueLock.Unlock()
err := errors.Errorf("unknown parent for block with slot %d and parent root %#x", blk.Block().Slot(), blk.Block().ParentRoot())
parentRoot := blk.Block().ParentRoot()
go func() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called only if the block is not being synced. In fact for a call with a single root, a new helper would be good that takes a single root as argument, checks if the block is not currently being synced and dispatches a call in the background to call it if it's not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendBatchRootRequest filters roots that's being synced.

// Filter out roots that are already seen in pending blocks or being synced.
	roots = s.filterOutPendingAndSynced(roots)

	// Nothing to do, exit early.
	if len(roots) == 0 {
		return nil
	}

When a gossiped block is queued because its parent is unknown, request the parent by root immediately rather than waiting for the periodic pending blocks queue tick. This mirrors the blob and payload envelope gossip paths which already do the same.
potuz
potuz previously approved these changes Jul 1, 2026
@terencechain terencechain added this pull request to the merge queue Jul 1, 2026
Merged via the queue into develop with commit eb795f1 Jul 1, 2026
23 checks passed
@terencechain terencechain deleted the request-unknown-parent-block branch July 1, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants