Skip to main content

ValidatorView

Trait ValidatorView 

Source
pub trait ValidatorView {
    // Required methods
    fn get(&self, index: u32) -> Option<&dyn ValidatorEntry>;
    fn get_mut(&mut self, index: u32) -> Option<&mut dyn ValidatorEntry>;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Validator-set read+write surface consumed by the verifiers and slashing manager.

Traces to SPEC §15.1, catalogue row DSL-136.

§Scope

ValidatorView is the narrow surface dig-slashing needs to read (and mutate, on slash/appeal) per-validator state owned by the consensus layer. The full trait surface is defined here so every function signature in this crate can accept &dyn ValidatorView / &mut dyn ValidatorView; concrete impls land in dig-consensus and in test fixtures.

§Consumer list

  • verify_evidence (DSL-011..020) — read-only for precondition checks (registered, active, not-already-slashed).
  • SlashingManager::submit_evidence (DSL-022) — mutating for per-validator debit via ValidatorEntry::slash_absolute.
  • AppealAdjudicator (DSL-064..067) — mutating for credit / restore_status on sustained appeals.

Required Methods§

Source

fn get(&self, index: u32) -> Option<&dyn ValidatorEntry>

Immutable lookup. None when index is not registered.

Source

fn get_mut(&mut self, index: u32) -> Option<&mut dyn ValidatorEntry>

Mutable lookup (for slash / credit / restore on adjudication).

Source

fn len(&self) -> usize

Number of registered validators.

Provided Methods§

Source

fn is_empty(&self) -> bool

Convenience predicate matching Vec::is_empty contract.

Implementors§