Skip to content

Commit 7872223

Browse files
authored
nodeFilter: Add GossipBlobSidecarMessage case. (#14822)
Before this commit, this kind of logs were possible: ``` [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_0/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_1/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_2/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_3/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_4/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_5/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_6/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_7/ssz_snappy [2025-01-22 17:18:48] DEBUG sync: Could not search for peers error=node filter: no subnet exists for provided topic: /eth2/d1f05cae/blob_sidecar_8/ssz_snappy ``` Note this bug has no real other impact than logging these errors: Since all nodes are subscribed to these subnets, as soon as some peers are found, there is no more issue. Why not using `s.subscribe` instead of `s.subscribeWithParameters`? Blobs subnets were before considered as static subnets. But since Electra, the number of subnets is a function of the epoch. So it's better to use `s.subscribeWithParameters` than 2 specific but almost identic functions in `s.subscribe`. Why `filterPeerForBlobSubnet` is the only one returning always `true`? Because blobs subnets are actually the only subnets which are both dynamic AND which have to be subscribed by all the nodes. So, `filterPeerForBlobSubnet` does not filter out any node.
1 parent 3ffef02 commit 7872223

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

beacon-chain/p2p/subnets.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ func (s *Service) nodeFilter(topic string, index uint64) (func(node *enode.Node)
5454
return s.filterPeerForAttSubnet(index), nil
5555
case strings.Contains(topic, GossipSyncCommitteeMessage):
5656
return s.filterPeerForSyncSubnet(index), nil
57+
case strings.Contains(topic, GossipBlobSidecarMessage):
58+
return s.filterPeerForBlobSubnet(), nil
5759
default:
5860
return nil, errors.Errorf("no subnet exists for provided topic: %s", topic)
5961
}
@@ -266,6 +268,14 @@ func (s *Service) filterPeerForSyncSubnet(index uint64) func(node *enode.Node) b
266268
}
267269
}
268270

271+
// returns a method with filters peers specifically for a particular blob subnet.
272+
// All peers are supposed to be subscribed to all blob subnets.
273+
func (s *Service) filterPeerForBlobSubnet() func(_ *enode.Node) bool {
274+
return func(_ *enode.Node) bool {
275+
return true
276+
}
277+
}
278+
269279
// lower threshold to broadcast object compared to searching
270280
// for a subnet. So that even in the event of poor peer
271281
// connectivity, we can still broadcast an attestation.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Fixed
2+
3+
- `nodeFilter`: Implement `filterPeerForBlobSubnet` to avoid error logs.

0 commit comments

Comments
 (0)