Protosol
Protocol buffer definitions for the Solana Virtual Machine (SVM) testing harness in Agave. This crate provides Rust bindings for protobuf schemas used in fuzzing and testing the Solana blockchain's execution environment.
Overview
Protosol defines the data structures used to capture, serialize, and replay Solana blockchain execution contexts for testing and fuzzing purposes. These protocol buffers represent the complete state and execution flow of Solana transactions, blocks, and virtual machine operations.
What These Protocol Buffers Represent
Core Components
- Transaction Processing: Complete transaction lifecycle from input to execution effects
- Block Execution: Block-level context including transactions, account states, and consensus data
- Virtual Machine State: SVM execution context, compute budgets, and program execution
- Account Management: Account states, ownership, and data storage
- Consensus Context: Slot information, epoch data, and leader schedules
Key Message Types
Transaction Layer (txn.proto)
SanitizedTransaction: Complete transaction with message and signaturesTransactionMessage: Transaction payload with accounts and instructionsCompiledInstruction: Individual program instructions with account referencesMessageHeader: Transaction metadata (signatures, read-only accounts)
Block Layer (block.proto)
BlockContext: Input state for block execution (transactions, accounts, block hash queue)BlockEffects: Output state after block execution (bank hash, costs, leader schedule)BlockFixture: Complete test fixture combining input context and expected effects
Execution Context (context.proto)
AcctState: Complete account state (address, lamports, data, owner)FeatureSet: Enabled Solana features for executionSlotContext: Slot-specific information (POH, parent hashes)EpochContext: Epoch-level data (vote accounts, feature sets)
Compute Budget (pack.proto)
PackComputeBudgetContext: Input for compute budget testingPackComputeBudgetEffects: Output effects of compute budget execution
Usage
As a Dependency
Add to your Cargo.toml:
[]
= "X.Y.Z"
Basic Usage
use protos;
// Create a transaction fixture
let txn = SanitizedTransaction ;
// Create account state
let account = AcctState ;
// Create block context for testing
let block_ctx = BlockContext ;
Testing and Fuzzing
These protocol buffers are designed for:
- Test Fixture Generation: Create reproducible test cases with complete blockchain state
- Fuzzing: Generate random but valid blockchain execution contexts
- State Capture: Record actual blockchain execution for later replay
- Regression Testing: Compare execution results across different SVM implementations
Integration with Agave
This crate is specifically designed for use with the anza-xyz/agave repository's testing infrastructure:
- SVM Fuzzing: Generate test cases for the Solana Virtual Machine
- Execution Testing: Validate transaction and block execution across different implementations
- Performance Testing: Measure execution costs and resource usage
- Compatibility Testing: Ensure different SVM implementations produce identical results
Development
Building
Running Tests
Regenerating Protobuf Code
The protobuf code is automatically generated during build. To force regeneration:
File Structure
proto/
├── block.proto # Block execution context and effects
├── context.proto # Account states and execution context
├── txn.proto # Transaction structures
├── pack.proto # Compute budget testing
├── metadata.proto # Test fixture metadata
└── *.options # Nanopb configuration files
License
Apache-2.0