Add experimental tree-sync CLI flags#84
Open
dapplion wants to merge 18 commits into
Open
Conversation
…ulated in most cases
…oas-head-block-number
…oas-head-block-number
…oas-head-block-number
…lighthouse into gloas-head-block-number
…oas-head-block-number
… 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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. Default32(the previousPARENT_DEPTH_TOLERANCE).--lookup-sync-max-lookups <COUNT>— configure the maximum number of concurrent block lookups held in memory. Default200(the previousMAX_LOOKUPS).Changes
lighthouse_networkConfig: newtree_sync,lookup_sync_max_parent_depth,lookup_sync_max_lookupsfields with defaults matching the historical constants.beacon_nodeCLI/config: define and parse the three flags (allhide(true), experimental).sync::manager: whentree_syncis set,add_peerroutes unknown heads tohandle_unknown_block_root;SyncManager::newpassesusize::MAXfor both limits under tree-sync (unbounded), otherwise the configured values.sync::block_lookups:BlockLookupsgainsmax_parent_depth/max_lookupsfields, replacing the hardcodedPARENT_DEPTH_TOLERANCE/MAX_LOOKUPSconstants in the depth and count checks.Defaults are byte-equivalent to the previous constants, so behavior is unchanged unless a flag is passed.
Notes
--tree-syncthe lookup OOM bound is intentionally removed, which is acceptable for a test flag.https://claude.ai/code/session_01QWQUJsFGmRtt5Y4bxvXWba