From e3954be3a2c2d89da020d6396b1d029093bc3273 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Mon, 18 Nov 2024 18:23:11 +0400 Subject: [PATCH] move BorrowedAccountMeta and BorrowedInstruction to instruction crate (#3693) * move BorrowedAccountMeta and BorrowedInstruction to solana-instruction crate * update doc comments Co-authored-by: Jon C --------- Co-authored-by: Jon C --- sdk/instruction/src/lib.rs | 20 ++++++++++++++++++++ sdk/program/src/sysvar/instructions.rs | 23 ++--------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/sdk/instruction/src/lib.rs b/sdk/instruction/src/lib.rs index 3f3cdc00d9b352..6999d19f9c61a8 100644 --- a/sdk/instruction/src/lib.rs +++ b/sdk/instruction/src/lib.rs @@ -296,3 +296,23 @@ pub struct ProcessedSiblingInstruction { /// Number of AccountMeta structures pub accounts_len: u64, } + +/// Borrowed version of `AccountMeta`. +/// +/// This struct is used by the runtime when constructing the instructions sysvar. It is not +/// useful to Solana programs. +pub struct BorrowedAccountMeta<'a> { + pub pubkey: &'a Pubkey, + pub is_signer: bool, + pub is_writable: bool, +} + +/// Borrowed version of `Instruction`. +/// +/// This struct is used by the runtime when constructing the instructions sysvar. It is not +/// useful to Solana programs. +pub struct BorrowedInstruction<'a> { + pub program_id: &'a Pubkey, + pub accounts: Vec>, + pub data: &'a [u8], +} diff --git a/sdk/program/src/sysvar/instructions.rs b/sdk/program/src/sysvar/instructions.rs index 4b6dcfa6ee17c4..370a8fe8c435ab 100644 --- a/sdk/program/src/sysvar/instructions.rs +++ b/sdk/program/src/sysvar/instructions.rs @@ -31,6 +31,8 @@ #[cfg(feature = "dev-context-only-utils")] use qualifier_attr::qualifiers; +#[deprecated(since = "2.2.0", note = "Use solana-instruction crate instead")] +pub use solana_instruction::{BorrowedAccountMeta, BorrowedInstruction}; pub use solana_sdk_ids::sysvar::instructions::{check_id, id, ID}; #[cfg(not(target_os = "solana"))] use { @@ -42,7 +44,6 @@ use { account_info::AccountInfo, instruction::{AccountMeta, Instruction}, program_error::ProgramError, - pubkey::Pubkey, serialize_utils::{read_pubkey, read_slice, read_u16, read_u8}, }, solana_sanitize::SanitizeError, @@ -74,26 +75,6 @@ pub fn construct_instructions_data(instructions: &[BorrowedInstruction]) -> Vec< data } -/// Borrowed version of `AccountMeta`. -/// -/// This struct is used by the runtime when constructing the sysvar. It is not -/// useful to Solana programs. -pub struct BorrowedAccountMeta<'a> { - pub pubkey: &'a Pubkey, - pub is_signer: bool, - pub is_writable: bool, -} - -/// Borrowed version of `Instruction`. -/// -/// This struct is used by the runtime when constructing the sysvar. It is not -/// useful to Solana programs. -pub struct BorrowedInstruction<'a> { - pub program_id: &'a Pubkey, - pub accounts: Vec>, - pub data: &'a [u8], -} - #[cfg(not(target_os = "solana"))] bitflags! { struct InstructionsSysvarAccountMeta: u8 {