Merge remote-tracking branch 'origin/unstable' into tree-states

This commit is contained in:
Michael Sproul
2022-03-01 16:03:41 +11:00
209 changed files with 6107 additions and 1362 deletions

View File

@@ -2,7 +2,7 @@
name = "network"
version = "0.2.0"
authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = "2018"
edition = "2021"
[dev-dependencies]
sloggers = { version = "2.1.1", features = ["json"] }

View File

@@ -5,10 +5,12 @@ use beacon_chain::{
use fnv::FnvHashMap;
pub use lighthouse_metrics::*;
use lighthouse_network::{
types::GossipKind, BandwidthSinks, GossipTopic, Gossipsub, NetworkGlobals,
peer_manager::peerdb::client::ClientKind, types::GossipKind, BandwidthSinks, GossipTopic,
Gossipsub, NetworkGlobals,
};
use std::sync::Arc;
use strum::AsStaticRef;
use strum::IntoEnumIterator;
use types::EthSpec;
lazy_static! {
@@ -343,6 +345,20 @@ pub fn update_gossip_metrics<T: EthSpec>(
network_globals: &Arc<NetworkGlobals<T>>,
) {
// Mesh peers per client
// Reset the gauges
for client_kind in ClientKind::iter() {
set_gauge_vec(
&BEACON_BLOCK_MESH_PEERS_PER_CLIENT,
&[&client_kind.to_string()],
0_i64,
);
set_gauge_vec(
&BEACON_AGGREGATE_AND_PROOF_MESH_PEERS_PER_CLIENT,
&[&client_kind.to_string()],
0_i64,
);
}
for topic_hash in gossipsub.topics() {
if let Ok(topic) = GossipTopic::decode(topic_hash.as_str()) {
match topic.kind() {

View File

@@ -23,7 +23,7 @@ use crate::metrics;
/// The minimum number of slots ahead that we attempt to discover peers for a subscription. If the
/// slot is less than this number, skip the peer discovery process.
/// Subnet discovery query takes atmost 30 secs, 2 slots take 24s.
/// Subnet discovery query takes at most 30 secs, 2 slots take 24s.
const MIN_PEER_DISCOVERY_SLOT_LOOK_AHEAD: u64 = 2;
/// The time (in slots) before a last seen validator is considered absent and we unsubscribe from the random
/// gossip topics that we subscribed to due to the validator connection.

View File

@@ -21,7 +21,7 @@ use crate::metrics;
/// The minimum number of slots ahead that we attempt to discover peers for a subscription. If the
/// slot is less than this number, skip the peer discovery process.
/// Subnet discovery query takes atmost 30 secs, 2 slots take 24s.
/// Subnet discovery query takes at most 30 secs, 2 slots take 24s.
const MIN_PEER_DISCOVERY_SLOT_LOOK_AHEAD: u64 = 2;
/// A particular subnet at a given slot.
@@ -115,7 +115,7 @@ impl<T: BeaconChainTypes> SyncCommitteeService<T> {
metrics::inc_counter(&metrics::SYNC_COMMITTEE_SUBSCRIPTION_REQUESTS);
//NOTE: We assume all subscriptions have been verified before reaching this service
// Registers the validator with the subnet service.
// Registers the validator with the subnet service.
// This will subscribe to long-lived random subnets if required.
trace!(self.log,
"Sync committee subscription";