-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Development tracker for SIMD-0401
Goal: Ship a Pinocchio-based implementation of the Stake program that is a no_std, byte-for-byte ABI compatible, semantically equal, upstream eBPF toolchain-friendly, drop-in replacement for the current program.
Roadmap
Comms
- SIMD drafted & circulated: SIMD-0401: Stake program Pinocchio migration (
p-stake) solana-foundation/solana-improvement-documents#401
External dependencies
Env Setup
-
Move from pnpm to Makefile workflows
-
Complete test migration
- https://github.com/orgs/solana-program/projects/8
- split out stake_instruction.rs tests
-
Create p-stake & p-stake-interface crates
- Add pinnochio interface + test-utils crates #188
- Update .github/workflows/main.yml to build, lint, and test both
- Ensure old crates loudly deprecate when used just for interface
-
Add dual-runner test harness to execute against legacy & p-stake
-
stake_instruction.rsunit tests -
interface.rsprop tests - Fuzzing: (p-token fuzzing example, using honggfuzz).
mollusk run-test original.so new_prog.so ./fixtures/ Stake111111….
-
-
Bencher utility. Standard process for measuring CU differences of instructions.
StakeStateV2 state migration
Migrated to zero-copy by defining structs with #[repr(C)]. To guarantee ABI compatibility, add golden tests or compile-time size assertions.
Explore 1) Solana-native bytemuck alternative: Stevia and 2) 200 byte space usage designs
- Convert Authorized (staker, withdrawer)
- Convert Lockup (unix_timestamp, epoch, custodian)
- Convert Meta (rent_exempt_reserve, authorized, lockup)
- Convert Delegation (voter_pubkey, stake, activation_epoch, deactivation_epoch)
- Convert Stake (delegation, credits_observed)
- Convert StakeFlags (or remove?)
- Assert enum variant order/tags (u32 discriminants)
- Assert ABI size = 200 bytes for all StakeStateV2 variants (golden tests)
Instruction migrations
Implement a Pinocchio ix handler that decodes the u32 opcode, performs the legacy state transition with zero-copy reads/writes, and returns the same errors/return data. Parity of accounts/signers order, instruction data, error codes, and final account state. Additional unit tests written as needed if coverage holes. Benchmarks published per ix migration. Remove all logging.
Ordered in a way that is incrementally buildable: Meta-only edits -> delegation lifecycle -> account transforms.
- Port Initialize ix
- Port InitializeChecked ix
- Port Authorize ix
- Port AuthorizeChecked ix
- Port AuthorizeWithSeed ix
- Port AuthorizeCheckedWithSeed ix
- Port SetLockup ix
- Port SetLockupChecked ix
- Port DelegateStake ix
- Port Deactivate ix
- Port Withdraw ix
- Port Split ix
- Port Merge ix
- Port MoveStake ix
- Port MoveLamports ix
- Port GetMinimumDelegation ix
- Port DeactivateDelinquent ix
Clients
- Codama Integration: feature-gated macros & CI/CD checks
- JavaScript Client: Generated & published to NPM (@solana-program/stake)
- Rust client: Generated & published to crates.io
- Interface Crate: Published to crates.io
Documentation
- Root README + crate README’s
- Migration notes (ABI unchanged, etc)
Auditing
- Security Audit
- Formal verification
Deployment
- Add agave feature gate
- Sync with Firedancer for feature gate
- Devnet activation
- Testnet activation
- Mainnet activation