Skip to content

Add offset and min_slot to beacon_blocks_by_head#5265

Open
arnetheduck wants to merge 3 commits into
ethereum:masterfrom
status-im:head-offset
Open

Add offset and min_slot to beacon_blocks_by_head#5265
arnetheduck wants to merge 3 commits into
ethereum:masterfrom
status-im:head-offset

Conversation

@arnetheduck

Copy link
Copy Markdown
Contributor

When downloading blocks by head, the ancestry of the given block_root is not known - adding an offset to the requests allows clients to make requests for non-overlapping pages of history.

---A---B---C
     F

If block_root is C and - are other blocks, a request with offset=4 would result in B being sent.

When requesting by offset, it is not known which slot the blocks have - this has several consequences:

  • clients may not have a by-block index since this is not used elsewhere in the protocol making the iteration expensive - it is thus limited to 1024 blocks in the current fork - clients with an efficient index may allow larger offsets but this capability should not be used by requesting clients.
  • min_slot is for the situation where F finalizes some history and this request is used to discover a new branch (for example due to an attestation arriving with unknown root). Previously, clients would use by_root requests and download such histories block but block - instead, they can use a by_head request and get the full branch - min_slot ensures that we don't transfer blocks past the block F, ie for histories with large slot jumps, it limits transfers to a single block proving that the history is useless. For backfilling the canonical history, 0 can be used.

When downloading blocks by head, the ancestry of the given `block_root`
is not known - adding an `offset` to the requests allows clients to make
requests for non-overlapping pages of history.

```
---A---B---C
     F
```

If `block_root` is `C` and `-` are other blocks, a request with
`offset=4` would result in `B` being sent.

When requesting by offset, it is not known which slot the blocks have -
this has several consequences:

* clients may not have a by-block index since this is not used elsewhere
in the protocol making the iteration expensive - it is thus limited to
1024 blocks in the current fork - clients with an efficient index may
allow larger offsets but this capability should not be used by
requesting clients.
* `min_slot` is for the situation where `F` finalizes some history and
this request is used to discover a new branch (for example due to an
attestation arriving with unknown root). Previously, clients would use
`by_root` requests and download such histories block but block -
instead, they can use a by_head request and get the full branch -
`min_slot` ensures that we don't transfer blocks past the block `F`, ie
for histories with large slot jumps, it limits transfers to a single
block proving that the history is useless. For backfilling the canonical
history, 0 can be used.
@arnetheduck

Copy link
Copy Markdown
Contributor Author

PR title must start with a capital letter

really?

@dapplion

Copy link
Copy Markdown
Member

What's the maximum value of offset? That can trigger a very long tree traversal without counting towards the rate limit

@arnetheduck

Copy link
Copy Markdown
Contributor Author

What's the maximum value of offset?

1024

@jtraglia jtraglia changed the title beacon_blocks_by_head: add offset, min_slot Add offset and min_slot to beacon_blocks_by_head May 19, 2026
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.

2 participants