From 74673b8833cba8bea3dadd9af686fc9bc672af77 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Thu, 9 Jan 2025 23:47:05 +0100 Subject: [PATCH] move inner_instruction.rs to solana-message (#4154) * move inner_instruction.rs to solana-message * fix path in deprecation message * fmt * remove inner-instruction feature --- Cargo.lock | 1 + programs/sbf/Cargo.lock | 1 + sdk/Cargo.toml | 1 + sdk/{ => message}/src/inner_instruction.rs | 13 +++++++------ sdk/message/src/lib.rs | 1 + sdk/src/lib.rs | 6 +++++- svm/examples/Cargo.lock | 1 + 7 files changed, 17 insertions(+), 7 deletions(-) rename sdk/{ => message}/src/inner_instruction.rs (70%) diff --git a/Cargo.lock b/Cargo.lock index 73429775afd46c..d2f0b0ea865b0d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8960,6 +8960,7 @@ dependencies = [ "solana-instructions-sysvar", "solana-keypair", "solana-logger", + "solana-message", "solana-native-token", "solana-nonce-account", "solana-offchain-message", diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index fc3c19d0fee79b..4bc43647e7e6fa 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7535,6 +7535,7 @@ dependencies = [ "solana-inflation", "solana-instruction", "solana-keypair", + "solana-message", "solana-native-token", "solana-nonce-account", "solana-offchain-message", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 84d662e1422fde..b15f1b66ad93c2 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -151,6 +151,7 @@ solana-instruction = { workspace = true } solana-keypair = { workspace = true, optional = true, features = [ "seed-derivable", ] } +solana-message = { workspace = true, features = ["serde"] } solana-native-token = { workspace = true } solana-nonce-account = { workspace = true } solana-offchain-message = { workspace = true, optional = true, features = ["verify"] } diff --git a/sdk/src/inner_instruction.rs b/sdk/message/src/inner_instruction.rs similarity index 70% rename from sdk/src/inner_instruction.rs rename to sdk/message/src/inner_instruction.rs index 1a715979ebf1c5..5ba3ad60e0211f 100644 --- a/sdk/src/inner_instruction.rs +++ b/sdk/message/src/inner_instruction.rs @@ -1,10 +1,11 @@ -use { - crate::instruction::CompiledInstruction, - serde::{Deserialize, Serialize}, -}; +use crate::compiled_instruction::CompiledInstruction; -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] +#[derive(Clone, Debug, PartialEq, Eq)] +#[cfg_attr( + feature = "serde", + derive(serde_derive::Deserialize, serde_derive::Serialize), + serde(rename_all = "camelCase") +)] pub struct InnerInstruction { pub instruction: CompiledInstruction, /// Invocation stack height of this instruction. Instruction stack height diff --git a/sdk/message/src/lib.rs b/sdk/message/src/lib.rs index 1233fc73564550..f41fc2afc84e12 100644 --- a/sdk/message/src/lib.rs +++ b/sdk/message/src/lib.rs @@ -41,6 +41,7 @@ pub mod compiled_instruction; mod compiled_keys; +pub mod inner_instruction; pub mod legacy; #[cfg(feature = "serde")] use serde_derive::{Deserialize, Serialize}; diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index f9d1e89ce4f305..2f4c09d6460133 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -71,7 +71,6 @@ pub mod genesis_config; #[deprecated(since = "2.2.0", note = "Use `solana-hard-forks` crate instead")] pub use solana_hard_forks as hard_forks; pub mod hash; -pub mod inner_instruction; pub mod log; pub mod native_loader; pub mod net; @@ -135,6 +134,11 @@ pub use solana_feature_set as feature_set; pub use solana_fee_structure as fee; #[deprecated(since = "2.1.0", note = "Use `solana-inflation` crate instead")] pub use solana_inflation as inflation; +#[deprecated( + since = "2.2.0", + note = "Use `solana_message::inner_instruction` instead" +)] +pub use solana_message::inner_instruction; #[deprecated(since = "2.2.0", note = "Use `solana-nonce-account` crate instead")] pub use solana_nonce_account as nonce_account; #[cfg(feature = "full")] diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 6bb0eecb7fe968..a22877d3519108 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -6854,6 +6854,7 @@ dependencies = [ "solana-inflation", "solana-instruction", "solana-keypair", + "solana-message", "solana-native-token", "solana-nonce-account", "solana-offchain-message",