Sealevel Runtime Best Practices
Writing CU-efficient, parallel-friendly programs on Agave 4.1.1.
How to Use This List
- Apply before mainnet deploy and after load testing
A - Parallelism
- Shard state per user PDA. Avoid global writable accounts.
- Minimize writable accounts per instruction. Each writer is a serialization point.
- Prefer readonly accounts when possible. Shared locks parallelize.
B - Compute
- Measure CU with solana confirm -v. Profile every instruction path.
- Remove hot-path msg! logging. Logs cost CU on mainnet.
- Request adequate CU via Compute Budget. Don't rely on defaults under load.
C - Deployment
- Pin toolchain: Anchor 0.32.1, Rust 1.91.1. Match CI and local builds.
- Plan upgrade authority custody. Multisig or governance before mainnet.
- Test with Surfpool 0.12.0 and LiteSVM 0.6.x. Catch regressions early.
FAQs
What is the biggest CU killer?
See sections above for detail.
How do I test parallelism?
See sections above for detail.
Should programs be immutable?
See sections above for detail.
What loader does Agave 4.1.1 use?
See sections above for detail.
How do I profile CU?
See sections above for detail.
Can I shrink program size?
See sections above for detail.
What about native vs Anchor?
See sections above for detail.
How many accounts per ix?
See sections above for detail.
Does logging cost CU?
See sections above for detail.
How do upgrades affect state?
See sections above for detail.
What is sBPF?
See sections above for detail.
How do I set CU limit?
See sections above for detail.
Related
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.