Skip to main content

Module peer_reputation

Module peer_reputation 

Source
Expand description

Peer Reputation Manager — long-term behavioral scoring for trust-weighted routing.

Tracks per-peer reputation scores derived from a stream of PrReputationEvents. Scores are clamped to [0.0, 1.0], decay toward the neutral value of 0.5 each tick, and drive tier classification used by connection prioritisation and routing.

§Quick start

use ipfrs_network::peer_reputation::{
    PeerReputationManager, PrReputationConfig, PrReputationEvent,
};

let cfg = PrReputationConfig::default();
let mut mgr = PeerReputationManager::new(cfg);

mgr.record_event("peer-A", PrReputationEvent::BlockDelivered { bytes: 4096 });
mgr.record_event("peer-A", PrReputationEvent::GoodProof);

let score = mgr.score("peer-A").expect("peer exists");
assert!(score.is_trusted());

Structs§

PeerReputationManager
Manages long-term reputation scores for a set of remote peers.
PrReputationConfig
Tuning parameters for score deltas and temporal decay.
PrReputationScore
Long-term reputation score for a single peer.
PrReputationStats
Aggregate statistics across all tracked peers.

Enums§

PrReputationEvent
A discrete behavioural observation for a remote peer.