From 199f81fadbacfa64cf6fe866881ff30110ead0c8 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Thu, 9 Oct 2025 11:34:31 +1000 Subject: [PATCH 1/2] feat(p2p): allow subscribing to all attestation subnets This change introduces a configuration flag, `flags.Get().SubscribeToAllSubnets`, to enable subscribing to all available attestation subnets instead of only those currently tracked in `cache.SubnetIDs.GetAllSubnets()`. This is useful for nodes that need to participate in all potential committees regardless of current committee assignments. --- beacon-chain/p2p/discovery.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/beacon-chain/p2p/discovery.go b/beacon-chain/p2p/discovery.go index a8b0f59d6bb3..eeb03c8f15ec 100644 --- a/beacon-chain/p2p/discovery.go +++ b/beacon-chain/p2p/discovery.go @@ -181,9 +181,16 @@ func (s *Service) RefreshPersistentSubnets() { // Get the current attestation subnet bitfield. bitV := bitfield.NewBitvector64() - attestationCommittees := cache.SubnetIDs.GetAllSubnets() - for _, idx := range attestationCommittees { - bitV.SetBitAt(idx, true) + if flags.Get().SubscribeToAllSubnets { + // Set all 64 bits for all attestation subnets + for i := uint64(0); i < params.BeaconConfig().AttestationSubnetCount; i++ { + bitV.SetBitAt(i, true) + } + } else { + attestationCommittees := cache.SubnetIDs.GetAllSubnets() + for _, idx := range attestationCommittees { + bitV.SetBitAt(idx, true) + } } // Get the attestation subnet bitfield we store in our record. From 87fda4e79dfd678bfd7e2129c10bf05b90659ba4 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Thu, 9 Oct 2025 12:47:00 +1000 Subject: [PATCH 2/2] feat(p2p): implement test for SubscribeToAllSubnets flag functionality docs(changelog): add entry for fixing all subnets advertisement with flag --- changelog/samcm_fix-attnets-metadata-all-subnets.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/samcm_fix-attnets-metadata-all-subnets.md diff --git a/changelog/samcm_fix-attnets-metadata-all-subnets.md b/changelog/samcm_fix-attnets-metadata-all-subnets.md new file mode 100644 index 000000000000..e903d59ac76b --- /dev/null +++ b/changelog/samcm_fix-attnets-metadata-all-subnets.md @@ -0,0 +1,3 @@ +### Fixed + +- Fixed `--subscribe-all-subnets` flag to correctly advertise all 64 attestation subnets in reqresp metadata.