sBPF Program Execution on PVM
Solana programs currently execute in a modified eBPF virtual environment. As we explore migration to PVM, we present two architectural approaches to maintain compatibility while leveraging PVM's capabilities:
Program State Management
The state management flow illustrates how program execution and state transitions are handled between the client, Solana node, and PVM service.
- Focus on Execution: state access should be validated in the solana node while the service on PVM service should only focus on execution.
- Atomic State Updates: state changes are tracked as diffs (old→new) and validated before commitment, allowing for atomic updates and rollbacks if validation fails.
- Performance Optimization: only initial state and final diffs are transferred, reducing network load and processing time.
- State Validation:
- Solana node validates state diffs before commitment
- State changes must reference valid storage addresses
- Changes are verified against program permissions and constraints
- TODO: zk-proof for state validation
- Rollback Mechanism: The diff-based approach allows easy rollback by discarding invalid state changes without affecting the base state.
This architecture provides a robust foundation for managing program state while maintaining security and consistency. The diff-based approach optimizes performance while enabling strong validation guarantees.
Specification
- sBPF runtime as service on PVM
- fork anza-xyz/sbpf and remove std dependencies
- introduce a pvm service based on the
sbpf::interpreter
using jam-pvm-common
- confirm PVM is available to run large services like an interpreter, if the cost is affordable, and the performance is acceptable, we can try to introduce the JIT service on PVM.
- sBPF program transpiler to PVM blob
- Write a transpiler based on the instruction set of sbpf which translate the sBPF program to LLVM IR, and then integrate with polkavm-linker to generate the PVM blob.
- Intorudce a PVM service that provides the environment for the sBPF programs to run, e.g. storage accesses, etc.
- solana node modification
- state maintainence layer for state validation, state diff tracking, etc.
- replace the program execution logic with the PVM integration
References