Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 3 additions & 1 deletion program-libs/account-checks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -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 }
Expand Down
14 changes: 7 additions & 7 deletions program-libs/account-checks/src/account_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand All @@ -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]
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion program-libs/account-checks/src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn check_discriminator<T: 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,
Expand Down
4 changes: 2 additions & 2 deletions program-libs/account-checks/src/packed_accounts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(feature = "std")]
#[cfg(all(feature = "msg", feature = "std"))]
use core::panic::Location;

use crate::{AccountError, AccountInfoTrait};
Expand All @@ -15,7 +15,7 @@ impl<A: AccountInfoTrait> 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!(
Expand Down
3 changes: 2 additions & 1 deletion program-libs/batched-merkle-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions program-libs/compressed-account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
4 changes: 2 additions & 2 deletions program-libs/compressible/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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"] }
Expand Down
10 changes: 6 additions & 4 deletions program-libs/compressible/src/compression_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -213,11 +212,13 @@ impl ZCompressionInfoMut<'_> {
}: ClaimAndUpdate,
) -> Result<Option<u64>, 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);
}

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions program-libs/concurrent-merkle-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 2 additions & 2 deletions program-libs/ctoken-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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 }
Expand Down
2 changes: 2 additions & 0 deletions program-libs/ctoken-types/src/state/mint/compressed_mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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
Expand Down