Skip to content

Tree sync #7678

@dapplion

Description

@dapplion

Currently forwards sync fetches ranges of blocks by range from either head or latest finalized until reaching the target, from a set of peers with the same status messages. This approach has fundamental issues that make the sync complex and susceptible to griefing attacks. (I'll describe those later)

Proposal

Divide forward sync into two phases:

  1. Header backfill: construct an in-memory tree from all unknown received by peers (status, unknown attestations, etc) and backfill until reaching a known block or conflicting with finality.
  2. Forward sync with knowledge of what block roots to expect at each slot and perfect peer grouping.

This model allows us to address all those issues and delete a lot of code. All lookup sync, by_range routes, batching, optimistic batches, among others, are deleted.

Progress

Internal impl

PoC dapplion#46

  1. Add more test coverage of sync tests (agnostic of range or lookup sync) Tree-sync friendly lookup sync tests #8592
  2. When creating a lookup fetch its ancestor headers until one is known or conflicts with finality
  3. Introduce a new ReqResp route headers_by_root to make 1. fast and efficient
  4. Make lookup sync downloads more efficient by buffering downloads (like range sync does)
  5. Make lookup sync processing efficient by processing its components in batch
  6. Remove the max-depth limit of lookup and sync, and trigger lookup sync when a peer's status message contains an unknown root
  7. Delete range sync

Spec

  • Add headers_by_root p2p spec

Related resources

Metadata

Metadata

Assignees

Labels

major-taskA significant amount of work or conceptual task.syncing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions