diff --git a/Cargo.lock b/Cargo.lock index fd435ac0ce..e88864a38c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3414,9 +3414,9 @@ dependencies = [ [[package]] name = "light-bounded-vec" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233a69f003522990dadcf923b436094ffcb55326a2c3cef7f67acdbcb6e5b039" +checksum = "58cfa375d028164719e3ffef93d2e5c27855cc8a5bb5bf257b868d17c12a3e66" dependencies = [ "bytemuck", "memoffset", diff --git a/Cargo.toml b/Cargo.toml index cad193907a..7311ea4c5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -210,7 +210,7 @@ light-batched-merkle-tree = { path = "program-libs/batched-merkle-tree", version light-merkle-tree-metadata = { path = "program-libs/merkle-tree-metadata", version = "0.6.0" } aligned-sized = { path = "program-libs/aligned-sized", version = "1.1.0" } light-bloom-filter = { path = "program-libs/bloom-filter", version = "0.5.0" } -light-bounded-vec = { version = "2.0.0" } +light-bounded-vec = { version = "2.0.1" } light-poseidon = { version = "0.3.0" } light-test-utils = { path = "program-tests/utils", version = "1.2.1" } light-indexed-array = { path = "program-libs/indexed-array", version = "0.3.0" } diff --git a/program-libs/account-checks/Cargo.toml b/program-libs/account-checks/Cargo.toml index ec6833c410..cefdfb391f 100644 --- a/program-libs/account-checks/Cargo.toml +++ b/program-libs/account-checks/Cargo.toml @@ -14,7 +14,9 @@ solana = [ "solana-sysvar", "solana-account-info", "solana-pubkey", + "msg", ] +msg = ["dep:solana-msg"] pinocchio = ["dep:pinocchio"] test-only = ["dep:rand", "std"] @@ -26,7 +28,7 @@ solana-pubkey = { workspace = true, optional = true, features = [ "curve25519", "sha2", ] } -solana-msg = { workspace = true } +solana-msg = { workspace = true, optional = true } pinocchio = { workspace = true, optional = true } thiserror = { workspace = true } rand = { workspace = true, optional = true } diff --git a/program-libs/account-checks/src/account_iterator.rs b/program-libs/account-checks/src/account_iterator.rs index 3c68c7f2dc..1badd5cbec 100644 --- a/program-libs/account-checks/src/account_iterator.rs +++ b/program-libs/account-checks/src/account_iterator.rs @@ -48,7 +48,7 @@ impl<'info, T: AccountInfoTrait> AccountIterator<'info, T> { #[inline(always)] pub fn next_account(&mut self, _account_name: &str) -> Result<&'info T, AccountError> { if self.position >= self.accounts.len() { - #[cfg(feature = "std")] + #[cfg(all(feature = "msg", feature = "std"))] { let location = Location::caller(); solana_msg::msg!( @@ -183,7 +183,7 @@ impl<'info, T: AccountInfoTrait> AccountIterator<'info, T> { #[track_caller] pub fn remaining(self) -> Result<&'info [T], AccountError> { if self.position >= self.accounts.len() { - #[cfg(feature = "std")] + #[cfg(all(feature = "msg", feature = "std"))] { let location = Location::caller(); let account_name = "remaining accounts"; @@ -235,7 +235,7 @@ impl<'info, T: AccountInfoTrait> AccountIterator<'info, T> { #[cold] fn print_on_error(&self, error: &AccountError, account_name: &str, location: &Location) { - #[cfg(feature = "std")] + #[cfg(all(feature = "msg", feature = "std"))] solana_msg::msg!( "ERROR: {}. for account '{}' at index {} {}:{}:{}", error, @@ -245,7 +245,7 @@ impl<'info, T: AccountInfoTrait> AccountIterator<'info, T> { location.line(), location.column() ); - #[cfg(not(feature = "std"))] + #[cfg(not(all(feature = "msg", feature = "std")))] let _ = (error, account_name, location); } #[cold] @@ -257,7 +257,7 @@ impl<'info, T: AccountInfoTrait> AccountIterator<'info, T> { account_name: &str, location: &Location, ) { - #[cfg(all(feature = "std", feature = "solana"))] + #[cfg(all(feature = "msg", feature = "std", feature = "solana"))] solana_msg::msg!( "ERROR: {}. for account '{}' address: {:?}, expected: {:?}, at index {} {}:{}:{}", error, @@ -269,7 +269,7 @@ impl<'info, T: AccountInfoTrait> AccountIterator<'info, T> { location.line(), location.column() ); - #[cfg(all(feature = "std", not(feature = "solana")))] + #[cfg(all(feature = "msg", feature = "std", not(feature = "solana")))] solana_msg::msg!( "ERROR: {}. for account '{}' address: {:?}, expected: {:?}, at index {} {}:{}:{}", error, @@ -281,7 +281,7 @@ impl<'info, T: AccountInfoTrait> AccountIterator<'info, T> { location.line(), location.column() ); - #[cfg(not(feature = "std"))] + #[cfg(not(all(feature = "msg", feature = "std")))] let _ = (error, pubkey1, pubkey2, account_name, location); } } diff --git a/program-libs/account-checks/src/checks.rs b/program-libs/account-checks/src/checks.rs index a957d1f21a..bca86d851d 100644 --- a/program-libs/account-checks/src/checks.rs +++ b/program-libs/account-checks/src/checks.rs @@ -81,7 +81,7 @@ pub fn check_discriminator(bytes: &[u8]) -> Result<(), Account } if T::LIGHT_DISCRIMINATOR != bytes[0..DISCRIMINATOR_LEN] { - #[cfg(feature = "std")] + #[cfg(all(feature = "msg", feature = "std"))] solana_msg::msg!( "expected discriminator {:?} != {:?} actual", T::LIGHT_DISCRIMINATOR, diff --git a/program-libs/account-checks/src/packed_accounts.rs b/program-libs/account-checks/src/packed_accounts.rs index 638b26d2ee..7e9f5a82fd 100644 --- a/program-libs/account-checks/src/packed_accounts.rs +++ b/program-libs/account-checks/src/packed_accounts.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "std")] +#[cfg(all(feature = "msg", feature = "std"))] use core::panic::Location; use crate::{AccountError, AccountInfoTrait}; @@ -15,7 +15,7 @@ impl ProgramPackedAccounts<'_, A> { #[inline(never)] pub fn get(&self, index: usize, _name: &str) -> Result<&A, AccountError> { if index >= self.accounts.len() { - #[cfg(feature = "std")] + #[cfg(all(feature = "msg", feature = "std"))] { let location = Location::caller(); solana_msg::msg!( diff --git a/program-libs/batched-merkle-tree/Cargo.toml b/program-libs/batched-merkle-tree/Cargo.toml index 7081953197..c8a88cb90a 100644 --- a/program-libs/batched-merkle-tree/Cargo.toml +++ b/program-libs/batched-merkle-tree/Cargo.toml @@ -14,6 +14,7 @@ solana = [ "solana-account-info", "solana-sysvar", "solana-pubkey", + "solana-msg", "light-zero-copy/solana", "light-hasher/solana", "light-account-checks/solana", @@ -39,7 +40,7 @@ aligned-sized = { workspace = true } solana-program-error = { workspace = true, optional = true } solana-pubkey = { workspace = true, optional = true } solana-sysvar = { workspace = true, optional = true } -solana-msg = { workspace = true } +solana-msg = { workspace = true, optional = true } solana-account-info = { workspace = true, optional = true } light-zero-copy = { workspace = true, features = ["std"] } light-hasher = { workspace = true, features = ["poseidon"] } diff --git a/program-libs/compressed-account/Cargo.toml b/program-libs/compressed-account/Cargo.toml index 112b102105..0a0989016b 100644 --- a/program-libs/compressed-account/Cargo.toml +++ b/program-libs/compressed-account/Cargo.toml @@ -9,8 +9,8 @@ edition = "2021" [features] default = ["alloc"] alloc = ["light-hasher/alloc"] -std = ["alloc", "borsh/std", "dep:solana-msg", "light-zero-copy/std"] -solana = ["dep:solana-pubkey", "dep:solana-program-error"] +std = ["alloc", "borsh/std", "light-zero-copy/std"] +solana = ["dep:solana-pubkey", "dep:solana-program-error", "solana-msg"] anchor = ["anchor-lang", "std"] pinocchio = ["dep:pinocchio"] bytemuck-des = ["bytemuck"] diff --git a/program-libs/compressible/Cargo.toml b/program-libs/compressible/Cargo.toml index a15e9190a9..c644202214 100644 --- a/program-libs/compressible/Cargo.toml +++ b/program-libs/compressible/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [features] default = ["pinocchio", "solana"] -solana = ["dep:solana-program-error", "light-compressed-account/solana", "solana-sysvar"] +solana = ["dep:solana-program-error", "light-compressed-account/solana", "solana-sysvar", "solana-msg"] anchor = ["anchor-lang", "light-compressed-account/anchor", "light-compressed-account/std"] pinocchio = ["light-compressed-account/pinocchio"] profile-program = [] @@ -19,7 +19,7 @@ light-zero-copy = { workspace = true, features = ["std", "mut", "derive"] } light-macros = { workspace = true } pinocchio = { workspace = true } solana-program-error = { workspace = true, optional = true } -solana-msg = { workspace = true } +solana-msg = { workspace = true, optional = true } # Feature-gated dependencies anchor-lang = { workspace = true, optional = true } bytemuck = { workspace = true, features = ["derive"] } diff --git a/program-libs/compressible/src/compression_info.rs b/program-libs/compressible/src/compression_info.rs index 3c638c7da7..5371065817 100644 --- a/program-libs/compressible/src/compression_info.rs +++ b/program-libs/compressible/src/compression_info.rs @@ -3,7 +3,6 @@ use bytemuck::{Pod, Zeroable}; use light_program_profiler::profile; use light_zero_copy::{ZeroCopy, ZeroCopyMut}; use pinocchio::pubkey::Pubkey; -use solana_msg::msg; use zerocopy::U64; use crate::{ @@ -213,11 +212,13 @@ impl ZCompressionInfoMut<'_> { }: ClaimAndUpdate, ) -> Result, CompressibleError> { if self.compression_authority != *compression_authority { - msg!("Rent authority mismatch"); + #[cfg(feature = "solana")] + solana_msg::msg!("Rent authority mismatch"); return Ok(None); } if self.rent_sponsor != *rent_sponsor { - msg!("Rent sponsor PDA does not match rent recipient"); + #[cfg(feature = "solana")] + solana_msg::msg!("Rent sponsor PDA does not match rent recipient"); return Ok(None); } @@ -226,7 +227,8 @@ impl ZCompressionInfoMut<'_> { let config_version = config_account.version; if account_version != config_version { - msg!( + #[cfg(feature = "solana")] + solana_msg::msg!( "Config version mismatch: account has v{}, config is v{}", account_version, config_version diff --git a/program-libs/concurrent-merkle-tree/Cargo.toml b/program-libs/concurrent-merkle-tree/Cargo.toml index d382f59012..112d3c0272 100644 --- a/program-libs/concurrent-merkle-tree/Cargo.toml +++ b/program-libs/concurrent-merkle-tree/Cargo.toml @@ -8,12 +8,12 @@ license = "Apache-2.0" [features] heavy-tests = [] -solana = ["solana-program-error", "light-hasher/solana"] +solana = ["solana-program-error", "light-hasher/solana", "light-bounded-vec/solana"] pinocchio = ["dep:pinocchio", "light-hasher/pinocchio"] [dependencies] borsh = { workspace = true } -light-bounded-vec = { workspace = true, features = ["solana"] } +light-bounded-vec = { workspace = true } light-hasher = { workspace = true, features = ["poseidon"]} memoffset = "0.9" solana-program-error = { workspace = true, optional = true } diff --git a/program-libs/ctoken-types/Cargo.toml b/program-libs/ctoken-types/Cargo.toml index a512613c06..a4955d7b1d 100644 --- a/program-libs/ctoken-types/Cargo.toml +++ b/program-libs/ctoken-types/Cargo.toml @@ -5,7 +5,7 @@ edition = { workspace = true } [features] anchor = ["light-compressed-account/anchor", "dep:anchor-lang", "light-compressible/anchor"] -solana = ["dep:solana-program-error", "dep:solana-sysvar"] +solana = ["dep:solana-program-error", "dep:solana-sysvar", "solana-msg"] default = [] profile-program = [] profile-heap = ["dep:light-heap"] @@ -30,7 +30,7 @@ light-macros = { workspace = true } solana-sysvar = { workspace = true, optional = true } spl-pod = { workspace = true } spl-token-2022 = { workspace = true } -solana-msg = { workspace = true } +solana-msg = { workspace = true, optional = true } light-program-profiler = { workspace = true } light-heap = { workspace = true, optional = true } light-compressible = {workspace = true } diff --git a/program-libs/ctoken-types/src/state/mint/compressed_mint.rs b/program-libs/ctoken-types/src/state/mint/compressed_mint.rs index d370b819c1..bc3e5e7ae5 100644 --- a/program-libs/ctoken-types/src/state/mint/compressed_mint.rs +++ b/program-libs/ctoken-types/src/state/mint/compressed_mint.rs @@ -3,6 +3,7 @@ use light_compressed_account::Pubkey; use light_hasher::{sha256::Sha256BE, Hasher}; use light_program_profiler::profile; use light_zero_copy::{ZeroCopy, ZeroCopyMut}; +#[cfg(feature = "solana")] use solana_msg::msg; use crate::{ @@ -76,6 +77,7 @@ impl ZCompressedMintMut<'_> { spl_mint_initialized: bool, ) -> Result<(), CTokenError> { if ix_data.metadata.version != 3 { + #[cfg(feature = "solana")] msg!( "Only shaflat version 3 is supported got {}", ix_data.metadata.version