Sigil documentation
ReferenceRust referencesigil-consensus

sigil-consensus · validator

Source declarations, signatures and documentation for validator.

Source: sigil/node/sigil-consensus/src/validator.rs. SHA-256: 99e8d2349bcc96bc6c2a7bcdb790403f6d6e8f1d9358bb15bee8b1c3438b2c2a.

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.

validator::Validator

A validator in the active consensus set.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Validator {
/// OAS DID of the validator entity.

pub did: String,
/// Human root DID in the lineage chain (OAS lineage requirement).

pub human_root_did: String,
/// Generation distance from human root.

pub generation: u32,
/// Staked amount in micro-MINT.

pub stake: u64,
/// Whether this validator is a Block Producer or Block Validator.

pub mode: ValidatorMode,
/// Uptime ratio (0.0 to 1.0) measured over the recent window.

pub uptime: f64,
/// OATS composite trust score (0.0 to 1.0).

pub trust_score: f64,
/// Hardware performance metric (0.0 to 1.0).

pub hw_performance: f64,
/// Recent consensus participation rate (0.0 to 1.0).

pub participation: f64,
/// Ed25519 consensus public key bytes.

pub consensus_pubkey: Vec<u8>
}

Source line: 11.

validator::ValidatorSet

The active validator set for an epoch.

Contains all validators that are eligible to participate in consensus during the current epoch. The total stake is cached for efficient quorum threshold calculations.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ValidatorSet {

}

Source line: 40.

validator::ValidatorSet::new

Create a new validator set from a list of validators.

Computes the total stake from all validators.

pub fn new(validators: Vec<Validator>) -> Self;

Source line: 51.

validator::ValidatorSet::total_stake

Returns the total stake across all validators.

pub fn total_stake(&self) -> u64;

Source line: 60.

validator::ValidatorSet::quorum_threshold

Returns the quorum threshold: the minimum stake required for 2/3 + 1.

For Byzantine fault tolerance, we need strictly more than 2/3 of the total stake. Uses u128 intermediate to prevent overflow when total_stake > u64::MAX / 2.

pub fn quorum_threshold(&self) -> u64;

Source line: 69.

validator::ValidatorSet::get_validator

Look up a validator by DID.

pub fn get_validator(&self, did: &str) -> Option<&Validator>;

Source line: 78.

validator::ValidatorSet::stake_of

Returns the stake of a specific validator, or 0 if not found.

pub fn stake_of(&self, did: &str) -> u64;

Source line: 83.

validator::ValidatorSet::is_block_producer

Returns true if the given DID is a Block Producer.

pub fn is_block_producer(&self, did: &str) -> bool;

Source line: 88.

validator::ValidatorSet::block_producers

Returns an iterator over Block Producers.

pub fn block_producers(&self) -> impl Iterator<Item = &Validator>;

Source line: 94.

validator::ValidatorSet::block_validators

Returns an iterator over Block Validators.

pub fn block_validators(&self) -> impl Iterator<Item = &Validator>;

Source line: 101.

validator::ValidatorSet::contains

Returns true if the validator set contains the given DID.

pub fn contains(&self, did: &str) -> bool;

Source line: 108.

validator::ValidatorSet::len

Returns the number of validators in the set.

pub fn len(&self) -> usize;

Source line: 113.

validator::ValidatorSet::is_empty

Returns true if the validator set is empty.

pub fn is_empty(&self) -> bool;

Source line: 118.

validator::ValidatorSet::iter

Returns an iterator over all validators.

pub fn iter(&self) -> impl Iterator<Item = &Validator>;

Source line: 123.

validator::ValidatorSet::validators

Returns a slice of all validators.

pub fn validators(&self) -> &[Validator];

Source line: 128.

On this page