Skip to content

chore: fix feature gates#2028

Merged
SwenSchaeferjohann merged 1 commit intomainfrom
jorrit/chore-fix-lib-features
Oct 31, 2025
Merged

chore: fix feature gates#2028
SwenSchaeferjohann merged 1 commit intomainfrom
jorrit/chore-fix-lib-features

Conversation

@ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Oct 31, 2025

Summary by CodeRabbit

  • Chores
    • Updated light-bounded-vec dependency to version 2.0.1.
    • Made solana-msg an optional dependency across libraries to reduce unnecessary dependency overhead.
    • Added optional message/logging feature flag for enhanced diagnostic capabilities.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

This PR updates feature flag configuration and dependency declarations across multiple Cargo manifests, making solana-msg optional and introducing a new msg feature to gate message/logging functionality. Conditional compilation guards are updated to require both msg and std features (or solana feature in some crates) for message emission instead of std alone.

Changes

Cohort / File(s) Summary
Dependency version bump
Cargo.toml
Updated light-bounded-vec from 2.0.0 to 2.0.1
Account-checks feature and dependency configuration
program-libs/account-checks/Cargo.toml
Added new msg feature; included in solana feature set; made solana-msg optional and tied to msg feature
Account-checks conditional compilation guards
program-libs/account-checks/src/account_iterator.rs, program-libs/account-checks/src/checks.rs, program-libs/account-checks/src/packed_accounts.rs
Replaced #[cfg(feature = "std")] guards with #[cfg(all(feature = "msg", feature = "std"))] (or #[cfg(all(feature = "msg", feature = "std", feature = "solana"))]) for message/error emission blocks
Multi-crate solana-msg feature setup
program-libs/batched-merkle-tree/Cargo.toml, program-libs/compressed-account/Cargo.toml, program-libs/compressible/Cargo.toml, program-libs/concurrent-merkle-tree/Cargo.toml, program-libs/ctoken-types/Cargo.toml
Made solana-msg optional dependency; added to solana feature set across crates
Compressible source logging update
program-libs/compressible/src/compression_info.rs
Removed top-level solana_msg::msg import; wrapped logging calls with #[cfg(feature = "solana")] guards; calls now use fully-qualified solana_msg::msg!
CToken compressed mint logging update
program-libs/ctoken-types/src/state/mint/compressed_mint.rs
Added #[cfg(feature = "solana")] guard to solana_msg::msg import and log call within set() method
Concurrent merkle tree feature delegation
program-libs/concurrent-merkle-tree/Cargo.toml
Changed light-bounded-vec from { workspace = true, features = ["solana"] } to { workspace = true }; added light-bounded-vec/solana to solana feature set

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Multiple files affected across 6+ crates with related but distinct changes
  • Mix of Cargo manifest modifications and conditional compilation guard updates
  • Need to verify feature flag interactions and build compatibility across crates
  • Changes are consistent in pattern but require individual verification per crate
  • Pay special attention to:
    • Correctness of conditional compilation guard combinations (especially multi-feature guards like all(feature = "msg", feature = "std"))
    • Interaction between msg feature and solana feature across different crates
    • Build verification with and without the new msg feature enabled
    • Verify that optional dependency declarations don't break any transitive dependencies

Possibly related PRs

  • refactor: libs to nostd #1997: Modifies the same account-checks code paths (account_iterator.rs, packed_accounts.rs, checks.rs) with similar cfg feature guard changes around error/log message emission.
  • feat: more account checks #1982: Updates account-checks logging/error-emission code paths and feature wiring in program-libs/account-checks.

Suggested reviewers

  • sergeytimoshin
  • SwenSchaeferjohann

Poem

🐰 A rabbit hops through features bright,
Where messages now hide from sight—
Unless you call the "msg" name true,
With "std" and "solana" dancing too!
No logging lost, just gated tight,
Our bounded crates now gleam with light! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "chore: fix feature gates" directly relates to the primary changes in the changeset. The pull request systematically adjusts feature gates and conditional compilation across multiple crates (account-checks, batched-merkle-tree, compressed-account, compressible, concurrent-merkle-tree, and ctoken-types), reorganizes dependencies into feature sets, and updates feature-gated code paths. The title accurately captures this core focus using the specific technical term "feature gates" and is concise and clear enough for a developer scanning the history to understand the main intent of the changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jorrit/chore-fix-lib-features

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
program-libs/ctoken-types/src/state/mint/compressed_mint.rs (1)

80-84: Fix typo in error message.

Line 82 contains "shaflat" which appears to be a typo. Did you mean "shaflake" or another term? Please verify and correct the message.

🧹 Nitpick comments (1)
program-libs/concurrent-merkle-tree/Cargo.toml (1)

11-11: LGTM! Correct refactor of feature propagation.

The changes properly refactor feature propagation:

  • Line 11: The solana feature now explicitly enables light-bounded-vec/solana
  • Line 16: The dependency declaration is simplified to { workspace = true }

This is the correct Cargo pattern - features should be enabled in the [features] section rather than hardcoded in [dependencies]. This makes the feature activation conditional and more flexible.

Also applies to: 16-16

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cbcc24 and 4073688.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • Cargo.toml (1 hunks)
  • program-libs/account-checks/Cargo.toml (2 hunks)
  • program-libs/account-checks/src/account_iterator.rs (7 hunks)
  • program-libs/account-checks/src/checks.rs (1 hunks)
  • program-libs/account-checks/src/packed_accounts.rs (2 hunks)
  • program-libs/batched-merkle-tree/Cargo.toml (2 hunks)
  • program-libs/compressed-account/Cargo.toml (1 hunks)
  • program-libs/compressible/Cargo.toml (2 hunks)
  • program-libs/compressible/src/compression_info.rs (2 hunks)
  • program-libs/concurrent-merkle-tree/Cargo.toml (1 hunks)
  • program-libs/ctoken-types/Cargo.toml (2 hunks)
  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
program-libs/account-checks/src/checks.rs

📄 CodeRabbit inference engine (program-libs/account-checks/CLAUDE.md)

Expose and maintain account validation helpers (check_owner, check_program, check_mut/non_mut, check_signer, check_discriminator, set_discriminator, check_pda_seeds, check_account_balance_is_rent_exempt, account_info_init) in checks.rs

Files:

  • program-libs/account-checks/src/checks.rs
program-libs/account-checks/src/**/*.rs

📄 CodeRabbit inference engine (program-libs/account-checks/CLAUDE.md)

program-libs/account-checks/src/**/*.rs: On account initialization, call account_info_init to set the 8-byte discriminator
Validate account type with 8-byte discriminators using check_discriminator before deserialization
Return AccountError variants (codes 12006–12021) and rely on automatic ProgramError conversions; avoid returning raw ProgramError directly

Files:

  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
program-libs/account-checks/src/packed_accounts.rs

📄 CodeRabbit inference engine (program-libs/account-checks/CLAUDE.md)

For dynamic account sets, use PackedAccounts for index-based access with bounds checks instead of manual indexing

Files:

  • program-libs/account-checks/src/packed_accounts.rs
program-libs/account-checks/src/account_iterator.rs

📄 CodeRabbit inference engine (program-libs/account-checks/CLAUDE.md)

Use AccountIterator for sequential account retrieval to get precise file:line:column error locations; avoid manual index handling

Files:

  • program-libs/account-checks/src/account_iterator.rs
program-libs/account-checks/**/Cargo.toml

📄 CodeRabbit inference engine (program-libs/account-checks/CLAUDE.md)

Define features solana, pinocchio, and test-only in Cargo.toml; default build should enable none

Files:

  • program-libs/account-checks/Cargo.toml
🧠 Learnings (33)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/**/Cargo.toml : Define features solana, pinocchio, and test-only in Cargo.toml; default build should enable none
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/{solana.rs,pinocchio.rs,test_account_info.rs} : Gate SDK-specific implementations with #[cfg(feature = "solana"|"pinocchio"|"test-only")]

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/compressed-account/Cargo.toml
  • program-libs/concurrent-merkle-tree/Cargo.toml
  • program-libs/account-checks/src/account_iterator.rs
  • program-libs/compressible/src/compression_info.rs
  • program-libs/batched-merkle-tree/Cargo.toml
  • program-libs/compressible/Cargo.toml
  • program-libs/account-checks/Cargo.toml
  • program-libs/ctoken-types/Cargo.toml
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/**/Cargo.toml : Define features solana, pinocchio, and test-only in Cargo.toml; default build should enable none

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/compressed-account/Cargo.toml
  • program-libs/concurrent-merkle-tree/Cargo.toml
  • program-libs/account-checks/src/account_iterator.rs
  • program-libs/compressible/src/compression_info.rs
  • Cargo.toml
  • program-libs/batched-merkle-tree/Cargo.toml
  • program-libs/compressible/Cargo.toml
  • program-libs/account-checks/Cargo.toml
  • program-libs/ctoken-types/Cargo.toml
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/config.rs : Ensure serialization compatibility across Anchor, Pinocchio, and Borsh for core account types used by dependent programs

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/compressed-account/Cargo.toml
  • program-libs/concurrent-merkle-tree/Cargo.toml
  • program-libs/account-checks/src/account_iterator.rs
  • program-libs/compressible/src/compression_info.rs
  • Cargo.toml
  • program-libs/compressible/Cargo.toml
  • program-libs/ctoken-types/Cargo.toml
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/MINT_ACTION.md : Document Mint operations and compressed mint management (9 actions) in instructions/MINT_ACTION.md

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/config.rs : Maintain CompressibleConfig account structure with Anchor/Borsh/Pod (Pinocchio/Pod) serialization and related state validation methods (validate_active, validate_not_inactive) in src/config.rs

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/compressible/src/compression_info.rs
  • program-libs/ctoken-types/Cargo.toml
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/program-libs/ctoken-types/** : Define all state and instruction data structures in the light-ctoken-types crate (program-libs/ctoken-types), including state/, instructions/, and state/extensions/

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • Cargo.toml
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/config.rs : Provide default initialization for the CToken V1 config in CompressibleConfig

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/account_info_trait.rs : Ensure the crate compiles with no features enabled by keeping trait definitions free of SDK-specific dependencies

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/compressed-account/Cargo.toml
  • program-libs/concurrent-merkle-tree/Cargo.toml
  • program-libs/account-checks/src/account_iterator.rs
  • program-libs/compressible/src/compression_info.rs
  • program-libs/account-checks/Cargo.toml
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/{solana.rs,pinocchio.rs,test_account_info.rs} : Provide SDK-specific AccountInfoTrait implementations in account_info/{solana.rs,pinocchio.rs,test_account_info.rs}

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/compressed-account/Cargo.toml
  • program-libs/concurrent-merkle-tree/Cargo.toml
  • program-libs/account-checks/src/account_iterator.rs
  • program-libs/compressible/src/compression_info.rs
  • program-libs/batched-merkle-tree/Cargo.toml
  • program-libs/compressible/Cargo.toml
  • program-libs/account-checks/Cargo.toml
  • program-libs/ctoken-types/Cargo.toml
📚 Learning: 2025-10-15T03:46:26.767Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/account_compression_cpi/mod.rs : Export each new operation module by adding pub mod <operation>; and re-export with pub use <operation>::*.

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/compressed-account/Cargo.toml
  • program-libs/compressible/src/compression_info.rs
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/error.rs : Define error types with numeric codes in the 19xxx range and propagate hasher errors in the 7xxx range; include ProgramError conversions (Anchor, Pinocchio, Solana) in src/error.rs

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/compressible/src/compression_info.rs
  • program-libs/batched-merkle-tree/Cargo.toml
📚 Learning: 2025-08-14T00:36:53.191Z
Learnt from: ananas-block
Repo: Lightprotocol/light-protocol PR: 1909
File: program-libs/zero-copy/src/init_mut.rs:241-249
Timestamp: 2025-08-14T00:36:53.191Z
Learning: In the light-protocol zero-copy crate, performance is prioritized over safety checks for edge cases like Vec lengths exceeding u32::MAX, even when there might be wire format inconsistencies.

Applied to files:

  • program-libs/ctoken-types/src/state/mint/compressed_mint.rs
  • program-libs/compressible/src/compression_info.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/discriminator.rs : Define and keep discriminator constants and the Discriminator trait in discriminator.rs for compile-time verification

Applied to files:

  • program-libs/account-checks/src/checks.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : Validate account type with 8-byte discriminators using check_discriminator before deserialization

Applied to files:

  • program-libs/account-checks/src/checks.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/checks.rs : Expose and maintain account validation helpers (check_owner, check_program, check_mut/non_mut, check_signer, check_discriminator, set_discriminator, check_pda_seeds, check_account_balance_is_rent_exempt, account_info_init) in checks.rs

Applied to files:

  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/DISCRIMINATOR.md : DISCRIMINATOR.md must document 8-byte discriminators, the Discriminator trait, constant arrays for compile-time checks, and integration with account initialization

Applied to files:

  • program-libs/account-checks/src/checks.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : On account initialization, call account_info_init to set the 8-byte discriminator

Applied to files:

  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/test_account_info.rs : Use the mock AccountInfo implementation under the test-only feature for unit tests

Applied to files:

  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/!(account_info)/**/*.rs : Use AccountInfoTrait for runtime-agnostic account handling; avoid direct solana-program or pinocchio AccountInfo in general logic

Applied to files:

  • program-libs/account-checks/src/checks.rs
  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/compressed-account/Cargo.toml
  • program-libs/concurrent-merkle-tree/Cargo.toml
  • program-libs/account-checks/src/account_iterator.rs
  • program-libs/compressible/src/compression_info.rs
  • program-libs/batched-merkle-tree/Cargo.toml
  • program-libs/account-checks/Cargo.toml
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/packed_accounts.rs : For dynamic account sets, use PackedAccounts for index-based access with bounds checks instead of manual indexing

Applied to files:

  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_iterator.rs : Use AccountIterator for sequential account retrieval to get precise file:line:column error locations; avoid manual index handling

Applied to files:

  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : Return AccountError variants (codes 12006–12021) and rely on automatic ProgramError conversions; avoid returning raw ProgramError directly

Applied to files:

  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/error.rs : Maintain stable mapping of AccountError to ProgramError, including Pinocchio code mapping (1–11), in error.rs

Applied to files:

  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-15T03:46:26.767Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/lib.rs : Load accounts according to type before check_forester: batched via BatchedMerkleTreeAccount::type_from_account_info(); regular via ctx.accounts.account.load()?.metadata; use custom deserialization when required.

Applied to files:

  • program-libs/account-checks/src/packed_accounts.rs
  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Code examples should demonstrate both Solana and Pinocchio usage where applicable

Applied to files:

  • program-libs/concurrent-merkle-tree/Cargo.toml
  • program-libs/batched-merkle-tree/Cargo.toml
  • program-libs/compressible/Cargo.toml
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_ITERATOR.md : ACCOUNT_ITERATOR.md must document the enhanced account iterator, including sequential processing, automatic validation, and location-based error reporting for debugging

Applied to files:

  • program-libs/account-checks/src/account_iterator.rs
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/docs/SOLANA_RENT.md : Maintain a comparison of Solana vs Light Protocol rent systems in docs/SOLANA_RENT.md

Applied to files:

  • program-libs/compressible/src/compression_info.rs
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/rent.rs : Implement and maintain rent calculation algorithms (rent_curve_per_epoch, calculate_rent_and_balance, claimable_lamports, calculate_close_lamports) in src/rent.rs

Applied to files:

  • program-libs/compressible/src/compression_info.rs
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: When working with ctoken accounts that have the Compressible extension, consult the rent system documentation (RENT.md, CONFIG_ACCOUNT.md, SOLANA_RENT.md) to follow rent authority, compression, and lamport distribution rules

Applied to files:

  • program-libs/compressible/src/compression_info.rs
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CLAIM.md : Document rent reclamation from expired compressible accounts in instructions/CLAIM.md

Applied to files:

  • program-libs/compressible/src/compression_info.rs
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/src/create_token_account.rs : Create Token Account instruction must validate that the config state is ACTIVE only

Applied to files:

  • program-libs/compressible/src/compression_info.rs
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/src/create_associated_token_account.rs : Create Associated Token Account instruction must validate that the config state is ACTIVE only

Applied to files:

  • program-libs/compressible/src/compression_info.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: Test program-libs-slow
  • GitHub Check: Forester e2e test
  • GitHub Check: Test program-libs-fast
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: cli-v1
  • GitHub Check: stateless-js-v2
  • GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • GitHub Check: programs (system-cpi-test-v2-functional-read-only, ["cargo-test-sbf -p system-cpi-v2-test -- func...
  • GitHub Check: system-programs (anchor & pinocchio, ["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk...
  • GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "cargo-...
  • GitHub Check: programs (system-cpi-test-v2-functional-account-infos, ["cargo-test-sbf -p system-cpi-v2-test -- ...
  • GitHub Check: system-programs (native, ["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-t...
  • GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
  • GitHub Check: system-programs (sdk-libs, light-sdk-macros light-sdk light-program-test light-client light-compr...
  • GitHub Check: programs (light-system-program-address, ["cargo-test-sbf -p system-test -- test_with_address", "c...
  • GitHub Check: system-programs (token test, ["cargo-test-sbf -p sdk-token-test"])
  • GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
  • GitHub Check: lint
  • GitHub Check: cli-v2
  • GitHub Check: stateless-js-v1
🔇 Additional comments (13)
program-libs/account-checks/src/checks.rs (1)

84-84: LGTM! Feature gating is correct.

The conditional compilation guard correctly requires both msg and std features for logging, aligning with the PR's objective of making message/logging functionality optional.

Cargo.toml (1)

213-213: Verify if the version bump is intentional.

The light-bounded-vec version is updated from 2.0.0 to 2.0.1. Please confirm whether this patch version bump is related to the feature gate changes or if it should be in a separate commit.

program-libs/account-checks/src/packed_accounts.rs (1)

1-2: LGTM! Feature gating is consistent.

The conditional compilation guards correctly require both msg and std features for the Location type and error message emission. This aligns with the PR's objective and is consistent with the gating pattern applied in other files.

Also applies to: 18-25

program-libs/account-checks/src/account_iterator.rs (1)

51-58: LGTM! Comprehensive and consistent feature gating.

The conditional compilation guards are correctly applied throughout the iterator:

  • Error messages in next_account and remaining are gated by msg and std
  • The print_on_error methods properly gate logging
  • The print_on_error_pubkey method correctly requires the solana feature for Pubkey formatting
  • Negative guards handle unused variables when features are disabled

Also applies to: 186-194, 238-249, 260-285

program-libs/compressible/src/compression_info.rs (1)

215-221: LGTM! Logging is properly gated behind the solana feature.

The solana_msg::msg! calls are correctly gated by the solana feature using fully-qualified paths. The control flow remains unchanged - error returns occur regardless of whether logging is enabled.

Also applies to: 230-236

program-libs/compressible/Cargo.toml (1)

8-8: LGTM! Feature configuration is correct.

The changes correctly:

  • Add solana-msg to the solana feature set
  • Mark solana-msg as optional in dependencies

This aligns with the PR's objective and is consistent with the pattern applied in other crates.

Also applies to: 22-22

program-libs/compressed-account/Cargo.toml (2)

12-13: LGTM! solana-msg correctly moved to solana feature.

The changes correctly move solana-msg from the std feature to the solana feature, aligning with the PR's objective of making message/logging functionality optional and gating it appropriately.


17-17: Verify if the new-unique feature is related to this PR.

A new feature new-unique has been added. Please confirm whether this is related to the feature gate fixes or if it should be in a separate PR/commit.

program-libs/account-checks/Cargo.toml (1)

17-19: LGTM! Core feature configuration for the msg feature.

The changes correctly:

  • Introduce a new msg feature that depends on solana-msg
  • Include msg in the solana feature set
  • Mark solana-msg as optional in dependencies

This enables the conditional compilation changes throughout the crate and aligns perfectly with the PR's objective of making message/logging functionality optional.

Also applies to: 31-31

program-libs/ctoken-types/src/state/mint/compressed_mint.rs (1)

6-7: LGTM! Conditional import is correctly gated.

The import of solana_msg::msg is properly gated behind the solana feature, allowing the crate to be built without Solana-specific logging functionality.

program-libs/batched-merkle-tree/Cargo.toml (2)

17-17: LGTM! Correct pattern for optional solana-msg.

The changes correctly gate solana-msg behind the solana feature by:

  1. Adding it to the solana feature set (line 17)
  2. Marking the dependency as optional (line 43)

This aligns with the workspace-wide pattern for making Solana-specific logging optional.

Also applies to: 43-43


10-10: Verify default feature alignment with crate policy.

Line 10 sets default = ["solana"], which enables the Solana feature by default. However, the retrieved learnings indicate that "default build should enable none" for program-libs crates. Please confirm whether this default is intentional for this specific crate or should be changed to default = [].

Based on learnings.

program-libs/ctoken-types/Cargo.toml (1)

8-8: LGTM! Proper feature gating for solana-msg.

The changes correctly implement optional solana-msg support:

  1. Line 8: Added to the solana feature set
  2. Line 33: Marked as optional dependency

This enables the conditional compilation used in compressed_mint.rs where #[cfg(feature = "solana")] gates the message logging.

Also applies to: 33-33

@SwenSchaeferjohann SwenSchaeferjohann merged commit 866e4e0 into main Oct 31, 2025
32 checks passed
@ananas-block ananas-block deleted the jorrit/chore-fix-lib-features branch October 31, 2025 17:52
@coderabbitai coderabbitai bot mentioned this pull request Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants