@@ -33,8 +33,8 @@ use task_executor::ShutdownReason;
3333use tokio:: sync:: mpsc;
3434use tokio:: time:: Sleep ;
3535use types:: {
36- ChainSpec , DataColumnSubnetId , EthSpec , ForkContext , Slot , SubnetId , SyncCommitteeSubscription ,
37- SyncSubnetId , Unsigned , ValidatorSubscription ,
36+ ChainSpec , EthSpec , ForkContext , Slot , SubnetId , SyncCommitteeSubscription , SyncSubnetId ,
37+ Unsigned , ValidatorSubscription ,
3838} ;
3939
4040mod tests;
@@ -181,8 +181,6 @@ pub struct NetworkService<T: BeaconChainTypes> {
181181 next_fork_subscriptions : Pin < Box < OptionFuture < Sleep > > > ,
182182 /// A delay that expires when we need to unsubscribe from old fork topics.
183183 next_unsubscribe : Pin < Box < OptionFuture < Sleep > > > ,
184- /// Subscribe to all the data column subnets.
185- subscribe_all_data_column_subnets : bool ,
186184 /// Subscribe to all the subnets once synced.
187185 subscribe_all_subnets : bool ,
188186 /// Shutdown beacon node after sync is complete.
@@ -349,7 +347,6 @@ impl<T: BeaconChainTypes> NetworkService<T> {
349347 next_fork_update,
350348 next_fork_subscriptions,
351349 next_unsubscribe,
352- subscribe_all_data_column_subnets : config. subscribe_all_data_column_subnets ,
353350 subscribe_all_subnets : config. subscribe_all_subnets ,
354351 shutdown_after_sync : config. shutdown_after_sync ,
355352 metrics_enabled : config. metrics_enabled ,
@@ -717,6 +714,7 @@ impl<T: BeaconChainTypes> NetworkService<T> {
717714 for topic_kind in core_topics_to_subscribe :: < T :: EthSpec > (
718715 self . fork_context . current_fork ( ) ,
719716 & self . fork_context . spec ,
717+ & self . network_globals . as_topic_config ( ) ,
720718 ) {
721719 for fork_digest in self . required_gossip_fork_digests ( ) {
722720 let topic = GossipTopic :: new (
@@ -751,10 +749,6 @@ impl<T: BeaconChainTypes> NetworkService<T> {
751749 }
752750 }
753751
754- if self . fork_context . spec . is_peer_das_scheduled ( ) {
755- self . subscribe_to_peer_das_topics ( & mut subscribed_topics) ;
756- }
757-
758752 // If we are to subscribe to all subnets we do it here
759753 if self . subscribe_all_subnets {
760754 for subnet_id in 0 ..<<T as BeaconChainTypes >:: EthSpec as EthSpec >:: SubnetBitfieldLength :: to_u64 ( ) {
@@ -801,37 +795,6 @@ impl<T: BeaconChainTypes> NetworkService<T> {
801795 }
802796 }
803797
804- /// Keeping these separate from core topics because it has custom logic:
805- /// 1. Data column subscription logic depends on subscription configuration.
806- /// 2. Data column topic subscriptions will be dynamic based on validator balances due to
807- /// validator custody.
808- ///
809- /// TODO(das): The downside with not including it in core fork topic is - we subscribe to
810- /// PeerDAS topics on startup if Fulu is scheduled, rather than waiting until the fork.
811- /// If this is an issue we could potentially consider adding the logic to
812- /// `network.subscribe_new_fork_topics()`.
813- fn subscribe_to_peer_das_topics ( & mut self , subscribed_topics : & mut Vec < GossipTopic > ) {
814- let column_subnets_to_subscribe = if self . subscribe_all_data_column_subnets {
815- & ( 0 ..self . fork_context . spec . data_column_sidecar_subnet_count )
816- . map ( DataColumnSubnetId :: new)
817- . collect ( )
818- } else {
819- & self . network_globals . sampling_subnets
820- } ;
821-
822- for column_subnet in column_subnets_to_subscribe. iter ( ) {
823- for fork_digest in self . required_gossip_fork_digests ( ) {
824- let gossip_kind = Subnet :: DataColumn ( * column_subnet) . into ( ) ;
825- let topic = GossipTopic :: new ( gossip_kind, GossipEncoding :: default ( ) , fork_digest) ;
826- if self . libp2p . subscribe ( topic. clone ( ) ) {
827- subscribed_topics. push ( topic) ;
828- } else {
829- warn ! ( self . log, "Could not subscribe to topic" ; "topic" => %topic) ;
830- }
831- }
832- }
833- }
834-
835798 /// Handle a message sent to the network service.
836799 async fn on_validator_subscription_msg ( & mut self , msg : ValidatorSubscriptionMessage ) {
837800 match msg {
@@ -947,6 +910,7 @@ impl<T: BeaconChainTypes> NetworkService<T> {
947910 let core_topics = core_topics_to_subscribe :: < T :: EthSpec > (
948911 self . fork_context . current_fork ( ) ,
949912 & self . fork_context . spec ,
913+ & self . network_globals . as_topic_config ( ) ,
950914 ) ;
951915 let core_topics: HashSet < & GossipKind > = HashSet :: from_iter ( & core_topics) ;
952916 let subscriptions = self . network_globals . gossipsub_subscriptions . read ( ) ;
0 commit comments