Struct TopicScoreParams
pub struct TopicScoreParams {Show 17 fields
pub topic_weight: f64,
pub time_in_mesh_weight: f64,
pub time_in_mesh_quantum: Duration,
pub time_in_mesh_cap: f64,
pub first_message_deliveries_weight: f64,
pub first_message_deliveries_decay: f64,
pub first_message_deliveries_cap: f64,
pub mesh_message_deliveries_weight: f64,
pub mesh_message_deliveries_decay: f64,
pub mesh_message_deliveries_cap: f64,
pub mesh_message_deliveries_threshold: f64,
pub mesh_message_deliveries_window: Duration,
pub mesh_message_deliveries_activation: Duration,
pub mesh_failure_penalty_weight: f64,
pub mesh_failure_penalty_decay: f64,
pub invalid_message_deliveries_weight: f64,
pub invalid_message_deliveries_decay: f64,
}
gossipsub
only.Fields§
§topic_weight: f64
The weight of the topic.
time_in_mesh_weight: f64
P1: time in the mesh
This is the time the peer has been grafted in the mesh.
The value of of the parameter is the time/time_in_mesh_quantum
, capped by time_in_mesh_cap
The weight of the parameter must be positive (or zero to disable).
time_in_mesh_quantum: Duration
§time_in_mesh_cap: f64
§first_message_deliveries_weight: f64
P2: first message deliveries
This is the number of message deliveries in the topic.
The value of the parameter is a counter, decaying with first_message_deliveries_decay
, and capped
by first_message_deliveries_cap
.
The weight of the parameter MUST be positive (or zero to disable).
first_message_deliveries_decay: f64
§first_message_deliveries_cap: f64
§mesh_message_deliveries_weight: f64
P3: mesh message deliveries
This is the number of message deliveries in the mesh, within the
mesh_message_deliveries_window
of message validation; deliveries during validation also
count and are retroactively applied when validation succeeds.
This window accounts for the minimum time before a hostile mesh peer trying to game the
score could replay back a valid message we just sent them.
It effectively tracks first and near-first deliveries, ie a message seen from a mesh peer
before we have forwarded it to them.
The parameter has an associated counter, decaying with mesh_message_deliveries_decay
.
If the counter exceeds the threshold, its value is 0.
If the counter is below the mesh_message_deliveries_threshold
, the value is the square of
the deficit, ie (message_deliveries_threshold - counter)^2
The penalty is only activated after mesh_message_deliveries_activation
time in the mesh.
The weight of the parameter MUST be negative (or zero to disable).
mesh_message_deliveries_decay: f64
§mesh_message_deliveries_cap: f64
§mesh_message_deliveries_threshold: f64
§mesh_message_deliveries_window: Duration
§mesh_message_deliveries_activation: Duration
§mesh_failure_penalty_weight: f64
P3b: sticky mesh propagation failures This is a sticky penalty that applies when a peer gets pruned from the mesh with an active mesh message delivery penalty. The weight of the parameter MUST be negative (or zero to disable)
mesh_failure_penalty_decay: f64
§invalid_message_deliveries_weight: f64
P4: invalid messages
This is the number of invalid messages in the topic.
The value of the parameter is the square of the counter, decaying with
invalid_message_deliveries_decay
.
The weight of the parameter MUST be negative (or zero to disable).
invalid_message_deliveries_decay: f64
Implementations§
Trait Implementations§
§impl Clone for TopicScoreParams
impl Clone for TopicScoreParams
§fn clone(&self) -> TopicScoreParams
fn clone(&self) -> TopicScoreParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for TopicScoreParams
impl Debug for TopicScoreParams
§impl Default for TopicScoreParams
impl Default for TopicScoreParams
NOTE: The topic score parameters are very network specific. For any production system, these values should be manually set.
§fn default() -> TopicScoreParams
fn default() -> TopicScoreParams
Auto Trait Implementations§
impl Freeze for TopicScoreParams
impl RefUnwindSafe for TopicScoreParams
impl Send for TopicScoreParams
impl Sync for TopicScoreParams
impl Unpin for TopicScoreParams
impl UnwindSafe for TopicScoreParams
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more