light_instruction_decoder/programs/compute_budget.rs
1//! ComputeBudget program instruction decoder.
2//!
3//! This module provides a macro-derived decoder for the Solana ComputeBudget program,
4//! which uses single-byte discriminators based on variant indices.
5
6// Allow the macro-generated code to reference types from this crate
7extern crate self as light_instruction_decoder;
8
9use light_instruction_decoder_derive::InstructionDecoder;
10
11/// ComputeBudget program instructions.
12///
13/// The ComputeBudget program uses a 1-byte discriminator (variant index).
14/// Each variant's discriminator is its position in this enum (0, 1, 2, ...).
15#[derive(InstructionDecoder)]
16#[instruction_decoder(
17 program_id = "ComputeBudget111111111111111111111111111111",
18 program_name = "Compute Budget",
19 discriminator_size = 1
20)]
21pub enum ComputeBudgetInstruction {
22 /// Deprecated variant (index 0)
23 Unused,
24
25 /// Request a specific heap frame size (index 1)
26 RequestHeapFrame { bytes: u32 },
27
28 /// Set compute unit limit for the transaction (index 2)
29 SetComputeUnitLimit { units: u32 },
30
31 /// Set compute unit price in micro-lamports (index 3)
32 SetComputeUnitPrice { micro_lamports: u64 },
33
34 /// Set loaded accounts data size limit (index 4)
35 SetLoadedAccountsDataSizeLimit { bytes: u32 },
36}