Skip to content

Commit

Permalink
Implement custody_subnet_count ENR field. (#13915)
Browse files Browse the repository at this point in the history
  • Loading branch information
nalepae committed Nov 25, 2024
1 parent de73022 commit 2826e90
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion beacon-chain/p2p/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const (
udp6
)

type quicProtocol uint16
type (
quicProtocol uint16
custodySubnetCount uint64
)

// quicProtocol is the "quic" key, which holds the QUIC port of the node.
func (quicProtocol) ENRKey() string { return "quic" }
Expand Down Expand Up @@ -133,6 +136,9 @@ func (l *listenerWrapper) RebootListener() error {
return nil
}

// https://github.com/ethereum/consensus-specs/blob/dev/specs/_features/eip7594/p2p-interface.md#the-discovery-domain-discv5
func (custodySubnetCount) ENRKey() string { return "custody_subnet_count" }

// RefreshPersistentSubnets checks that we are tracking our local persistent subnets for a variety of gossip topics.
// This routine checks for our attestation, sync committee and data column subnets and updates them if they have
// been rotated.
Expand Down Expand Up @@ -371,6 +377,11 @@ func (s *Service) createLocalNode(
localNode.Set(quicEntry)
}

if features.Get().EnablePeerDAS {
custodySubnetEntry := custodySubnetCount(params.BeaconConfig().CustodyRequirement)
localNode.Set(custodySubnetEntry)
}

localNode.SetFallbackIP(ipAddr)
localNode.SetFallbackUDP(udpPort)

Expand Down

0 comments on commit 2826e90

Please sign in to comment.