sigil-tower · inclusion
Source declarations, signatures and documentation for inclusion.
Source: sigil/node/sigil-tower/src/inclusion.rs. SHA-256: 0589e0afc403dc8b62d9128b06d9c7d8149e7d5c1be3c221f3efcd7baf038d67.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
inclusion::InclusionScorer
Weights for the 6-component inclusion scoring formula.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InclusionScorer {
/// Weight for normalized stake (default 0.25).
pub w_stake: f64,
/// Weight for OATS trust score (default 0.25).
pub w_oats: f64,
/// Weight for uptime ratio (default 0.20).
pub w_uptime: f64,
/// Weight for lineage quality (default 0.15).
pub w_lineage: f64,
/// Weight for liveness / recent participation (default 0.15).
pub w_liveness: f64,
/// Weight for concentration penalty (default 0.10, subtracted).
pub w_concentration: f64
}Source line: 19.
inclusion::ValidatorMetrics
Metrics for a single validator used in inclusion scoring. All values should be in [0.0, 1.0].
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ValidatorMetrics {
/// Validator's stake as a fraction of total stake.
pub normalized_stake: f64,
/// OATS composite trust score (0.0 - 1.0).
pub oats_score: f64,
/// Uptime ratio over recent window (0.0 - 1.0).
pub uptime_ratio: f64,
/// Normalized lineage quality / depth (0.0 - 1.0).
pub lineage_depth: f64,
/// Recent participation / liveness rate (0.0 - 1.0).
pub liveness_score: f64,
/// Concentration ratio: how much this validator dominates stake (0.0 - 1.0).
pub concentration_ratio: f64
}Source line: 50.
inclusion::ValidatorMetrics::validate
Validate that all metric fields are within the expected [0.0, 1.0] range and contain no NaN or infinite values.
SECURITY: Unbounded or NaN metrics could produce nonsensical inclusion scores, allowing a malicious validator to game committee selection by injecting out-of-range values that inflate their score.
pub fn validate(&self) -> Result<(), String>;Source line: 72.
inclusion::InclusionScorer::score
Compute the inclusion score for a single validator's metrics.
pub fn score(&self, metrics: &ValidatorMetrics) -> f64;Source line: 95.
inclusion::InclusionScorer::score_all
Score all validators, returning a vec of (DID, score) pairs sorted by score descending.
pub fn score_all(
&self,
validators: &[(&ValidatorRecord, &ValidatorMetrics)],
) -> Vec<(String, f64)>;Source line: 106.