From e0cc077ab8506c17f0dfa37477889dcb79beefc5 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Tue, 2 Jul 2024 11:19:15 -0600 Subject: [PATCH] Make load_instruction_at available to benches --- Cargo.lock | 1 + sdk/Cargo.toml | 1 + sdk/program/Cargo.toml | 2 ++ sdk/program/src/sysvar/instructions.rs | 3 +++ 4 files changed, 7 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index c71bd32fbab642..4a1ec226339055 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6827,6 +6827,7 @@ dependencies = [ "num-derive", "num-traits", "parking_lot 0.12.3", + "qualifier_attr", "rand 0.8.5", "rustc_version 0.4.0", "serde", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index cba150eac570e7..71a8d24733f4e5 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -98,6 +98,7 @@ assert_matches = { workspace = true } curve25519-dalek = { workspace = true } hex = { workspace = true } solana-logger = { workspace = true } +solana-program = { workspace = true, features = ["dev-context-only-utils"] } solana-sdk = { path = ".", features = ["dev-context-only-utils"] } static_assertions = { workspace = true } tiny-bip39 = { workspace = true } diff --git a/sdk/program/Cargo.toml b/sdk/program/Cargo.toml index 45a6927d8cc447..627094b4059805 100644 --- a/sdk/program/Cargo.toml +++ b/sdk/program/Cargo.toml @@ -25,6 +25,7 @@ log = { workspace = true } memoffset = { workspace = true } num-derive = { workspace = true } num-traits = { workspace = true, features = ["i128"] } +qualifier_attr = { workspace = true, optional = true } serde = { workspace = true } serde_bytes = { workspace = true } serde_derive = { workspace = true } @@ -93,4 +94,5 @@ crate-type = ["cdylib", "rlib"] [features] default = ["borsh"] borsh = ["dep:borsh", "dep:borsh0-10"] +dev-context-only-utils = ["dep:qualifier_attr"] frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] diff --git a/sdk/program/src/sysvar/instructions.rs b/sdk/program/src/sysvar/instructions.rs index 9a9577335f31db..9bc1d001c349d5 100644 --- a/sdk/program/src/sysvar/instructions.rs +++ b/sdk/program/src/sysvar/instructions.rs @@ -29,6 +29,8 @@ #![allow(clippy::arithmetic_side_effects)] +#[cfg(feature = "dev-context-only-utils")] +use qualifier_attr::qualifiers; #[cfg(not(target_os = "solana"))] use { crate::serialize_utils::{append_slice, append_u16, append_u8}, @@ -234,6 +236,7 @@ fn deserialize_instruction(index: usize, data: &[u8]) -> Result Result { deserialize_instruction(index, data) }