Superseded byCanonical target id:solana-sbpf-asm(D-026). The direct sBPF assembly route (solana-sbpf-asm) is the canonical Solana backend. This Zig/sbpf-linker route remains as historical reference only.
solana-sbpf-linker (superseded). This filename
(solana-sbf.md) is a short alias for navigation only.
Solana is the most important non-EVM target for proving that ProofForge’s
portable core is not secretly EVM-shaped. The state model is explicit accounts,
not implicit contract storage.
Contract Model
Solana programs expose one entrypoint:- account count
- serialized accounts
- instruction data
- program id
Preferred Pipeline: sbpf-linker
Thezignocchio project demonstrates a no-fork route:
- It uses stock Zig instead of a Solana-specific Zig fork.
- It fits a platform product better because dependencies are explicit tools.
- It resembles the EVM/Solang pattern of producing an intermediate artifact and calling a target packager.
- Lean Zig runtime may not link under
bpfel-freestanding. - 4KB stack pressure may make normal Lean runtime paths too expensive.
.rodata,.bss,.data, panic, allocator, and libc assumptions may break the Solana loader.- Artifact size and compute units may force a restricted runtime subset.
Reference Pipeline: solana-zig Fork
Thesolana-sdk-mono repository demonstrates another path:
- account parsing
- typed accounts
- CPI
- PDA helpers
- events
- Mollusk tests
sbpf-linker is validated.
Instruction Manifest
Solana needs explicit account schemas. A sidecar manifest should describe instruction dispatch and accounts. Example:Lean SDK Sketch
First version:- PDA derivation.
- CPI wrappers.
- SPL Token helpers.
- typed account codecs.
- event encoding.
Generated Root Adapter
The root adapter owns Solana ABI mechanics:- instruction first byte as tag
- generated
switch - generated account validation before calling Lean handler
- Lean handler receives either account refs or an implicit context
Runtime Validation Plan
Spike 1: raw Zig entrypoint- Generated
entrypointlogs and returns success. - Build with stock Zig +
sbpf-linker. - Run in
solana-test-validatoror Mollusk.
- Link minimal generated Lean Zig with runtime.
- No accounts, just return success or log.
- Record linker errors and unsupported sections.
- Counter account with explicit account manifest.
initialize,increment,get.- No CPI.
- System Program transfer or account creation.
- PDA signing.
- Token transfer CPI.
- This should wait until syscall and account abstractions stabilize.
Test Strategy
Use both styles:- Mollusk for deterministic fast program tests.
solana-test-validator --bpf-programfor deployment-shaped smoke.
Open Questions
- Full Lean runtime or restricted Solana runtime subset?
- Can generated Lean Zig avoid large stack frames?
- Should account manifests be
.toml,.json, or Lean declarations? - Should the first Solana POC use zignocchio SDK code directly or copy only the minimal syscall/account pieces?
- Can Foundry-like smoke ergonomics be built around Mollusk for developers?