Skip to content

Add experimental tree-sync CLI flags#84

Open
dapplion wants to merge 18 commits into
unstablefrom
tree-sync-switch
Open

Add experimental tree-sync CLI flags#84
dapplion wants to merge 18 commits into
unstablefrom
tree-sync-switch

Conversation

@dapplion

Copy link
Copy Markdown
Owner

Summary

Adds three hidden, experimental network CLI flags to test a "tree sync" mode that routes peers through lookup sync instead of the usual range/lookup split.

  • --tree-sync — direct every peer with an unknown head straight to block (lookup) sync regardless of how far ahead it is, instead of splitting between range and lookup sync based on distance. While enabled, the lookup-sync depth and lookup-count caps are removed (unbounded) so the full lookup tree is followed without dropping chains.
  • --lookup-sync-max-parent-depth <DEPTH> — configure the parent-chain depth cap before lookup sync forces range sync. Default 32 (the previous PARENT_DEPTH_TOLERANCE).
  • --lookup-sync-max-lookups <COUNT> — configure the maximum number of concurrent block lookups held in memory. Default 200 (the previous MAX_LOOKUPS).

Changes

  • lighthouse_network Config: new tree_sync, lookup_sync_max_parent_depth, lookup_sync_max_lookups fields with defaults matching the historical constants.
  • beacon_node CLI/config: define and parse the three flags (all hide(true), experimental).
  • sync::manager: when tree_sync is set, add_peer routes unknown heads to handle_unknown_block_root; SyncManager::new passes usize::MAX for both limits under tree-sync (unbounded), otherwise the configured values.
  • sync::block_lookups: BlockLookups gains max_parent_depth / max_lookups fields, replacing the hardcoded PARENT_DEPTH_TOLERANCE / MAX_LOOKUPS constants in the depth and count checks.

Defaults are byte-equivalent to the previous constants, so behavior is unchanged unless a flag is passed.

Notes

  • The flags are hidden and experimental; intended for testing the tree-sync path in isolation.
  • Under --tree-sync the lookup OOM bound is intentionally removed, which is acceptable for a test flag.

https://claude.ai/code/session_01QWQUJsFGmRtt5Y4bxvXWba

eserilev and others added 16 commits May 24, 2026 16:51
… finalized portion of the chain

Handle the fork boundary condition
Introduce three hidden, experimental network flags to test a "tree sync"
mode that routes peers through lookup sync:

- `--tree-sync`: direct every peer with an unknown head to block (lookup)
  sync instead of splitting between range and lookup sync by distance.
  While enabled the lookup-sync depth and lookup-count caps are removed
  (unbounded) so the full lookup tree is followed without dropping chains.
- `--lookup-sync-max-parent-depth`: configure the parent-chain depth cap
  (default 32, the previous PARENT_DEPTH_TOLERANCE).
- `--lookup-sync-max-lookups`: configure the max concurrent lookups
  (default 200, the previous MAX_LOOKUPS).

The two limits are plumbed through NetworkConfig into BlockLookups,
replacing the former hardcoded constants.

Claude-Session: https://claude.ai/code/session_01QWQUJsFGmRtt5Y4bxvXWba
@dapplion dapplion requested a review from michaelsproul as a code owner June 26, 2026 11:56
dapplion added 2 commits June 28, 2026 13:29
Under --tree-sync, add_peer routes every unknown head to handle_unknown_block_root, which
calls should_search_for_block(None, peer). While the node isn't synced (e.g. right after a
checkpoint sync) that gate returns Err("not synced") for every slot-less head lookup, so no
lookup is created and the node never starts syncing (catch-22). Skip the gate under tree_sync,
matching the flag's intent of searching regardless of distance. Found via mainnet testing:
the node stalled at the anchor with repeated "Ignoring unknown block request: not synced".
Rename the experimental `--tree-sync` flag to `--disable-range-sync`, which
describes the actual effect: range sync is disabled and every peer with an
unknown head goes through block (lookup) sync.

Drop the `--lookup-sync-max-parent-depth` / `--lookup-sync-max-lookups`
customization flags. The lookup depth and count caps are simply removed
(set to unbounded) when range sync is disabled, since lookup sync is then
the only sync method and there is no range-sync fallback to escalate to;
otherwise they keep their default PARENT_DEPTH_TOLERANCE / MAX_LOOKUPS values.

Claude-Session: https://claude.ai/code/session_01QWQUJsFGmRtt5Y4bxvXWba
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.

2 participants