Skip to content

Commit

Permalink
Make load_instruction_at available to benches
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Jul 2, 2024
1 parent 392e814 commit e0cc077
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 2 additions & 0 deletions sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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"]
3 changes: 3 additions & 0 deletions sdk/program/src/sysvar/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -234,6 +236,7 @@ fn deserialize_instruction(index: usize, data: &[u8]) -> Result<Instruction, San
///
/// Unsafe because the sysvar accounts address is not checked; only used
/// internally after such a check.
#[cfg_attr(feature = "dev-context-only-utils", qualifiers(pub))]
fn load_instruction_at(index: usize, data: &[u8]) -> Result<Instruction, SanitizeError> {
deserialize_instruction(index, data)
}
Expand Down

0 comments on commit e0cc077

Please sign in to comment.