From 3c02e96a9468561afbb9d7d189297cb8a5ffa872 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 10 Oct 2024 14:56:27 +0400 Subject: [PATCH 01/12] extract transaction-context crate --- Cargo.lock | 19 +++++ Cargo.toml | 2 + programs/sbf/Cargo.lock | 16 ++++ sdk/Cargo.toml | 5 ++ sdk/src/lib.rs | 6 +- sdk/transaction-context/Cargo.toml | 46 ++++++++++ .../src/lib.rs} | 83 ++++++++++++++----- 7 files changed, 154 insertions(+), 23 deletions(-) create mode 100644 sdk/transaction-context/Cargo.toml rename sdk/{src/transaction_context.rs => transaction-context/src/lib.rs} (96%) diff --git a/Cargo.lock b/Cargo.lock index bd42ecaea07eeb..778727cf8d35e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8338,6 +8338,7 @@ dependencies = [ "solana-signature", "solana-signer", "solana-time-utils", + "solana-transaction-context", "solana-transaction-error", "static_assertions", "thiserror", @@ -8947,6 +8948,24 @@ dependencies = [ "tokio-util 0.7.12", ] +[[package]] +name = "solana-transaction-context" +version = "2.2.0" +dependencies = [ + "bincode", + "serde", + "serde_derive", + "solana-account", + "solana-account-info", + "solana-instruction", + "solana-program", + "solana-pubkey", + "solana-rent", + "solana-signature", + "solana-transaction-context", + "static_assertions", +] + [[package]] name = "solana-transaction-dos" version = "2.2.0" diff --git a/Cargo.toml b/Cargo.toml index 09dde285183abd..94e69fae610373 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -157,6 +157,7 @@ members = [ "sdk/stable-layout", "sdk/sysvar-id", "sdk/time-utils", + "sdk/transaction-context", "sdk/transaction-error", "send-transaction-service", "stake-accounts", @@ -540,6 +541,7 @@ solana-thin-client = { path = "thin-client", version = "=2.2.0" } solana-transaction-error = { path = "sdk/transaction-error", version = "=2.2.0" } solana-tpu-client = { path = "tpu-client", version = "=2.2.0", default-features = false } solana-tpu-client-next = { path = "tpu-client-next", version = "=2.2.0" } +solana-transaction-context = { path = "sdk/transaction-context", version = "=2.2.0" } solana-transaction-status = { path = "transaction-status", version = "=2.2.0" } solana-transaction-status-client-types = { path = "transaction-status-client-types", version = "=2.2.0" } solana-transaction-metrics-tracker = { path = "transaction-metrics-tracker", version = "=2.2.0" } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 1bfe03cc6ab922..3ee79af46b190d 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7070,6 +7070,7 @@ dependencies = [ "solana-signature", "solana-signer", "solana-time-utils", + "solana-transaction-context", "solana-transaction-error", "thiserror", "wasm-bindgen", @@ -7465,6 +7466,21 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-transaction-context" +version = "2.2.0" +dependencies = [ + "bincode", + "serde", + "serde_derive", + "solana-account", + "solana-account-info", + "solana-instruction", + "solana-pubkey", + "solana-rent", + "solana-signature", +] + [[package]] name = "solana-transaction-error" version = "2.2.0" diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index cfef796073044f..74d1f0e2674445 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -28,6 +28,7 @@ full = [ "rand0-7", "serde_json", "solana-signature", + "solana-transaction-context/debug_assertions", "ed25519-dalek", "libsecp256k1", "sha3", @@ -134,6 +135,10 @@ solana-signature = { workspace = true, features = [ ], optional = true } solana-signer = { workspace = true, optional = true } solana-time-utils = { workspace = true } +solana-transaction-context = { workspace = true, features = [ + "bincode", + "debug_assertions", +] } solana-transaction-error = { workspace = true, features = ["serde"], optional = true } thiserror = { workspace = true } diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 8b52dfa8704d8c..b41f0a4ef7b836 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -104,7 +104,6 @@ pub mod signer; pub mod simple_vote_transaction_checker; pub mod system_transaction; pub mod transaction; -pub mod transaction_context; pub mod transport; pub mod wasm; @@ -190,6 +189,11 @@ pub use solana_serde_varint as serde_varint; pub use solana_short_vec as short_vec; #[deprecated(since = "2.2.0", note = "Use `solana-time-utils` crate instead")] pub use solana_time_utils as timing; +#[deprecated( + since = "2.2.0", + note = "Use `solana-transaction-context` crate instead" +)] +pub use solana_transaction_context as transaction_context; /// Convenience macro for `AddAssign` with saturating arithmetic. /// Replace by `std::num::Saturating` once stable diff --git a/sdk/transaction-context/Cargo.toml b/sdk/transaction-context/Cargo.toml new file mode 100644 index 00000000000000..b3e76c2bd4f559 --- /dev/null +++ b/sdk/transaction-context/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "solana-transaction-context" +description = "Solana data shared between program runtime and built-in programs as well as SBF programs." +documentation = "https://docs.rs/solana-transaction-context" +version = { workspace = true } +authors = { workspace = true } +repository = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +edition = { workspace = true } + +[dependencies] +solana-account = { workspace = true } +solana-instruction = { workspace = true, features = ["std"] } +solana-pubkey = { workspace = true } + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[target.'cfg(not(target_os = "solana"))'.dependencies] +bincode = { workspace = true, optional = true } +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } +solana-account-info = { workspace = true } +solana-rent = { workspace = true } +solana-signature = { workspace = true, optional = true } + +[dev-dependencies] +solana-program = { workspace = true } +solana-transaction-context = { path = ".", features = [ + "dev-context-only-utils", +] } +static_assertions = { workspace = true } + +[features] +bincode = ["dep:bincode", "serde", "solana-account/bincode"] +dev-context-only-utils = [ + "bincode", + "debug_assertions", + "solana-account/dev-context-only-utils", +] +debug_assertions = ["dep:solana-signature"] +serde = ["dep:serde", "dep:serde_derive"] + +[lints] +workspace = true diff --git a/sdk/src/transaction_context.rs b/sdk/transaction-context/src/lib.rs similarity index 96% rename from sdk/src/transaction_context.rs rename to sdk/transaction-context/src/lib.rs index 6cb9513a127537..3f81140fbdedcd 100644 --- a/sdk/src/transaction_context.rs +++ b/sdk/transaction-context/src/lib.rs @@ -1,11 +1,25 @@ //! Data shared between program runtime and built-in programs as well as SBF programs. #![deny(clippy::indexing_slicing)] -#[cfg(all(not(target_os = "solana"), feature = "full", debug_assertions))] -use crate::signature::Signature; +#[cfg(all( + not(target_os = "solana"), + feature = "debug_assertions", + debug_assertions +))] +use solana_signature::Signature; +#[cfg(not(target_os = "solana"))] +use { + solana_account::WritableAccount, + // not inlining MAX_PERMITTED_DATA_INCREASE because we already + // depend on solana_account_info indirectly + solana_account_info::MAX_PERMITTED_DATA_INCREASE, + solana_rent::Rent, + std::mem::MaybeUninit, +}; use { - crate::{instruction::InstructionError, pubkey::Pubkey}, solana_account::{AccountSharedData, ReadableAccount}, + solana_instruction::error::InstructionError, + solana_pubkey::Pubkey, std::{ cell::{Ref, RefCell, RefMut}, collections::HashSet, @@ -13,18 +27,23 @@ use { rc::Rc, }, }; -#[cfg(not(target_os = "solana"))] -use { - crate::{ - rent::Rent, - system_instruction::{ - MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION, MAX_PERMITTED_DATA_LENGTH, - }, - }, - solana_account::WritableAccount, - solana_program::entrypoint::MAX_PERMITTED_DATA_INCREASE, - std::mem::MaybeUninit, -}; + +// Inlined to avoid solana_program dep +const MAX_PERMITTED_DATA_LENGTH: u64 = 10 * 1024 * 1024; +#[cfg(test)] +static_assertions::const_assert_eq!( + MAX_PERMITTED_DATA_LENGTH, + solana_program::system_instruction::MAX_PERMITTED_DATA_LENGTH +); + +// Inlined to avoid solana_program dep +const MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION: i64 = + MAX_PERMITTED_DATA_LENGTH as i64 * 2; +#[cfg(test)] +static_assertions::const_assert_eq!( + MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION, + solana_program::system_instruction::MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION +); /// Index of an account inside of the TransactionContext or an InstructionContext. pub type IndexOfAccount = u16; @@ -144,7 +163,11 @@ pub struct TransactionContext { #[cfg(not(target_os = "solana"))] rent: Rent, /// Useful for debugging to filter by or to look it up on the explorer - #[cfg(all(not(target_os = "solana"), feature = "full", debug_assertions))] + #[cfg(all( + not(target_os = "solana"), + feature = "debug_assertions", + debug_assertions + ))] signature: Signature, } @@ -172,7 +195,11 @@ impl TransactionContext { accounts_resize_delta: RefCell::new(0), remove_accounts_executable_flag_checks: true, rent, - #[cfg(all(not(target_os = "solana"), feature = "full", debug_assertions))] + #[cfg(all( + not(target_os = "solana"), + feature = "debug_assertions", + debug_assertions + ))] signature: Signature::default(), } } @@ -200,13 +227,21 @@ impl TransactionContext { } /// Stores the signature of the current transaction - #[cfg(all(not(target_os = "solana"), feature = "full", debug_assertions))] + #[cfg(all( + not(target_os = "solana"), + feature = "debug_assertions", + debug_assertions + ))] pub fn set_signature(&mut self, signature: &Signature) { self.signature = *signature; } /// Returns the signature of the current transaction - #[cfg(all(not(target_os = "solana"), feature = "full", debug_assertions))] + #[cfg(all( + not(target_os = "solana"), + feature = "debug_assertions", + debug_assertions + ))] pub fn get_signature(&self) -> &Signature { &self.signature } @@ -445,7 +480,11 @@ impl TransactionContext { } /// Return data at the end of a transaction -#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)] +#[cfg_attr( + feature = "serde", + derive(serde_derive::Deserialize, serde_derive::Serialize) +)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct TransactionReturnData { pub program_id: Pubkey, pub data: Vec, @@ -969,7 +1008,7 @@ impl<'a> BorrowedAccount<'a> { } /// Deserializes the account data into a state - #[cfg(not(target_os = "solana"))] + #[cfg(all(not(target_os = "solana"), feature = "bincode"))] pub fn get_state(&self) -> Result { self.account .deserialize_data() @@ -977,7 +1016,7 @@ impl<'a> BorrowedAccount<'a> { } /// Serializes a state into the account data - #[cfg(not(target_os = "solana"))] + #[cfg(all(not(target_os = "solana"), feature = "bincode"))] pub fn set_state(&mut self, state: &T) -> Result<(), InstructionError> { let data = self.get_data_mut()?; let serialized_size = From df111b178a9a7b8612b0641f9031758ec17b088f Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 10 Oct 2024 15:09:44 +0400 Subject: [PATCH 02/12] inline MAX_PERMITTED_DATA_INCREASE --- sdk/transaction-context/Cargo.toml | 2 +- sdk/transaction-context/src/lib.rs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sdk/transaction-context/Cargo.toml b/sdk/transaction-context/Cargo.toml index b3e76c2bd4f559..42bdf201b66ca1 100644 --- a/sdk/transaction-context/Cargo.toml +++ b/sdk/transaction-context/Cargo.toml @@ -21,11 +21,11 @@ targets = ["x86_64-unknown-linux-gnu"] bincode = { workspace = true, optional = true } serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } -solana-account-info = { workspace = true } solana-rent = { workspace = true } solana-signature = { workspace = true, optional = true } [dev-dependencies] +solana-account-info = { workspace = true } solana-program = { workspace = true } solana-transaction-context = { path = ".", features = [ "dev-context-only-utils", diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs index 3f81140fbdedcd..9d7fe06c54e4b6 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -8,14 +8,7 @@ ))] use solana_signature::Signature; #[cfg(not(target_os = "solana"))] -use { - solana_account::WritableAccount, - // not inlining MAX_PERMITTED_DATA_INCREASE because we already - // depend on solana_account_info indirectly - solana_account_info::MAX_PERMITTED_DATA_INCREASE, - solana_rent::Rent, - std::mem::MaybeUninit, -}; +use {solana_account::WritableAccount, solana_rent::Rent, std::mem::MaybeUninit}; use { solana_account::{AccountSharedData, ReadableAccount}, solana_instruction::error::InstructionError, @@ -45,6 +38,14 @@ static_assertions::const_assert_eq!( solana_program::system_instruction::MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION ); +// Inlined to avoid solana_account_info dep +const MAX_PERMITTED_DATA_INCREASE: usize = 1_024 * 10; +#[cfg(test)] +static_assertions::const_assert_eq!( + MAX_PERMITTED_DATA_INCREASE, + solana_account_info::MAX_PERMITTED_DATA_INCREASE +); + /// Index of an account inside of the TransactionContext or an InstructionContext. pub type IndexOfAccount = u16; From 88be077c08a8229b2127d7123843b169b5c31795 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 10 Oct 2024 15:19:14 +0400 Subject: [PATCH 03/12] add doc_auto_cfg --- sdk/transaction-context/Cargo.toml | 2 ++ sdk/transaction-context/src/lib.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/sdk/transaction-context/Cargo.toml b/sdk/transaction-context/Cargo.toml index 42bdf201b66ca1..002d6e873661cd 100644 --- a/sdk/transaction-context/Cargo.toml +++ b/sdk/transaction-context/Cargo.toml @@ -16,6 +16,8 @@ solana-pubkey = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] [target.'cfg(not(target_os = "solana"))'.dependencies] bincode = { workspace = true, optional = true } diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs index 9d7fe06c54e4b6..cc0e373e968cc7 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -1,5 +1,6 @@ //! Data shared between program runtime and built-in programs as well as SBF programs. #![deny(clippy::indexing_slicing)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #[cfg(all( not(target_os = "solana"), From 136d6711682505561b2b6dcdd90e40ed9c69bb54 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 10 Oct 2024 15:21:35 +0400 Subject: [PATCH 04/12] sort features --- sdk/transaction-context/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/transaction-context/Cargo.toml b/sdk/transaction-context/Cargo.toml index 002d6e873661cd..34e811d488329e 100644 --- a/sdk/transaction-context/Cargo.toml +++ b/sdk/transaction-context/Cargo.toml @@ -36,12 +36,12 @@ static_assertions = { workspace = true } [features] bincode = ["dep:bincode", "serde", "solana-account/bincode"] +debug_assertions = ["dep:solana-signature"] dev-context-only-utils = [ "bincode", "debug_assertions", - "solana-account/dev-context-only-utils", + "solana-account/dev-context-only-utils" ] -debug_assertions = ["dep:solana-signature"] serde = ["dep:serde", "dep:serde_derive"] [lints] From afc43a2566dea4b4108eef17c8bcc606910858ff Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 10 Oct 2024 15:25:20 +0400 Subject: [PATCH 05/12] update lock file --- programs/sbf/Cargo.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 3ee79af46b190d..9fffc9889b17a3 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7474,7 +7474,6 @@ dependencies = [ "serde", "serde_derive", "solana-account", - "solana-account-info", "solana-instruction", "solana-pubkey", "solana-rent", From 86f9e70e274260dddcc43748aee03c16749e09c6 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 10 Oct 2024 15:30:09 +0400 Subject: [PATCH 06/12] fix feature activation --- sdk/Cargo.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 74d1f0e2674445..a8565dd7302eaf 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -44,7 +44,11 @@ full = [ "dep:solana-transaction-error" ] borsh = ["dep:borsh", "solana-program/borsh", "solana-secp256k1-recover/borsh"] -dev-context-only-utils = ["qualifier_attr", "solana-account/dev-context-only-utils"] +dev-context-only-utils = [ + "qualifier_attr", + "solana-account/dev-context-only-utils", + "solana-transaction-context/dev-context-only-utils", +] frozen-abi = [ "dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", From 442f88dc9404ab0a6ffbbc7bc03f579048823a4a Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Fri, 11 Oct 2024 02:27:03 +0400 Subject: [PATCH 07/12] move serde dep to correct table --- sdk/transaction-context/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/transaction-context/Cargo.toml b/sdk/transaction-context/Cargo.toml index 34e811d488329e..e730df1fe49523 100644 --- a/sdk/transaction-context/Cargo.toml +++ b/sdk/transaction-context/Cargo.toml @@ -10,6 +10,8 @@ license = { workspace = true } edition = { workspace = true } [dependencies] +serde = { workspace = true, optional = true } +serde_derive = { workspace = true, optional = true } solana-account = { workspace = true } solana-instruction = { workspace = true, features = ["std"] } solana-pubkey = { workspace = true } @@ -21,8 +23,6 @@ rustdoc-args = ["--cfg=docsrs"] [target.'cfg(not(target_os = "solana"))'.dependencies] bincode = { workspace = true, optional = true } -serde = { workspace = true, optional = true } -serde_derive = { workspace = true, optional = true } solana-rent = { workspace = true } solana-signature = { workspace = true, optional = true } From 840b0b65531aea2d04b49c4591bf7da06df2d8c9 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Fri, 11 Oct 2024 03:33:11 +0400 Subject: [PATCH 08/12] lint --- sdk/transaction-context/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs index cc0e373e968cc7..33b94adade2f5b 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -31,6 +31,7 @@ static_assertions::const_assert_eq!( ); // Inlined to avoid solana_program dep +#[cfg(not(target_os = "solana"))] const MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION: i64 = MAX_PERMITTED_DATA_LENGTH as i64 * 2; #[cfg(test)] @@ -40,6 +41,7 @@ static_assertions::const_assert_eq!( ); // Inlined to avoid solana_account_info dep +#[cfg(not(target_os = "solana"))] const MAX_PERMITTED_DATA_INCREASE: usize = 1_024 * 10; #[cfg(test)] static_assertions::const_assert_eq!( From 518a4f8be8b37090a26b1865174385a0ac9f865a Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Fri, 11 Oct 2024 12:17:24 +0400 Subject: [PATCH 09/12] add missing #[cfg(not(target_os = "solana"))] --- sdk/transaction-context/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs index 33b94adade2f5b..7200889bd2124f 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -23,6 +23,7 @@ use { }; // Inlined to avoid solana_program dep +#[cfg(not(target_os = "solana"))] const MAX_PERMITTED_DATA_LENGTH: u64 = 10 * 1024 * 1024; #[cfg(test)] static_assertions::const_assert_eq!( From eb9646ac0feb228f6e28892019753cdf13f1e14a Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Sat, 16 Nov 2024 03:04:32 +0400 Subject: [PATCH 10/12] rename feature to debug_signature --- sdk/Cargo.toml | 4 ++-- sdk/transaction-context/Cargo.toml | 4 ++-- sdk/transaction-context/src/lib.rs | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index a8565dd7302eaf..dae57fbf38b420 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -28,7 +28,7 @@ full = [ "rand0-7", "serde_json", "solana-signature", - "solana-transaction-context/debug_assertions", + "solana-transaction-context/debug_signature", "ed25519-dalek", "libsecp256k1", "sha3", @@ -141,7 +141,7 @@ solana-signer = { workspace = true, optional = true } solana-time-utils = { workspace = true } solana-transaction-context = { workspace = true, features = [ "bincode", - "debug_assertions", + "debug_signature", ] } solana-transaction-error = { workspace = true, features = ["serde"], optional = true } thiserror = { workspace = true } diff --git a/sdk/transaction-context/Cargo.toml b/sdk/transaction-context/Cargo.toml index e730df1fe49523..ade2b261c89a67 100644 --- a/sdk/transaction-context/Cargo.toml +++ b/sdk/transaction-context/Cargo.toml @@ -36,10 +36,10 @@ static_assertions = { workspace = true } [features] bincode = ["dep:bincode", "serde", "solana-account/bincode"] -debug_assertions = ["dep:solana-signature"] +debug_signature = ["dep:solana-signature"] dev-context-only-utils = [ "bincode", - "debug_assertions", + "debug_signature", "solana-account/dev-context-only-utils" ] serde = ["dep:serde", "dep:serde_derive"] diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs index 7200889bd2124f..f13c55aba44ba7 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -4,7 +4,7 @@ #[cfg(all( not(target_os = "solana"), - feature = "debug_assertions", + feature = "debug_signature", debug_assertions ))] use solana_signature::Signature; @@ -170,7 +170,7 @@ pub struct TransactionContext { /// Useful for debugging to filter by or to look it up on the explorer #[cfg(all( not(target_os = "solana"), - feature = "debug_assertions", + feature = "debug_signature", debug_assertions ))] signature: Signature, @@ -202,7 +202,7 @@ impl TransactionContext { rent, #[cfg(all( not(target_os = "solana"), - feature = "debug_assertions", + feature = "debug_signature", debug_assertions ))] signature: Signature::default(), @@ -234,7 +234,7 @@ impl TransactionContext { /// Stores the signature of the current transaction #[cfg(all( not(target_os = "solana"), - feature = "debug_assertions", + feature = "debug_signature", debug_assertions ))] pub fn set_signature(&mut self, signature: &Signature) { @@ -244,7 +244,7 @@ impl TransactionContext { /// Returns the signature of the current transaction #[cfg(all( not(target_os = "solana"), - feature = "debug_assertions", + feature = "debug_signature", debug_assertions ))] pub fn get_signature(&self) -> &Signature { From 3143b72e5d369c1d3545af137abd95f1fca723ae Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Sat, 16 Nov 2024 03:05:46 +0400 Subject: [PATCH 11/12] only activate "debug_signature" when "full" is activated, as it was before --- sdk/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index dae57fbf38b420..16759999b60ccc 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -141,7 +141,6 @@ solana-signer = { workspace = true, optional = true } solana-time-utils = { workspace = true } solana-transaction-context = { workspace = true, features = [ "bincode", - "debug_signature", ] } solana-transaction-error = { workspace = true, features = ["serde"], optional = true } thiserror = { workspace = true } From 52e821bc182a86775d3d5e66c76f4ef6c9a89b02 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Sat, 16 Nov 2024 03:15:48 +0400 Subject: [PATCH 12/12] replace underscore with hyphen --- sdk/Cargo.toml | 2 +- sdk/transaction-context/Cargo.toml | 4 ++-- sdk/transaction-context/src/lib.rs | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 16759999b60ccc..1da283e37644e2 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -28,7 +28,7 @@ full = [ "rand0-7", "serde_json", "solana-signature", - "solana-transaction-context/debug_signature", + "solana-transaction-context/debug-signature", "ed25519-dalek", "libsecp256k1", "sha3", diff --git a/sdk/transaction-context/Cargo.toml b/sdk/transaction-context/Cargo.toml index ade2b261c89a67..0ef668c7f357f7 100644 --- a/sdk/transaction-context/Cargo.toml +++ b/sdk/transaction-context/Cargo.toml @@ -36,10 +36,10 @@ static_assertions = { workspace = true } [features] bincode = ["dep:bincode", "serde", "solana-account/bincode"] -debug_signature = ["dep:solana-signature"] +debug-signature = ["dep:solana-signature"] dev-context-only-utils = [ "bincode", - "debug_signature", + "debug-signature", "solana-account/dev-context-only-utils" ] serde = ["dep:serde", "dep:serde_derive"] diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs index f13c55aba44ba7..33bd6bc986e9bd 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -4,7 +4,7 @@ #[cfg(all( not(target_os = "solana"), - feature = "debug_signature", + feature = "debug-signature", debug_assertions ))] use solana_signature::Signature; @@ -170,7 +170,7 @@ pub struct TransactionContext { /// Useful for debugging to filter by or to look it up on the explorer #[cfg(all( not(target_os = "solana"), - feature = "debug_signature", + feature = "debug-signature", debug_assertions ))] signature: Signature, @@ -202,7 +202,7 @@ impl TransactionContext { rent, #[cfg(all( not(target_os = "solana"), - feature = "debug_signature", + feature = "debug-signature", debug_assertions ))] signature: Signature::default(), @@ -234,7 +234,7 @@ impl TransactionContext { /// Stores the signature of the current transaction #[cfg(all( not(target_os = "solana"), - feature = "debug_signature", + feature = "debug-signature", debug_assertions ))] pub fn set_signature(&mut self, signature: &Signature) { @@ -244,7 +244,7 @@ impl TransactionContext { /// Returns the signature of the current transaction #[cfg(all( not(target_os = "solana"), - feature = "debug_signature", + feature = "debug-signature", debug_assertions ))] pub fn get_signature(&self) -> &Signature {