Skip to content
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

Add MetadataV3 with custody_subnet_count #3821

Merged
merged 2 commits into from
Aug 6, 2024
Merged

Add MetadataV3 with custody_subnet_count #3821

merged 2 commits into from
Aug 6, 2024

Conversation

dapplion
Copy link
Collaborator

When a node receives an inbound connection from another node it does not have a way to learn its custody_subnet_count. Currently, this value is only propagated via ENRs, so it's only guaranteed to be available in the outbound connection code-path.

It's important to learn the custody_subnet_count of all peers to discover and utilize supernodes.

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ralexstokes ralexstokes added the EIP-7594 PeerDAS label Jul 1, 2024
@cskiraly
Copy link
Contributor

cskiraly commented Jul 2, 2024

Makes sense to extend the Metadata with this.

I do wonder however why there is no GetENR among the req/resp messages. Wouldn't that be useful to avoid the need for these updates to the Metadata?

@dapplion
Copy link
Collaborator Author

dapplion commented Jul 3, 2024

I do wonder however why there is no GetENR among the req/resp messages. Wouldn't that be useful to avoid the need for these updates to the Metadata?

Because the ENR changes and adds keys we need strict versioning and a way to serialize the ENR as SSZ. Otherwise, we should stream an SSZ list of bytes with the ENR encoded as RLP.

@nisdas
Copy link
Contributor

nisdas commented Jul 3, 2024

Is there any reason you can't use gossipsub for this ? Not against this PR, but the gossipsub router tracks all connected peers and their subscribed topics. So once you are connected to a peer, you simply need to check the router for which topics a particular peer is subscribed to without requiring its custody count. This would save you a network request which might becomes a bottleneck if you have to determine this for many peers in a short amount of time.

@dapplion
Copy link
Collaborator Author

dapplion commented Jul 3, 2024

So once you are connected to a peer, you simply need to check the router for which topics a particular peer is subscribed to without requiring its custody count

There's some asynchrony there, as the peer may send the subscriptions later. You are right that both pieces of information should match. I recall Nimbus having some logic to penalize peers whose Gossipsub subscriptions do not match their ENR.

Copy link
Contributor

@jimmygchen jimmygchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Member

@ralexstokes ralexstokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense to include w/ the peerdas work

it looks like you changed the electra set of files -- can we update the EIP-7594 file instead?

@jimmygchen
Copy link
Contributor

Is there any reason you can't use gossipsub for this ? Not against this PR, but the gossipsub router tracks all connected peers and their subscribed topics. So once you are connected to a peer, you simply need to check the router for which topics a particular peer is subscribed to without requiring its custody count. This would save you a network request which might becomes a bottleneck if you have to determine this for many peers in a short amount of time.

I think the downside with looking only at subscribed topics is that we assume that peers are all honest and subscribe to their custody subnets. With custody count, we'll be able to identity what the nodes are supposed to custody, and still send sampling requests to them (even if they're not subscribed for some reasons) and penalise them accordingly if they can't serve the requests.

@wemeetagain
Copy link
Contributor

I do wonder however why there is no GetENR among the req/resp messages.

we should stream an SSZ list of bytes with the ENR encoded as RLP.

Is this a crazy idea? For peers who have dialed us, we won't have discovery port information, so can't easily query the peer's discv5 for its ENR. This potentially could be useful there too.

Copy link
Member

@ppopth ppopth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Just make the MetaData the same as the ENR.

@ppopth
Copy link
Member

ppopth commented Jul 26, 2024

I do wonder however why there is no GetENR among the req/resp messages. Wouldn't that be useful to avoid the need for these updates to the Metadata?

@cskiraly You can already do the GetENR thing using devp2p (not libp2p). See https://github.com/ethereum/devp2p/blob/master/discv5/discv5-wire.md#findnode-request-0x03

You can do FINDNODE with distance 0

@nalepae
Copy link
Contributor

nalepae commented Aug 6, 2024

For information we implemented it in Prysm: prysmaticlabs/prysm#14274

@hwwhww hwwhww mentioned this pull request Aug 6, 2024
4 tasks
Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. thanks!

@hwwhww hwwhww merged commit 572ca9e into ethereum:dev Aug 6, 2024
26 checks passed
@dapplion dapplion deleted the csc branch August 8, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants