pub struct LivenessTracker { /* private fields */ }Expand description
Tracks validator liveness within an epoch by counting missed commit-QC signatures.
Deterministic: All nodes derive liveness data from committed QC signer bitfields stored on-chain, so the same set of offline validators is reported deterministically at epoch boundaries.
Implementations§
Source§impl LivenessTracker
impl LivenessTracker
Sourcepub fn record_commit(&mut self, validator_set: &ValidatorSet, signers: &[bool])
pub fn record_commit(&mut self, validator_set: &ValidatorSet, signers: &[bool])
Record a committed block’s QC signer bitfield.
signers is the commit-QC’s signer bitfield (index-aligned with the
validator set). Validators whose bit is false are counted as having
missed this commit.
Sourcepub fn offline_validators(&self) -> Vec<(ValidatorId, u64, u64)>
pub fn offline_validators(&self) -> Vec<(ValidatorId, u64, u64)>
Return validators whose miss rate exceeds the offline threshold.
Returns (ValidatorId, missed_count, total_commits) for each offline
validator, suitable for the application to apply downtime slashing.
Sourcepub fn stats(&self, id: ValidatorId) -> (u64, u64)
pub fn stats(&self, id: ValidatorId) -> (u64, u64)
Get liveness stats for a specific validator.
Sourcepub fn total_commits(&self) -> u64
pub fn total_commits(&self) -> u64
Current number of tracked commits.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LivenessTracker
impl RefUnwindSafe for LivenessTracker
impl Send for LivenessTracker
impl Sync for LivenessTracker
impl Unpin for LivenessTracker
impl UnsafeUnpin for LivenessTracker
impl UnwindSafe for LivenessTracker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more