Skip to main content

ValidatorEntry

Trait ValidatorEntry 

Source
pub trait ValidatorEntry {
    // Required methods
    fn public_key(&self) -> &PublicKey;
    fn puzzle_hash(&self) -> Bytes32;
    fn effective_balance(&self) -> u64;
    fn is_slashed(&self) -> bool;
    fn activation_epoch(&self) -> u64;
    fn exit_epoch(&self) -> u64;
    fn is_active_at_epoch(&self, epoch: u64) -> bool;
    fn slash_absolute(&mut self, amount_mojos: u64, epoch: u64) -> u64;
    fn credit_stake(&mut self, amount_mojos: u64) -> u64;
    fn restore_status(&mut self) -> bool;
    fn schedule_exit(&mut self, exit_lock_until_epoch: u64);
}
Expand description

Per-validator state accessor.

Traces to SPEC §15.1, catalogue rows DSL-131..135.

§Invariants (enforced by DSL-131..135 when those impls land)

  • slash_absolute saturates at effective-balance floor — cannot drive balance negative.
  • credit_stake returns the amount actually credited after any ceiling clamp.
  • restore_status is idempotent — returns true only when status actually changed.
  • is_active_at_epoch(epoch) is inclusive on activation, exclusive on exit (DSL-134 boundary behaviour).

Required Methods§

Source

fn public_key(&self) -> &PublicKey

Validator’s BLS G1 public key. Used by all signature verifiers.

Source

fn puzzle_hash(&self) -> Bytes32

Payout puzzle hash for participation rewards / whistleblower rewards (DSL-025, DSL-141).

Source

fn effective_balance(&self) -> u64

Current effective balance in mojos. Drives base-penalty math (DSL-022) and reward/penalty deltas (DSL-081..085).

Source

fn is_slashed(&self) -> bool

true if this validator has an outstanding slash (pending or finalised). Gates duplicate slashing (DSL-026).

Source

fn activation_epoch(&self) -> u64

Epoch the validator became active.

Source

fn exit_epoch(&self) -> u64

Epoch the validator scheduled exit at (or u64::MAX if none).

Source

fn is_active_at_epoch(&self, epoch: u64) -> bool

Activation-inclusive, exit-exclusive membership check at epoch.

Source

fn slash_absolute(&mut self, amount_mojos: u64, epoch: u64) -> u64

Debit amount_mojos from the effective balance (saturating). Returns the amount actually debited. DSL-131.

Source

fn credit_stake(&mut self, amount_mojos: u64) -> u64

Undo a prior slash_absolute (sustained appeal / reorg). Returns the amount actually credited. DSL-132.

Source

fn restore_status(&mut self) -> bool

Clear Slashed flag; restore active state. Idempotent. DSL-133. Returns true iff state actually changed.

Source

fn schedule_exit(&mut self, exit_lock_until_epoch: u64)

Schedule the post-finalisation exit lock. DSL-135.

Implementors§