consensus-specs icon indicating copy to clipboard operation
consensus-specs copied to clipboard

Add BeaconBlocksByRange v3

Open dapplion opened this issue 1 year ago • 4 comments
trafficstars

BeaconBlocksByRange v2 allows to sync blocks exclusively from the peer's canonical chain.

Consider an unstable network with a competing forks. One can group peers by their head with status Req Resp messages. However, there's asynchrony between receiving that status message and requesting blocks by range, as the head of the remote peer can change at any time.

Consider a case where you syncing a head chain with BeaconBlocksByRange v2 and peer changes its head before you issue a by range request. It changes into a fork that has all missed slots in the requested range. You should downscore the peer since its giving incorrect blocks for the segment you are intending to sync. However, the root of the issue is the risk of mixing ranges of blocks from different forks without being aware of it.

BeaconBlocksByRange v3 allows requesters to specify which fork they intend to sync. An exemplary consumer would:

  • Status all its peers
  • Group them by head_root
  • Issue BeaconBlocksByRange v3 requests to each group where block_root = head_root

If other clients believe this protocol to be unnecessary I'm keen to know how you handle these situations with the existing protocols.

dapplion avatar Jul 15 '24 15:07 dapplion

I'm a bit surprised that this didn't exist in the beginning. Do we have any reason why we didn't do it in phase0? or we just didn't do it.

ppopth avatar Jul 24 '24 14:07 ppopth

Should we do the same with BlobSidecarsByRange as well? I feel that there is no reason to do it only with one but not the other.

ppopth avatar Jul 24 '24 14:07 ppopth

On Nimbus, there is branch feat/splitview which pulls in blocks via BeaconBlocksByRoot in a backward motion, from peers specifically advertising unknown branches.

One issue on Goerli was that when there is heavy branching, that there are also longer gaps, so range requests are very inefficient due to sometimes long gaps between blocks.

etan-status avatar Jul 25 '24 14:07 etan-status

On Nimbus, there is branch feat/splitview which pulls in blocks via BeaconBlocksByRoot in a backward motion, from peers specifically advertising unknown branches.

If the branch is long you can easily get DOS-ed, you can't validate any block until you root the branch on a known block

dapplion avatar Jul 25 '24 15:07 dapplion

I am closing this issue because it seems stale. Please, do not hesitate to reopen it if this is a mistake

leolara avatar Jun 04 '25 08:06 leolara

Still something I am pursuing to be included in the specs

dapplion avatar Jun 10 '25 13:06 dapplion

keen to know how you handle these situations

If you receive a chain segment that you didn't know about (can't link to a block you know), you've just received a signal that there's another fork you should probably consider syncing (either now or in the future) - this is a feature really, not a bug (because that chain might become canonical).

arnetheduck avatar Jun 10 '25 16:06 arnetheduck