-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: peerdas - ensure there are at least n peers per sampling column subnet #7274
base: peerDAS
Are you sure you want to change the base?
Conversation
review note: look at packages/beacon-node/src/sync/range/utils/peerBalancer.ts and talk to @twoeths about sync strategy and how this PR affects that (or should it if not) |
type CachedENR = { | ||
peerId: PeerId; | ||
multiaddrTCP: Multiaddr; | ||
subnets: Record<SubnetType, boolean[]>; | ||
addedUnixMs: number; | ||
custodySubnetCount: number; | ||
peerCustodySubnets: number[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ain't the spec right? if not are you proposing a spec change in line with this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is implementation specific and not part of the spec
here we store peerCustodySubnets
once to reuse later
if (oldMetadata === null || oldMetadata.csc !== peerData.metadata.csc) { | ||
void this.requestStatus(peer, this.statusCache.get()); | ||
} | ||
// TODO: why request status again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should request metadata if metadata is old or non existent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to request status again in order to update network's datacolumns of this peer, will add that to the comment
as requested by @g11tech I added back |
// TODO: could be optimized by directly using the previously calculated subnet | ||
const dataColumns = getDataColumns(nodeId, peerCustodySubnetCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just remove in favor of peerCustodySubnets
/** | ||
* A map of column subnet id to maxPeersToDiscover | ||
*/ | ||
type ColumnSubnetQueries = Map<ColumnSubnetId, number>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is defined several places, maybe pick one place?
@@ -332,15 +332,21 @@ export class PeerManager { | |||
}); | |||
if (peerData) { | |||
const oldMetadata = peerData.metadata; | |||
const csc = (metadata as Partial<peerdas.Metadata>).csc ?? this.config.CUSTODY_REQUIREMENT; | |||
const nodeId = peerData?.nodeId ?? computeNodeId(peer); | |||
const custodySubnets = (csc !== oldMetadata?.csc || oldMetadata?.custodySubnets == null)? getDataColumnSubnets(nodeId, csc) : oldMetadata?.custodySubnets; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would oldMetadata?.custodySubnets
ever be null?
Maybe more clear to do
const custodySubnets = oldMetadata == null || csc !== oldMetadata.csc
? getDataColumnSubnets(nodeId, csc)
: oldMetadata.custodySubnets;
Motivation
8
data columns from sampling subnetsn
number of peers per subnet for nown
number of peers per column sampling subnetDescription
custodySubnets
inpeersData
so that we don't have to compute it all the timestargetColumnSubnetPeers = 6
which make it easy to achieve after a few heartbeats but this could be changed with a newly added cli flag with the same nameonlyConnect*
flags