Add per subnet subscribers target for dynamic peer requirements#9889
Open
zilm13 wants to merge 6 commits intoConsensys:masterfrom
Open
Add per subnet subscribers target for dynamic peer requirements#9889zilm13 wants to merge 6 commits intoConsensys:masterfrom
zilm13 wants to merge 6 commits intoConsensys:masterfrom
Conversation
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.
PR Description
We have flag and configurable variable:
--Xp2p-target-subnet-subscriber-countwhich currently defaults to 2. It's required by the spec. It's very strange, but it's required by the spec. It checks the number of subnet subscription and if there is any, it will return it's value. So with default 2 it requires 2 total peers for any number of subscriptions. No subscriptions - 0 peers, 1,2,3,100 subnets - 2 peers total.I've introduced flag
--Xp2p-target-per-subnet-subscriber-countwhich is a configuration how many peers are required for each subnet. It's goal is to dynamically require additional peers depending on the node subnet subcriptions. So if say, you are a supernode with 128 subnets, you require 128 peers, if you need 8 custody subscriptiions, you require 8 peers. It's an experimental flag and defaults to unset so it will not affect any current behavior.Fixed Issue(s)
Documentation
doc-change-requiredlabel to this PR if updates are required.Changelog
Note
Medium Risk
Changes peer requirement calculation used by peer selection to optionally scale with the number of subscribed subnets, which can affect target peer counts and network connectivity behavior. Default remains unset so existing behavior is preserved unless the new hidden flag is enabled.
Overview
Introduces a new hidden config/CLI option
--Xp2p-target-per-subnet-subscriber-count(stored asOptionalIntinP2PConfig) to optionally specify a per-subnet subscriber target.Updates
PeerSubnetSubscriptions.getSubscribersRequired()to account for this per-subnet target by computing total subscriber shortfall across relevant attestation, sync committee, and data column sidecar subnets, and taking the max of that and the existing global/subnet-minimum based requirement.Wires the new config through
Eth2P2PNetworkBuilderintoPeerSubnetSubscriptions.create, updates test fixtures, and adds/updates tests and YAML config parsing to cover the new setting.Written by Cursor Bugbot for commit 026a65e. This will update automatically on new commits. Configure here.