Skip to content

Commit

Permalink
Remove sync_committee_subnet_count from ChainSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Aug 2, 2021
1 parent 940535c commit 68357f3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions beacon_node/eth2_libp2p/src/behaviour/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ use std::{
task::{Context, Poll},
};
use types::{
ChainSpec, EnrForkId, EthSpec, ForkContext, SignedBeaconBlock, Slot, SubnetId, SyncSubnetId,
consts::altair::SYNC_COMMITTEE_SUBNET_COUNT, ChainSpec, EnrForkId, EthSpec, ForkContext,
SignedBeaconBlock, Slot, SubnetId, SyncSubnetId,
};

pub mod gossipsub_scoring_parameters;
Expand Down Expand Up @@ -213,7 +214,7 @@ impl<TSpec: EthSpec> Behaviour<TSpec> {
filter: Self::create_whitelist_filter(
possible_fork_digests,
chain_spec.attestation_subnet_count,
chain_spec.sync_committee_subnet_count,
SYNC_COMMITTEE_SUBNET_COUNT,
),
max_subscribed_topics: 200, //TODO change this to a constant
max_subscriptions_per_request: 100, //this is according to the current go implementation
Expand Down
7 changes: 5 additions & 2 deletions beacon_node/network/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use fnv::FnvHashMap;
pub use lighthouse_metrics::*;
use std::{collections::HashMap, sync::Arc};
use strum::AsStaticRef;
use types::{subnet_id::subnet_id_to_string, sync_subnet_id::sync_subnet_id_to_string, EthSpec};
use types::{
consts::altair::SYNC_COMMITTEE_SUBNET_COUNT, subnet_id::subnet_id_to_string,
sync_subnet_id::sync_subnet_id_to_string, EthSpec,
};

lazy_static! {

Expand Down Expand Up @@ -597,7 +600,7 @@ pub fn update_gossip_metrics<T: EthSpec>(
.map(|v| v.set(0));
}

for subnet_id in 0..T::default_spec().sync_committee_subnet_count {
for subnet_id in 0..SYNC_COMMITTEE_SUBNET_COUNT {
let _ = get_int_gauge(
&MESH_PEERS_PER_SYNC_SUBNET_TOPIC,
&[sync_subnet_id_to_string(subnet_id)],
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/network/src/subnet_service/sync_subnets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ impl<T: BeaconChainTypes> SyncCommitteeService<T> {
/// Return count of all currently subscribed subnets.
#[cfg(test)]
pub fn subscription_count(&self) -> usize {
use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT;
if self.subscribe_all_subnets {
self.beacon_chain.spec.sync_committee_subnet_count as usize
SYNC_COMMITTEE_SUBNET_COUNT as usize
} else {
self.subscriptions.len()
}
Expand Down
2 changes: 0 additions & 2 deletions consensus/types/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ pub struct ChainSpec {
pub maximum_gossip_clock_disparity_millis: u64,
pub target_aggregators_per_committee: u64,
pub attestation_subnet_count: u64,
pub sync_committee_subnet_count: u64,
pub random_subnets_per_validator: u64,
pub epochs_per_random_subnet_subscription: u64,
}
Expand Down Expand Up @@ -464,7 +463,6 @@ impl ChainSpec {
network_id: 1, // mainnet network id
attestation_propagation_slot_range: 32,
attestation_subnet_count: 64,
sync_committee_subnet_count: 4,
random_subnets_per_validator: 1,
maximum_gossip_clock_disparity_millis: 500,
target_aggregators_per_committee: 16,
Expand Down

0 comments on commit 68357f3

Please sign in to comment.