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 authored and nisdas committed Aug 14, 2024
1 parent 66c03fc commit 4c677c2
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 @@ -42,11 +42,17 @@ 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" }

// 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 @@ -262,6 +268,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 4c677c2

Please sign in to comment.