Uh oh!
There was an error while loading. Please reload this page.
fix: add compress and close account uniqueness - #2035
Conversation
WalkthroughAdds duplicate-output detection to compress-and-close via a 256-bit bitmap; introduces Transfer2 CPI account parsing ( Changes
Sequence Diagram(s)sequenceDiagram
participant Forester as Forester (builder)
participant Registry as Registry (instruction builder)
participant Program as CompressedToken Program
participant Bitmap as Bitmap Validation
Forester->>Registry: build Transfer2 instruction (fee_payer, authority_idx, destination_idx, indices, packed_accounts)
Registry->>Program: invoke Transfer2 Instruction (outputs + compressions + authority_idx + destination_idx)
Program->>Bitmap: close_for_compress_and_close(compressions, accounts)
rect rgb(240, 250, 240)
Bitmap->>Bitmap: init 256-bit bitmap
end
loop per compression entry
Bitmap->>Bitmap: compute compressed_idx
alt idx >= 256 or invalid
Bitmap-->>Program: InvalidInstructionData (early return)
else idx already used
Bitmap-->>Program: CompressAndCloseDuplicateOutput (early return)
else
Bitmap->>Bitmap: mark idx
Bitmap->>Program: proceed to close_token_account (deferred)
end
end
Program-->>Registry: Success / Error
Registry-->>Forester: Result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (18)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (6)
🧰 Additional context used📓 Path-based instructions (1)programs/registry/src/lib.rs📄 CodeRabbit inference engine (programs/registry/CLAUDE.md)
Files:
🧠 Learnings (44)📓 Common learnings📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-15T03:46:26.767ZApplied to files:
📚 Learning: 2025-10-15T03:46:26.767ZApplied to files:
📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
📚 Learning: 2025-10-15T03:46:03.556ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
📚 Learning: 2025-10-15T03:46:26.767ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
📚 Learning: 2025-10-15T03:46:03.556ZApplied to files:
📚 Learning: 2025-10-15T03:46:03.556ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-15T03:46:03.556ZApplied to files:
📚 Learning: 2025-10-15T03:46:26.767ZApplied to files:
📚 Learning: 2025-10-15T03:46:26.767ZApplied to files:
📚 Learning: 2025-10-15T03:46:26.767ZApplied to files:
📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-11T21:59:52.712ZApplied to files:
📚 Learning: 2025-10-15T03:46:26.767ZApplied to files:
📚 Learning: 2025-10-15T03:46:03.556ZApplied to files:
📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-11T21:59:25.222ZApplied to files:
📚 Learning: 2025-10-15T03:45:40.038ZApplied to files:
📚 Learning: 2025-10-15T03:46:03.556ZApplied to files:
📚 Learning: 2025-10-16T06:33:19.426ZApplied to files:
📚 Learning: 2025-10-16T06:33:55.362ZApplied to files:
🧬 Code graph analysis (6)programs/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rs (1)
programs/registry/src/compressible/compress_and_close.rs (2)
sdk-libs/program-test/src/forester/compress_and_close_forester.rs (1)
programs/registry/src/compressible/compressed_token/compress_and_close.rs (1)
programs/registry/src/compressible/compressed_token/mod.rs (2)
programs/registry/src/lib.rs (1)
⏰ 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). (15)
🔇 Additional comments (13)
Comment |
6b3c9e9 to
e4e6315CompareThere was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
sdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rs (1)
184-193: Remove the 32-element hard cap when materializing packed accounts.
ArrayVec::<_, 32>panics as soon aspacked_accounts.len() > 32. A CompressAndClose batch with diverse owners/rent sponsors easily exceeds that, turning what should be a supported flow into a runtime abort. Use a growableVecsized topacked_accounts.len()(or another fallible structure) so large batches stay safe.- let mut packed_account_metas = arrayvec::ArrayVec::<AccountMeta, 32>::new();- for info in packed_accounts.iter() {- packed_account_metas.push(AccountMeta {+ let mut packed_account_metas = Vec::with_capacity(packed_accounts.len());+ for info in packed_accounts.iter() {+ packed_account_metas.push(AccountMeta { pubkey: *info.key, is_signer: info.is_signer, is_writable: info.is_writable, }); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (17)
Cargo.toml(1 hunks)program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs(1 hunks)program-tests/compressed-token-test/tests/ctoken/shared.rs(2 hunks)programs/compressed-token/anchor/src/lib.rs(1 hunks)programs/compressed-token/program/Cargo.toml(1 hunks)programs/compressed-token/program/docs/instructions/TRANSFER2.md(2 hunks)programs/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rs(3 hunks)programs/compressed-token/program/tests/compress_and_close.rs(1 hunks)programs/registry/Cargo.toml(1 hunks)programs/registry/src/compressible/compress_and_close.rs(3 hunks)programs/registry/src/compressible/compressed_token/accounts.rs(1 hunks)programs/registry/src/compressible/compressed_token/compress_and_close.rs(1 hunks)programs/registry/src/compressible/compressed_token/mod.rs(1 hunks)programs/registry/src/compressible/mod.rs(1 hunks)programs/registry/src/lib.rs(3 hunks)sdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rs(1 hunks)sdk-libs/program-test/src/forester/compress_and_close_forester.rs(4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
programs/compressed-token/program/docs/**/instructions/**/*.md
📄 CodeRabbit inference engine (programs/compressed-token/program/docs/CLAUDE.md)
Keep detailed instruction documentation files under the instructions/ directory; add additional instruction docs as needed
Files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
programs/compressed-token/program/docs/instructions/*.md
📄 CodeRabbit inference engine (programs/compressed-token/program/CLAUDE.md)
Every instruction description must include: path, description, instruction_data (code paths), Accounts (order and checks), instruction logic and checks, and Errors (with causes)
Files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
programs/registry/src/lib.rs
📄 CodeRabbit inference engine (programs/registry/CLAUDE.md)
programs/registry/src/lib.rs: Wrapper instruction handlers must: (1) load the target account metadata; (2) call check_forester with correct authority, target, forester PDA (optional), and computed work_units; (3) delegate via a CPI using a PDA signer.
Instruction handlers must compute work_units by operation type: batch operations use account.queue_batches.batch_size; single operations use DEFAULT_WORK_V1; custom operations compute based on complexity.
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.
Apply forester eligibility rules: with a forester PDA, validate epoch registration, eligibility, track work, and require network fee; without a forester PDA, ensure authority matches the tree’s designated forester.
Files:
programs/registry/src/lib.rs
🧠 Learnings (50)
📓 Common learnings
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/CLOSE_TOKEN_ACCOUNT.md : Document closing decompressed token accounts with rent distribution in instructions/CLOSE_TOKEN_ACCOUNT.md
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/transfer2/native_compression/** : Compress & Close operations (via registry) must validate that the config state is not INACTIVE (active or deprecated allowed)
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/*.rs : Context structs for wrapper instructions must include standard accounts: optional registered_forester_pda (mut), authority Signer, cpi_authority with seeds/bump for CPI_AUTHORITY_PDA_SEED, registered_program_pda, target program handle, log_wrapper, and mutable target_account.
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/**/*.rs : CPI processing functions must derive PDA signer seeds as [CPI_AUTHORITY_PDA_SEED, bump] and use CpiContext::new_with_signer with cpi_authority as the authority account and mapped target accounts.
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/**/*.rs : Pass the data Vec<u8> through unchanged from the wrapper to the target program CPI; the target program performs deserialization.
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>::*.
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/*.rs : Each new operation module must define an Anchor context struct (e.g., NewOperationContext) with required accounts and a process_<operation> function that prepares signer seeds, maps accounts to the target program, and executes the CPI.
📚 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/programs/compressed-token/anchor/src/lib.rs : Define all program-specific error codes in anchor_compressed_token::ErrorCode in programs/compressed-token/anchor/src/lib.rs; return errors as ProgramError::Custom(error_code as u32)
Applied to files:
programs/compressed-token/anchor/src/lib.rsprograms/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.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:
programs/compressed-token/anchor/src/lib.rsprogram-tests/compressed-token-test/tests/ctoken/compress_and_close.rssdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.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 : Ensure serialization compatibility across Anchor, Pinocchio, and Borsh for core account types used by dependent programs
Applied to files:
programs/compressed-token/anchor/src/lib.rsprogram-tests/compressed-token-test/tests/ctoken/compress_and_close.rssdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/registry/src/compressible/mod.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/Cargo.tomlprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.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:
programs/compressed-token/anchor/src/lib.rsprogram-tests/compressed-token-test/tests/ctoken/compress_and_close.rssdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rsprograms/registry/src/compressible/mod.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.rsprograms/registry/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/error.rs : Maintain stable mapping of AccountError to ProgramError, including Pinocchio code mapping (1–11), in error.rs
Applied to files:
programs/compressed-token/anchor/src/lib.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.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/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:
programs/compressed-token/anchor/src/lib.rsprogram-tests/compressed-token-test/tests/ctoken/compress_and_close.rssdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/registry/src/compressible/mod.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.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/ERRORS.md : Document error types, codes, causes, and resolutions in docs/ERRORS.md
Applied to files:
programs/compressed-token/anchor/src/lib.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:
programs/compressed-token/anchor/src/lib.rsprogram-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compressed_token/accounts.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/CLOSE_TOKEN_ACCOUNT.md : Document closing decompressed token accounts with rent distribution in instructions/CLOSE_TOKEN_ACCOUNT.md
Applied to files:
programs/compressed-token/anchor/src/lib.rsprogram-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdsdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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/{solana.rs,pinocchio.rs,test_account_info.rs} : Gate SDK-specific implementations with #[cfg(feature = "solana"|"pinocchio"|"test-only")]
Applied to files:
program-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/lib.rsprograms/registry/Cargo.tomlprograms/registry/src/compressible/compressed_token/mod.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/{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-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/registry/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/*.rs : Context structs for wrapper instructions must include standard accounts: optional registered_forester_pda (mut), authority Signer, cpi_authority with seeds/bump for CPI_AUTHORITY_PDA_SEED, registered_program_pda, target program handle, log_wrapper, and mutable target_account.
Applied to files:
program-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.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/account_compression_cpi/**/*.rs : Pass the data Vec<u8> through unchanged from the wrapper to the target program CPI; the target program performs deserialization.
Applied to files:
program-tests/compressed-token-test/tests/ctoken/compress_and_close.rssdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/compressed-token/program/Cargo.tomlprograms/registry/src/compressible/compressed_token/mod.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/account_compression_cpi/**/*.rs : CPI processing functions must derive PDA signer seeds as [CPI_AUTHORITY_PDA_SEED, bump] and use CpiContext::new_with_signer with cpi_authority as the authority account and mapped target accounts.
Applied to files:
program-tests/compressed-token-test/tests/ctoken/compress_and_close.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.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-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/registry/src/lib.rsprograms/registry/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/test_account_info.rs : Use the mock AccountInfo implementation under the test-only feature for unit tests
Applied to files:
program-tests/compressed-token-test/tests/ctoken/compress_and_close.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-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/registry/src/compressible/mod.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/Cargo.tomlprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.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-tests/compressed-token-test/tests/ctoken/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdsdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.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 : Provide PDA derivation helpers (derive_pda, derive_v1_config_pda) in src/config.rs for CompressibleConfig
Applied to files:
sdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rsprograms/registry/src/compressible/mod.rsprograms/registry/src/lib.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/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:
sdk-libs/compressed-token-sdk/src/instructions/compress_and_close.rsprograms/registry/src/compressible/mod.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/lib.rsprograms/compressed-token/program/Cargo.tomlprograms/registry/Cargo.tomlprograms/registry/src/compressible/compressed_token/mod.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/transfer2/native_compression/** : Compress & Close operations (via registry) must validate that the config state is not INACTIVE (active or deprecated allowed)
Applied to files:
programs/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/registry/src/compressible/mod.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions
Applied to files:
programs/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdsdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.rs
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/ACCOUNTS.md : Maintain ACCOUNTS.md with complete account layouts and data structures
Applied to files:
programs/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/mod.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:
programs/compressed-token/program/tests/compress_and_close.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/lib.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:
programs/compressed-token/program/tests/compress_and_close.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.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/DECOMPRESSED_TRANSFER.md : Document SPL-compatible transfers between decompressed accounts in instructions/DECOMPRESSED_TRANSFER.md
Applied to files:
programs/compressed-token/program/tests/compress_and_close.rsprograms/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.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/TRANSFER2.md : Document the batch transfer instruction supporting compressed/decompressed operations in instructions/TRANSFER2.md
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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/{CREATE_TOKEN_ACCOUNT,MINT_ACTION,TRANSFER2,CLAIM,CLOSE_TOKEN_ACCOUNT,DECOMPRESSED_TRANSFER,WITHDRAW_FUNDING_POOL}.md : Every instruction description must include sections: path, description, instruction_data, Accounts, instruction logic and checks, Errors
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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/MINT_ACTION.md : Document Mint operations and compressed mint management (9 actions) in instructions/MINT_ACTION.md
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
📚 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:
programs/compressed-token/program/docs/instructions/TRANSFER2.mdprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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/docs/instructions/*.md : Every instruction description must include: path, description, instruction_data (code paths), Accounts (order and checks), instruction logic and checks, and Errors (with causes)
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
📚 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/CREATE_TOKEN_ACCOUNT.md : Document Create Token Account & Associated Token Account instructions in instructions/CREATE_TOKEN_ACCOUNT.md
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
📚 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: Use specific error variants for authorization and fee failures: InvalidSigner, InvalidNetworkFee, ForesterDefined/Undefined.
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
📚 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/**/ERRORS.md : ERRORS.md must document error types with numeric codes in the 12006–12021 range, common causes, resolution strategies, and conversion mappings for Solana and Pinocchio
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
📚 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/**/ERRORS.md : Error codes should reference the actual values that appear in transaction logs
Applied to files:
programs/compressed-token/program/docs/instructions/TRANSFER2.md
📚 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:
programs/registry/src/compressible/mod.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprogram-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/lib.rsprograms/compressed-token/program/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: Read this file and all referenced Markdown files in full before working on the compressed-token program
Applied to files:
programs/registry/src/compressible/mod.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/CONFIG_ACCOUNT.md : Document the CompressibleConfig account structure and methods in docs/CONFIG_ACCOUNT.md
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.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/packed_accounts.rs : For dynamic account sets, use PackedAccounts for index-based access with bounds checks instead of manual indexing
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rsprograms/registry/src/compressible/compressed_token/accounts.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/**/PACKED_ACCOUNTS.md : PACKED_ACCOUNTS.md must document index-based dynamic account access, including accessing mint, owner, and delegate accounts by index with bounds checking
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.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:
sdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/accounts.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/account_compression_cpi/*.rs : Each new operation module must define an Anchor context struct (e.g., NewOperationContext) with required accounts and a process_<operation> function that prepares signer seeds, maps accounts to the target program, and executes the CPI.
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compress_and_close.rsprograms/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compressed_token/mod.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:
programs/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.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 : Wrapper instruction handlers must: (1) load the target account metadata; (2) call check_forester with correct authority, target, forester PDA (optional), and computed work_units; (3) delegate via a CPI using a PDA signer.
Applied to files:
programs/registry/src/compressible/compress_and_close.rs
📚 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:
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/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md
Applied to files:
programs/registry/src/compressible/compressed_token/accounts.rsprograms/registry/src/compressible/compressed_token/mod.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:
programs/registry/src/compressible/compressed_token/accounts.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:
programs/registry/src/compressible/compressed_token/accounts.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/**/Cargo.toml : Define features solana, pinocchio, and test-only in Cargo.toml; default build should enable none
Applied to files:
programs/compressed-token/program/Cargo.tomlprograms/registry/Cargo.toml
🧬 Code graph analysis (8)
programs/compressed-token/program/tests/compress_and_close.rs (3)
sdk-libs/compressed-token-sdk/src/account2.rs (2)
compression(379-381)mint(371-373)programs/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rs (1)
close_for_compress_and_close(169-225)program-libs/ctoken-types/src/state/ctoken/zero_copy.rs (1)
new_compressible(612-621)
sdk-libs/program-test/src/forester/compress_and_close_forester.rs (2)
programs/registry/src/lib.rs (1)
compress_and_close(785-800)js/stateless.js/src/errors.ts (1)
RpcError(79-79)
programs/compressed-token/program/src/transfer2/compression/ctoken/compress_and_close.rs (1)
programs/compressed-token/program/src/close_token_account/processor.rs (2)
validate_token_account_for_close_transfer2(48-53)close_token_account(142-145)
programs/registry/src/compressible/compress_and_close.rs (2)
programs/registry/src/compressible/compressed_token/compress_and_close.rs (1)
compress_and_close_ctoken_accounts_with_indices(51-187)programs/registry/src/compressible/compressed_token/accounts.rs (2)
try_from_account_infos(90-95)packed_accounts(98-100)
programs/registry/src/lib.rs (1)
programs/registry/src/compressible/compress_and_close.rs (1)
process_compress_and_close(38-89)
programs/registry/src/compressible/compressed_token/accounts.rs (2)
js/stateless.js/src/constants.ts (1)
COMPRESSED_TOKEN_PROGRAM_ID(256-258)sdk-libs/sdk-types/src/cpi_accounts/v1.rs (1)
light_system_program(114-119)
programs/registry/src/compressible/compressed_token/compress_and_close.rs (3)
js/stateless.js/src/constants.ts (1)
COMPRESSED_TOKEN_PROGRAM_ID(256-258)programs/registry/src/compressible/compressed_token/accounts.rs (1)
packed_accounts(98-100)js/stateless.js/src/state/types.ts (1)
CompressedCpiContext(353-368)
programs/registry/src/compressible/compressed_token/mod.rs (3)
programs/registry/src/lib.rs (1)
compress_and_close(785-800)programs/registry/src/compressible/compressed_token/compress_and_close.rs (1)
compress_and_close_ctoken_accounts_with_indices(51-187)js/stateless.js/src/constants.ts (1)
COMPRESSED_TOKEN_PROGRAM_ID(256-258)
⏰ 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: Forester e2e test
- GitHub Check: stateless-js-v1
- GitHub Check: lint
- GitHub Check: programs (light-system-program-address, ["cargo-test-sbf -p system-test -- test_with_address", "c...
- GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
- GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
- GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
- GitHub Check: programs (system-cpi-test-v2-functional-account-infos, ["cargo-test-sbf -p system-cpi-v2-test -- ...
- GitHub Check: programs (system-cpi-test-v2-functional-read-only, ["cargo-test-sbf -p system-cpi-v2-test -- func...
- GitHub Check: programs (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "cargo-...
- GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
- GitHub Check: Test program-libs-slow
- GitHub Check: Test program-libs-fast
- GitHub Check: Test batched-merkle-tree-simulate
- GitHub Check: system-programs (token test, ["cargo-test-sbf -p sdk-token-test"])
- GitHub Check: system-programs (sdk-libs, light-sdk-macros light-sdk light-program-test light-client light-compr...
- GitHub Check: system-programs (anchor & pinocchio, ["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk...
- GitHub Check: system-programs (native, ["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-t...
- GitHub Check: cli-v2
- GitHub Check: cli-v1
- GitHub Check: stateless-js-v2
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
21b43de to
eaa8db9CompareThere was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
programs/registry/src/compressible/compressed_token/compress_and_close.rs (2)
64-116: Critical: Missing bounds validation for authority_index and per-output indices.While
packed_accounts.get_u8(idx.source_index, ...)at line 82 validates the source index, the function never checks thatauthority_index(used at line 119) or the other indices (mint_index,owner_index,rent_sponsor_indexused in lines 96, 99, 107, 110) are within bounds. If a caller supplies an out-of-bounds index, Line 119 will panic, or lines 96-113 will construct invalid output data referencing non-existent accounts.Add explicit bounds checks at the start of the function:
// Convert packed_accounts to AccountMetas let mut packed_account_metas = Vec::with_capacity(packed_accounts.accounts.len()); + let packed_len = packed_accounts.accounts.len();++ // Validate authority_index and destination_index upfront+ if (authority_index as usize) >= packed_len || (destination_index as usize) >= packed_len {+ msg!("authority_index or destination_index out of bounds");+ return Err(ProgramError::NotEnoughAccountKeys.into());+ }+ for info in packed_accounts.accounts.iter() {And in the loop:
// Process each set of indices for (i, idx) in indices.iter().enumerate() { + // Validate all indices for this compression+ if (idx.source_index as usize) >= packed_len+ || (idx.mint_index as usize) >= packed_len+ || (idx.owner_index as usize) >= packed_len+ || (idx.rent_sponsor_index as usize) >= packed_len+ {+ msg!("Invalid index in CompressAndCloseIndices");+ return Err(ProgramError::NotEnoughAccountKeys.into());+ }+ // Get the amount from the source token account
167-170: Critical: Use actual system program ID instead of all-zero pubkey.Line 168 creates an AccountMeta with
Pubkey::from([0u8; 32])for the system program. This all-zero pubkey won't match the actual system programAccountInfoat runtime, causing the CPI viainvoke_signedto fail with a key mismatch error.Replace with the real system program ID:
+use anchor_lang::solana_program::system_program;+ // ... account_metas.push(AccountMeta::new_readonly( - Pubkey::from([0u8; 32]), // system_program+ system_program::ID, false, ));
🧹 Nitpick comments (1)
sdk-libs/program-test/src/forester/compress_and_close_forester.rs (1)
61-63: Remove leftover debug loggingThe
println!on Line 62 is a stray debug statement that will spam test output. Please drop it to keep the helper quiet.- println!("config compression_authority {:?}", compression_authority);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
Cargo.toml(1 hunks)program-libs/bloom-filter/Cargo.toml(1 hunks)program-tests/compressed-token-test/tests/ctoken/shared.rs(2 hunks)programs/registry/src/compressible/compress_and_close.rs(3 hunks)programs/registry/src/compressible/compressed_token/accounts.rs(1 hunks)programs/registry/src/compressible/compressed_token/compress_and_close.rs(1 hunks)programs/registry/src/lib.rs(3 hunks)sdk-libs/program-test/src/forester/compress_and_close_forester.rs(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- Cargo.toml
- programs/registry/src/compressible/compressed_token/accounts.rs
🧰 Additional context used
📓 Path-based instructions (1)
programs/registry/src/lib.rs
📄 CodeRabbit inference engine (programs/registry/CLAUDE.md)
programs/registry/src/lib.rs: Wrapper instruction handlers must: (1) load the target account metadata; (2) call check_forester with correct authority, target, forester PDA (optional), and computed work_units; (3) delegate via a CPI using a PDA signer.
Instruction handlers must compute work_units by operation type: batch operations use account.queue_batches.batch_size; single operations use DEFAULT_WORK_V1; custom operations compute based on complexity.
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.
Apply forester eligibility rules: with a forester PDA, validate epoch registration, eligibility, track work, and require network fee; without a forester PDA, ensure authority matches the tree’s designated forester.
Files:
programs/registry/src/lib.rs
🧠 Learnings (37)
📓 Common learnings
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/CLOSE_TOKEN_ACCOUNT.md : Document closing decompressed token accounts with rent distribution in instructions/CLOSE_TOKEN_ACCOUNT.md
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/transfer2/native_compression/** : Compress & Close operations (via registry) must validate that the config state is not INACTIVE (active or deprecated allowed)
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/*.rs : Context structs for wrapper instructions must include standard accounts: optional registered_forester_pda (mut), authority Signer, cpi_authority with seeds/bump for CPI_AUTHORITY_PDA_SEED, registered_program_pda, target program handle, log_wrapper, and mutable target_account.
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
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/TRANSFER2.md : Document the batch transfer instruction supporting compressed/decompressed operations in instructions/TRANSFER2.md
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/**/*.rs : CPI processing functions must derive PDA signer seeds as [CPI_AUTHORITY_PDA_SEED, bump] and use CpiContext::new_with_signer with cpi_authority as the authority account and mapped target accounts.
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/DECOMPRESSED_TRANSFER.md : Document SPL-compatible transfers between decompressed accounts in instructions/DECOMPRESSED_TRANSFER.md
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>::*.
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/CONFIG_ACCOUNT.md : Document the CompressibleConfig account structure and methods in docs/CONFIG_ACCOUNT.md
📚 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-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.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/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-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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 : Ensure serialization compatibility across Anchor, Pinocchio, and Borsh for core account types used by dependent programs
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.rsprogram-libs/bloom-filter/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/*.rs : Context structs for wrapper instructions must include standard accounts: optional registered_forester_pda (mut), authority Signer, cpi_authority with seeds/bump for CPI_AUTHORITY_PDA_SEED, registered_program_pda, target program handle, log_wrapper, and mutable target_account.
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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 : Provide default initialization for the CToken V1 config in CompressibleConfig
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compress_and_close.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/transfer2/native_compression/** : Compress & Close operations (via registry) must validate that the config state is not INACTIVE (active or deprecated allowed)
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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/account_compression_cpi/**/*.rs : Pass the data Vec<u8> through unchanged from the wrapper to the target program CPI; the target program performs deserialization.
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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/{solana.rs,pinocchio.rs,test_account_info.rs} : Gate SDK-specific implementations with #[cfg(feature = "solana"|"pinocchio"|"test-only")]
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprogram-libs/bloom-filter/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/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-tests/compressed-token-test/tests/ctoken/shared.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-tests/compressed-token-test/tests/ctoken/shared.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-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compress_and_close.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/programs/compressed-token/anchor/src/lib.rs : Define all program-specific error codes in anchor_compressed_token::ErrorCode in programs/compressed-token/anchor/src/lib.rs; return errors as ProgramError::Custom(error_code as u32)
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compress_and_close.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 : Provide PDA derivation helpers (derive_pda, derive_v1_config_pda) in src/config.rs for CompressibleConfig
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rsprograms/registry/src/lib.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/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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/CLOSE_TOKEN_ACCOUNT.md : Document closing decompressed token accounts with rent distribution in instructions/CLOSE_TOKEN_ACCOUNT.md
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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/DECOMPRESSED_TRANSFER.md : Document SPL-compatible transfers between decompressed accounts in instructions/DECOMPRESSED_TRANSFER.md
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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/account_compression_cpi/**/*.rs : CPI processing functions must derive PDA signer seeds as [CPI_AUTHORITY_PDA_SEED, bump] and use CpiContext::new_with_signer with cpi_authority as the authority account and mapped target accounts.
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/lib.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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/{CREATE_TOKEN_ACCOUNT,MINT_ACTION,TRANSFER2,CLAIM,CLOSE_TOKEN_ACCOUNT,DECOMPRESSED_TRANSFER,WITHDRAW_FUNDING_POOL}.md : Every instruction description must include sections: path, description, instruction_data, Accounts, instruction logic and checks, Errors
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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-tests/compressed-token-test/tests/ctoken/shared.rssdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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/CONFIG_ACCOUNT.md : Document the CompressibleConfig account structure and methods in docs/CONFIG_ACCOUNT.md
Applied to files:
program-tests/compressed-token-test/tests/ctoken/shared.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/packed_accounts.rs : For dynamic account sets, use PackedAccounts for index-based access with bounds checks instead of manual indexing
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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/**/PACKED_ACCOUNTS.md : PACKED_ACCOUNTS.md must document index-based dynamic account access, including accessing mint, owner, and delegate accounts by index with bounds checking
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.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:
sdk-libs/program-test/src/forester/compress_and_close_forester.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/account_compression_cpi/*.rs : Each new operation module must define an Anchor context struct (e.g., NewOperationContext) with required accounts and a process_<operation> function that prepares signer seeds, maps accounts to the target program, and executes the CPI.
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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 : Wrapper instruction handlers must: (1) load the target account metadata; (2) call check_forester with correct authority, target, forester PDA (optional), and computed work_units; (3) delegate via a CPI using a PDA signer.
Applied to files:
sdk-libs/program-test/src/forester/compress_and_close_forester.rsprograms/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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:
programs/registry/src/lib.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:
programs/registry/src/compressible/compressed_token/compress_and_close.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/TRANSFER2.md : Document the batch transfer instruction supporting compressed/decompressed operations in instructions/TRANSFER2.md
Applied to files:
programs/registry/src/compressible/compressed_token/compress_and_close.rsprograms/registry/src/compressible/compress_and_close.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:
programs/registry/src/compressible/compressed_token/compress_and_close.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:
programs/registry/src/compressible/compressed_token/compress_and_close.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:
programs/registry/src/compressible/compressed_token/compress_and_close.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:
programs/registry/src/compressible/compressed_token/compress_and_close.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/{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:
programs/registry/src/compressible/compressed_token/compress_and_close.rsprogram-libs/bloom-filter/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/bloom-filter/Cargo.toml
🧬 Code graph analysis (4)
sdk-libs/program-test/src/forester/compress_and_close_forester.rs (1)
programs/registry/src/lib.rs (1)
compress_and_close(785-800)
programs/registry/src/lib.rs (1)
programs/registry/src/compressible/compress_and_close.rs (1)
process_compress_and_close(34-81)
programs/registry/src/compressible/compressed_token/compress_and_close.rs (1)
js/stateless.js/src/constants.ts (1)
COMPRESSED_TOKEN_PROGRAM_ID(256-258)
programs/registry/src/compressible/compress_and_close.rs (2)
programs/registry/src/compressible/compressed_token/compress_and_close.rs (1)
compress_and_close_ctoken_accounts_with_indices(52-179)programs/registry/src/compressible/compressed_token/accounts.rs (1)
try_from_account_infos(33-80)
⏰ 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: programs (system-cpi-test-v2-functional-read-only, ["cargo-test-sbf -p system-cpi-v2-test -- func...
- GitHub Check: programs (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "cargo-...
- GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
- GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
- GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
- GitHub Check: programs (system-cpi-test-v2-functional-account-infos, ["cargo-test-sbf -p system-cpi-v2-test -- ...
- GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
- GitHub Check: programs (light-system-program-address, ["cargo-test-sbf -p system-test -- test_with_address", "c...
- GitHub Check: stateless-js-v1
- GitHub Check: system-programs (native, ["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-t...
- GitHub Check: system-programs (anchor & pinocchio, ["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk...
- GitHub Check: system-programs (sdk-libs, light-sdk-macros light-sdk light-program-test light-client light-compr...
- GitHub Check: Test program-libs-slow
- GitHub Check: Test batched-merkle-tree-simulate
- GitHub Check: Test program-libs-fast
- GitHub Check: system-programs (token test, ["cargo-test-sbf -p sdk-token-test"])
- GitHub Check: Forester e2e test
- GitHub Check: lint
- GitHub Check: stateless-js-v2
- GitHub Check: cli-v2
- GitHub Check: cli-v1
🔇 Additional comments (14)
program-libs/bloom-filter/Cargo.toml (1)
14-14: No action required.Verification confirms the workspace Cargo.toml properly declares
bitvec = { version = "1.0.1", default-features = false }. The bloom-filter crate correctly references this viaworkspace = true, and the pattern is consistent with other workspace members (e.g., compressed-token/program also uses the same dependency). The change is valid.program-tests/compressed-token-test/tests/ctoken/shared.rs (2)
13-13: Import path updated to match new module structure.The import correctly reflects the move of
CompressAndCloseIndicesto the registry's compressed_token module.
876-877: Test correctly adapted to new instruction signature.The authority_index and destination_index are now passed as top-level instruction parameters, aligning with the updated compress_and_close API.
programs/registry/src/compressible/compress_and_close.rs (5)
4-10: Imports correctly updated to match new module structure.The imports now reference the local compressed_token module with the new instruction builder and types.
12-32: Context struct simplified with new account parsing.The
compressed_token_programfield removal is appropriate sinceTransfer2CpiAccountsnow handles the complete account set parsing.
34-39: Function signature updated with proper lifetime constraints.The new parameters and lifetime bounds correctly support the updated instruction construction flow.
51-54: Account parsing centralized with new abstraction.The
Transfer2CpiAccountshelper properly validates and parses the account set for the CPI call.
56-62: Instruction construction delegated to new builder.The call correctly passes all required indices and packed accounts to the instruction builder.
programs/registry/src/lib.rs (3)
49-49: Import updated to match new module location.The type is now correctly imported from the local compressed_token module.
785-789: Public API signature updated with new parameters.The function correctly exposes authority_index and destination_index as required by the new instruction construction flow.
799-799: Call site correctly propagates new parameters.The indices are properly passed through to the processor function.
programs/registry/src/compressible/compressed_token/compress_and_close.rs (3)
27-33: Struct definition is well-designed.The
CompressAndCloseIndicesproperly encapsulates the per-account indices needed for each compress-and-close operation.
52-62: Function signature and empty validation are correct.The early return for empty indices prevents unnecessary processing.
123-149: Instruction data construction is correct.The
CompressedTokenInstructionDataTransfer2is properly built with the output accounts and compressions, serialized, and prefixed with the discriminator.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eaa8db9 to
2bec55eCompareUh oh!
There was an error while loading. Please reload this page.
Issue:
compress_and_close_ctoken_accounts_with_indicesbuilds the instruction based on the ctoken accounts in the registry program -> its not possible for foresters to specify compressed output accounts.Changes:
ErrorCode::CompressAndCloseDuplicateOutput(incl unit test)light-registrycompress and close instruction building from compressed-token-sdk tolight-registry(the program should not depend on sdk-libs crates)authority_indexanddestination_indexon instruction level instead of account levelSummary by CodeRabbit
New Features
Bug Fixes
Chores