pub struct ValidatorInfo {
pub pubkey: [u8; 32],
pub stake: Balance,
pub total_delegated: Balance,
pub commission_bps: u16,
pub status: ValidatorStatus,
pub joined_at: BlockHeight,
pub jailed_until: BlockHeight,
pub slash_count: u32,
pub pending_rewards: Balance,
pub metadata: Vec<u8>,
}Expand description
Validator information stored on-chain
Fields§
§pubkey: [u8; 32]Validator’s Ed25519 public key (32 bytes)
stake: BalanceSelf-staked amount
total_delegated: BalanceTotal amount delegated to this validator by others
commission_bps: u16Commission rate in basis points (100 = 1%, max 10000 = 100%)
status: ValidatorStatusCurrent status
joined_at: BlockHeightBlock height when validator joined
jailed_until: BlockHeightBlock height when validator was jailed (0 if not jailed)
slash_count: u32Number of times this validator has been slashed
pending_rewards: BalanceAccumulated rewards (not yet claimed)
metadata: Vec<u8>Optional metadata (e.g., name, website) - max 256 bytes
Implementations§
Source§impl ValidatorInfo
impl ValidatorInfo
Sourcepub fn new(
pubkey: [u8; 32],
stake: Balance,
commission_bps: u16,
joined_at: BlockHeight,
) -> Self
pub fn new( pubkey: [u8; 32], stake: Balance, commission_bps: u16, joined_at: BlockHeight, ) -> Self
Create a new validator with initial stake
Sourcepub fn total_stake(&self) -> Balance
pub fn total_stake(&self) -> Balance
Get total voting power (self-stake + delegations)
Sourcepub fn add_delegation(&mut self, amount: Balance)
pub fn add_delegation(&mut self, amount: Balance)
Add delegation to this validator
Sourcepub fn remove_delegation(&mut self, amount: Balance)
pub fn remove_delegation(&mut self, amount: Balance)
Remove delegation from this validator
Sourcepub fn can_unjail(&self, current_height: BlockHeight) -> bool
pub fn can_unjail(&self, current_height: BlockHeight) -> bool
Check if validator can be unjailed at given height
Sourcepub fn apply_slash(&mut self, penalty_bps: u16)
pub fn apply_slash(&mut self, penalty_bps: u16)
Apply a slash penalty
Sourcepub fn jail(&mut self, until_height: BlockHeight)
pub fn jail(&mut self, until_height: BlockHeight)
Jail the validator until a specific height
Trait Implementations§
Source§impl Clone for ValidatorInfo
impl Clone for ValidatorInfo
Source§fn clone(&self) -> ValidatorInfo
fn clone(&self) -> ValidatorInfo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidatorInfo
impl Debug for ValidatorInfo
Source§impl<'de> Deserialize<'de> for ValidatorInfo
impl<'de> Deserialize<'de> for ValidatorInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ValidatorInfo
impl PartialEq for ValidatorInfo
Source§fn eq(&self, other: &ValidatorInfo) -> bool
fn eq(&self, other: &ValidatorInfo) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ValidatorInfo
impl Serialize for ValidatorInfo
impl Eq for ValidatorInfo
impl StructuralPartialEq for ValidatorInfo
Auto Trait Implementations§
impl Freeze for ValidatorInfo
impl RefUnwindSafe for ValidatorInfo
impl Send for ValidatorInfo
impl Sync for ValidatorInfo
impl Unpin for ValidatorInfo
impl UnsafeUnpin for ValidatorInfo
impl UnwindSafe for ValidatorInfo
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