mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Gossipsub scoring (#1668)
## Issue Addressed #1606 ## Proposed Changes Uses dynamic gossipsub scoring parameters depending on the number of active validators as specified in https://gist.github.com/blacktemplar/5c1862cb3f0e32a1a7fb0b25e79e6e2c. ## Additional Info Although the parameters got tested on Medalla, extensive testing using simulations on larger networks is still to be done and we expect that we need to change the parameters, although this might only affect constants within the dynamic parameter framework.
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
use prometheus::{HistogramOpts, HistogramTimer, Opts};
|
||||
use std::time::Duration;
|
||||
|
||||
use prometheus::core::{Atomic, GenericGauge, GenericGaugeVec};
|
||||
pub use prometheus::{
|
||||
Encoder, Gauge, GaugeVec, Histogram, HistogramVec, IntCounter, IntCounterVec, IntGauge,
|
||||
IntGaugeVec, Result, TextEncoder,
|
||||
@@ -164,6 +165,27 @@ pub fn get_int_gauge(int_gauge_vec: &Result<IntGaugeVec>, name: &[&str]) -> Opti
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_gauge<P: Atomic>(
|
||||
gauge_vec: &Result<GenericGaugeVec<P>>,
|
||||
name: &[&str],
|
||||
) -> Option<GenericGauge<P>> {
|
||||
if let Ok(gauge_vec) = gauge_vec {
|
||||
Some(gauge_vec.get_metric_with_label_values(name).ok()?)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_gauge_entry<P: Atomic>(
|
||||
gauge_vec: &Result<GenericGaugeVec<P>>,
|
||||
name: &[&str],
|
||||
value: P::T,
|
||||
) {
|
||||
if let Some(v) = get_gauge(gauge_vec, name) {
|
||||
v.set(value)
|
||||
};
|
||||
}
|
||||
|
||||
/// If `int_gauge_vec.is_ok()`, sets the gauge with the given `name` to the given `value`
|
||||
/// otherwise returns false.
|
||||
pub fn set_int_gauge(int_gauge_vec: &Result<IntGaugeVec>, name: &[&str], value: i64) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user