Skip to content

no variant named RequestUnitsDeprecated found for enum ComputeBudgetInstruction #23

@0xstonegm

Description

@0xstonegm

commit e08b37a introduced RequestUnitsDeprecated

but it got removed in v1.18, so the solana-* = "1.17" in Cargo.toml should be solana-* = "~1.17" to restrict solana-* version to avoid compiler errors like the title above since solana-devtools no longer compatible with >=1.18 versions.

diff --git a/sdk/src/compute_budget.rs b/sdk/src/compute_budget.rs
index 84d0c37660..c903be13c2 100644
--- a/sdk/src/compute_budget.rs
+++ b/sdk/src/compute_budget.rs
@@ -23,14 +23,7 @@ crate::declare_id!("ComputeBudget111111111111111111111111111111");
     Serialize,
 )]
 pub enum ComputeBudgetInstruction {
-    /// Deprecated
-    // TODO: after feature remove_deprecated_request_unit_ix::id() is activated, replace it with 'unused'
-    RequestUnitsDeprecated {
-        /// Units to request
-        units: u32,
-        /// Additional fee to add
-        additional_fee: u32,
-    },
+    Unused, // deprecated variant, reserved value.
     /// Request a specific transaction-wide program heap region size in bytes.
     /// The value requested must be a multiple of 1024. This new heap region
     /// size applies to each program executed in the transaction, including all
@@ -63,9 +56,9 @@ impl ComputeBudgetInstruction {

     /// Serialize Instruction using borsh, this is only used in runtime::cost_model::tests but compilation
     /// can't be restricted as it's used across packages
-    // #[cfg(test)]
-    pub fn pack(self) -> Result<Vec<u8>, std::io::Error> {
-        self.try_to_vec()
+    #[cfg(feature = "dev-context-only-utils")]
+    pub fn pack(self) -> Result<Vec<u8>, borsh::io::Error> {
+        borsh::to_vec(&self)
     }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions