package octez-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Module for peers scores

type t

The type of peer scoring statistics.

type value
type span
type time = Time.t
type topic = Topic.t
val newly_connected : (topic, span) Gossipsub_intf.score_limits -> t

newly_connected params creates a fresh statistics record.

val value : t -> value

value ps evaluates the score of ps.

val penalty : t -> int -> t

penalty ps penalty increments the behavioural penalty of ps.

val set_connected : t -> t

set_connected ps marks ps as being associated to a connected peer.

val remove_peer : t -> retain_duration:span -> t option

remove_peer ps ~retain_duration will either return None if the peer statistics can be cleared, or Some ps' with ps' some statistics to be retained for at least retain_duration.

val expires : t -> time option

expires ps returns None if the score statistics has no expiration time or Some t if it expires at time t.

val graft : t -> topic -> t

graft ps topic allows to measure the time spent by the peer in the mesh. It is to be called upon grafting a peer to topic.

val prune : t -> topic -> t

prune ps topic allows to measure the time spent by the peer in the mesh. It is to be called upon pruning a peer from topic.

val first_message_delivered : t -> topic -> t

first_message_delivered ps topic increments the counter related to first message deliveries and mesh message deliveries on topic by the associated peer.

val duplicate_message_delivered : t -> topic -> time -> t

duplicate_message_delivered ps topic validated increments the counter related to near-first mesh message deliveries on topic by the associated peer. validated is the time at which the message was seen by the automaton for the first time.

val invalid_message_delivered : t -> topic -> t

invalid_message_delivered ps topic increments the counter related to invalid messages sent by the associated peer.

val set_application_score : t -> float -> t

set_application_score ps score sets the application-specific score. This score can be positive or negative.

val refresh : t -> t option

refresh ps returns Some ps' with ps' a refreshed score record or None if the score expired. Refreshing a ps allows to update time-dependent spects of the scoring statistics.

val zero : value

The zero score value, corresponding to a neutral score.

val of_float : float -> value

Convert a float into a score value.

include Tezos_stdlib.Compare.S with type t := value
val (=) : value -> value -> bool

x = y iff compare x y = 0

val (<>) : value -> value -> bool

x <> y iff compare x y <> 0

val (<) : value -> value -> bool

x < y iff compare x y < 0

val (<=) : value -> value -> bool

x <= y iff compare x y <= 0

val (>=) : value -> value -> bool

x >= y iff compare x y >= 0

val (>) : value -> value -> bool

x > y iff compare x y > 0

val compare : value -> value -> int

compare an alias for the functor parameter's compare function

val equal : value -> value -> bool

equal x y iff compare x y = 0

val max : value -> value -> value

max x y is x if x >= y otherwise it is y

val min : value -> value -> value

min x y is x if x <= y otherwise it is y

include Gossipsub_intf.PRINTABLE with type t := t
val pp : Stdlib.Format.formatter -> t -> unit
val pp_value : Stdlib.Format.formatter -> value -> unit
module Internal_for_tests : sig ... end
OCaml

Innovation. Community. Security.