The Validator History Program employs technical architecture designed for efficient on-chain storage and retrieval of historical validator data.
The Config
account defines the global configuration of validator history program.
The ValidatorHistory
account serves as the primary data container for each validator.
Key Components:
bytemuck::{Pod, Zeroable}
traits for efficient memory managementAt the heart of each ValidatorHistory account lies the CircBuf
- a circular buffer that efficiently manages historical data storage:
Buffer Characteristics:
MAX_ITEMS = 512
)idx
pointerMemory Efficiency: The circular buffer prevents account bloat by maintaining a constant size regardless of how much historical data has been collected. When new epochs are added beyond the 512-entry limit, the oldest entries are automatically overwritten.
Each epoch's data is stored in a ValidatorHistoryEntry
struct (128 bytes) containing:
Performance Metrics:
pub epoch_credits: u32, // Vote credits earned
pub commission: u8, // Validator commission percentage
pub mev_commission: u16, // MEV commission in basis points
pub mev_earned: u32, // MEV rewards (stored as 1/100th SOL)
Validator Information:
pub ip: [u8; 4], // IPv4 address
pub version: ClientVersion, // Software version (major.minor.patch)
pub client_type: u8, // Client type
Stake Data:
pub activated_stake_lamports: u64, // Total active stake
pub rank: u32, // Validator rank by stake
pub is_superminority: u8, // Superminority status (0/1)
Metadata:
pub epoch: u16, // Epoch number
pub vote_account_last_update_slot: u64, // Last update slot
The ClusterHistory
account serves as the primary data for cluster.
Each epoch's data is stored in a ClusterHistoryEntry
struct containing:
Cluster Information
pub total_blocks: u32, // Total blocks
pub epoch: u16, // Epoch number
pub epoch_start_timestamp: u64 // Timestamp number
Zero-Copy Architecture: Eliminates runtime memory allocation overhead by using fixed-size structures that can be directly mapped to account data.
Efficient Storage Layout: C-style struct alignment ensures optimal memory usage and prevents compiler-added padding.
Batch Operations: Support for bulk updates of historical data without individual transaction overhead.
Normalized Data Access: Built-in handling for network changes like Timely Vote Credits (TVC) activation.
This architecture enables the Validator History Program to provide comprehensive historical data access while maintaining the performance and cost-efficiency required for on-chain operations.