Skip to content

Tracking issue: p-stake migration #187

@grod220

Description

@grod220

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

External dependencies

Env Setup

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions