diff --git a/beacon_node/lighthouse_network/src/service/mod.rs b/beacon_node/lighthouse_network/src/service/mod.rs index a97e09acd..24b707cf7 100644 --- a/beacon_node/lighthouse_network/src/service/mod.rs +++ b/beacon_node/lighthouse_network/src/service/mod.rs @@ -15,7 +15,8 @@ use crate::service::behaviour::BehaviourEvent; pub use crate::service::behaviour::Gossipsub; use crate::types::{ fork_core_topics, subnet_from_topic_hash, GossipEncoding, GossipKind, GossipTopic, - SnappyTransform, Subnet, SubnetDiscovery, + SnappyTransform, Subnet, SubnetDiscovery, ALTAIR_CORE_TOPICS, BASE_CORE_TOPICS, + CAPELLA_CORE_TOPICS, DENEB_CORE_TOPICS, LIGHT_CLIENT_GOSSIP_TOPICS, }; use crate::EnrExt; use crate::Eth2Enr; @@ -224,6 +225,15 @@ impl Network { // Set up a scoring update interval let update_gossipsub_scores = tokio::time::interval(params.decay_interval); + let max_topics = ctx.chain_spec.attestation_subnet_count as usize + + SYNC_COMMITTEE_SUBNET_COUNT as usize + + BLOB_SIDECAR_SUBNET_COUNT as usize + + BASE_CORE_TOPICS.len() + + ALTAIR_CORE_TOPICS.len() + + CAPELLA_CORE_TOPICS.len() + + DENEB_CORE_TOPICS.len() + + LIGHT_CLIENT_GOSSIP_TOPICS.len(); + let possible_fork_digests = ctx.fork_context.all_fork_digests(); let filter = gossipsub::MaxCountSubscriptionFilter { filter: utils::create_whitelist_filter( @@ -232,9 +242,10 @@ impl Network { SYNC_COMMITTEE_SUBNET_COUNT, BLOB_SIDECAR_SUBNET_COUNT, ), - max_subscribed_topics: 200, + // during a fork we subscribe to both the old and new topics + max_subscribed_topics: max_topics * 4, // 162 in theory = (64 attestation + 4 sync committee + 7 core topics + 6 blob topics) * 2 - max_subscriptions_per_request: 160, + max_subscriptions_per_request: max_topics * 2, }; let gossipsub_config_params = GossipsubConfigParams { diff --git a/beacon_node/lighthouse_network/src/types/mod.rs b/beacon_node/lighthouse_network/src/types/mod.rs index e7457f25d..af9e9ef45 100644 --- a/beacon_node/lighthouse_network/src/types/mod.rs +++ b/beacon_node/lighthouse_network/src/types/mod.rs @@ -18,5 +18,6 @@ pub use subnet::{Subnet, SubnetDiscovery}; pub use sync_state::{BackFillState, SyncState}; pub use topics::{ core_topics_to_subscribe, fork_core_topics, subnet_from_topic_hash, GossipEncoding, GossipKind, - GossipTopic, LIGHT_CLIENT_GOSSIP_TOPICS, + GossipTopic, ALTAIR_CORE_TOPICS, BASE_CORE_TOPICS, CAPELLA_CORE_TOPICS, DENEB_CORE_TOPICS, + LIGHT_CLIENT_GOSSIP_TOPICS, };