Skip to content

Add beacon_block_headers_by_root req/resp on Gloas#5179

Open
dapplion wants to merge 2 commits into
ethereum:masterfrom
dapplion:headers-by-root-gloas
Open

Add beacon_block_headers_by_root req/resp on Gloas#5179
dapplion wants to merge 2 commits into
ethereum:masterfrom
dapplion:headers-by-root-gloas

Conversation

@dapplion
Copy link
Copy Markdown
Member

@dapplion dapplion commented Apr 28, 2026

Adds a new ReqResp route beacon_block_headers_by_root to support "tree sync", a forward-sync redesign described in sigp/lighthouse#7678. First backfill an in-memory header tree from peer status / unknown roots until it ties into a known block or conflicts with finality, then forward-sync with full knowledge of which roots belong at which slot.

The request is (beacon_root, count, min_slot). The responder walks the parent chain of beacon_root (inclusive), in descending slot order, and stops when any of: count headers returned, next ancestor has slot < min_slot, or next ancestor falls outside the standard block-serving range.

The whole list is sent as a single SSZ list in one response_chunk rather than one chunk per element — headers are 112 B each, so bundling them avoids per-chunk framing overhead.

MAX_REQUEST_BLOCK_HEADERS = 2**11 (= 2,048) caps a response at ~230 KiB and covers 64 epochs of backfill per round-trip.

Implementation cost

Serving this route efficiently requires clients to maintain a new DB index: BeaconBlockHeader keyed by block root. Without it, the responder must load full SignedBeaconBlocks and extract headers.

Trade-off: a new index over the block-serving range, in exchange for fast header sync at very low bandwidth and few round-trips per request — that's the core value-add.

A sibling route beacon_blocks_by_head (#5181) avoids this index by reusing the existing blocks-by-root store, at the cost of full-block bandwidth.

@github-actions github-actions Bot added the gloas label Apr 28, 2026
@dapplion dapplion force-pushed the headers-by-root-gloas branch from 71d8922 to 3bdfe04 Compare April 28, 2026 09:27
@dapplion dapplion force-pushed the headers-by-root-gloas branch from 3bdfe04 to 2a17293 Compare April 28, 2026 09:29
@dapplion dapplion changed the title Add headers_by_root req/resp on Gloas Add beacon_block_headers_by_root req/resp on Gloas Apr 28, 2026
@healthykim
Copy link
Copy Markdown

this is great, will implement

jtraglia pushed a commit that referenced this pull request May 11, 2026
Adds a new req/resp route `beacon_blocks_by_head` to Fulu. The request
is `(beacon_root, count)`; the responder walks the parent chain of
`beacon_root` (inclusive) and emits up to `count` blocks in descending
slot order, one per `response_chunk` in the same shape as
`BeaconBlocksByRange v2`. Capped at `MAX_REQUEST_BLOCKS_DENEB` (= 128).

Same motivation as #5179 (header-tree forward sync,
sigp/lighthouse#7678) — backfill a chain
segment from a known head. The trade-off vs. #5179:

- This route streams full blocks (~average ~150 KiB/slot post-Deneb), so
it's heavier on the wire.
- It reuses the existing blocks-by-root store. **No new DB index
required** on the server side.

#5179 is the bandwidth-optimal version (only headers, single chunk,
2,048 per request) but requires clients to maintain a new
headers-by-root DB column. This PR is the lower-cost-to-ship alternative
for clients that don't want to add storage.

The two routes are not mutually exclusive — a client can serve either or
both.
@kasey
Copy link
Copy Markdown
Contributor

kasey commented May 12, 2026

Serving this route efficiently requires clients to maintain a new DB index: BeaconBlockHeader keyed by block root. Without it, the responder must load full SignedBeaconBlocks and extract headers, defeating the bandwidth benefit.

Isn't the bandwidth benefit still there, the response side is just paying more in disk io?

@jtraglia
Copy link
Copy Markdown
Member

jtraglia commented Jun 1, 2026

Hey @dapplion, what's the status on this PR? Is this still relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants