Skip to content

refactor: remove create ata2#2098

Merged
ananas-block merged 1 commit intomainfrom
jorrit/refactor-remove-create-ata2
Dec 5, 2025
Merged

refactor: remove create ata2#2098
ananas-block merged 1 commit intomainfrom
jorrit/refactor-remove-create-ata2

Conversation

@ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Dec 5, 2025

Summary by CodeRabbit

  • Refactor
    • Unified associated token account creation by consolidating separate instruction variants into a single pathway.
    • Restructured account input requirements, with owner and mint now provided as account inputs rather than instruction data fields.
    • Updated account ordering for improved operational consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Warning

Rate limit exceeded

@ananas-block has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c9a3753 and 822f861.

⛔ Files ignored due to path filters (4)
  • program-tests/compressed-token-test/tests/ctoken/create_ata.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/src/create_ata.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/src/create_ata2.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs is excluded by none and included by none
📒 Files selected for processing (8)
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs (0 hunks)
  • program-libs/ctoken-types/src/instructions/create_associated_token_account2.rs (0 hunks)
  • program-libs/ctoken-types/src/instructions/mod.rs (0 hunks)
  • programs/compressed-token/program/src/create_associated_token_account.rs (3 hunks)
  • programs/compressed-token/program/src/create_associated_token_account2.rs (0 hunks)
  • programs/compressed-token/program/src/lib.rs (0 hunks)
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs (5 hunks)
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs (1 hunks)

Walkthrough

This pull request consolidates the associated token account (ATA) creation flow by removing the separate ATA2 instruction variant and merging both code paths into a unified implementation. Owner and mint are now sourced from account inputs rather than instruction data, eliminating the CreateAssociatedTokenAccount2 instruction type and related data structures across instruction types, program logic, and SDK APIs.

Changes

Cohort / File(s) Summary
Instruction Data Cleanup
program-libs/ctoken-types/src/instructions/create_associated_token_account.rs, create_associated_token_account2.rs, mod.rs
Removed owner and mint fields from CreateAssociatedTokenAccountInstructionData, eliminated entire CreateAssociatedTokenAccount2InstructionData struct, and removed public module export for create_associated_token_account2
Program Instruction Processing
programs/compressed-token/program/src/create_associated_token_account.rs, create_associated_token_account2.rs, lib.rs
Modified ATA creation to extract owner and mint from account inputs; removed all ATA2 public entry points and instruction variants (CreateAssociatedTokenAccount2, CreateAssociatedTokenAccount2Idempotent); removed discriminators 106 and 107
SDK Consolidation
sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
Removed CreateAssociatedTokenAccount2 struct and V2 path; unified CreateAssociatedTokenAccount as single public API; reordered fields to payer, owner, mint, associated_token_account, bump, compressible, idempotent; updated with_compressible parameter naming
Test Updates
sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
Updated account count assertion from 5 to 7 to reflect new account layout: owner, mint, payer, ata, system_program, config, rent_sponsor

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Instruction data reshaping: Verify that all downstream code expecting owner and mint in instruction data has been updated to extract from accounts instead
  • SDK API consolidation: Ensure the unified CreateAssociatedTokenAccount struct and reordered fields are correctly used throughout the SDK and don't break existing call sites
  • Account ordering assumptions: Confirm the new account extraction logic (first two accounts = owner, mint) is correctly implemented and documented in all places
  • Discriminator removal: Verify that removing discriminators 106 and 107 doesn't break backward compatibility requirements or affect instruction routing logic

Possibly related PRs

Suggested labels

ai-review

Suggested reviewers

  • sergeytimoshin
  • SwenSchaeferjohann

Poem

Two paths converge, yet one must stay—
ATA2 fades, unified's the way.
Owner and mint from accounts we draw,
Simplified instruction, without a flaw. 🏛️

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 title 'refactor: remove create ata2' directly and concisely summarizes the main change—the removal of the CreateAssociatedTokenAccount2 instruction variant across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 70.00%.

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.

@ananas-block ananas-block force-pushed the jorrit/refactor-remove-create-ata2 branch from 47a7806 to c9a3753 Compare December 5, 2025 18:40
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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f90dbdd and c9a3753.

⛔ Files ignored due to path filters (4)
  • program-tests/compressed-token-test/tests/ctoken/create_ata.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/src/create_ata.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/src/create_ata2.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs is excluded by none and included by none
📒 Files selected for processing (8)
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs (1 hunks)
  • program-libs/ctoken-types/src/instructions/create_associated_token_account2.rs (0 hunks)
  • program-libs/ctoken-types/src/instructions/mod.rs (0 hunks)
  • programs/compressed-token/program/src/create_associated_token_account.rs (3 hunks)
  • programs/compressed-token/program/src/create_associated_token_account2.rs (0 hunks)
  • programs/compressed-token/program/src/lib.rs (0 hunks)
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs (5 hunks)
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs (1 hunks)
💤 Files with no reviewable changes (4)
  • program-libs/ctoken-types/src/instructions/mod.rs
  • programs/compressed-token/program/src/lib.rs
  • program-libs/ctoken-types/src/instructions/create_associated_token_account2.rs
  • programs/compressed-token/program/src/create_associated_token_account2.rs
🧰 Additional context used
📓 Path-based instructions (6)
sdk-libs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in sdk-libs must not depend on light-test-utils; any test requiring light-test-utils must be in sdk-tests

Files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
program-libs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in program-libs must not depend on light-test-utils; any test requiring light-test-utils must be in program-tests

Files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
programs/compressed-token/program/src/**/*.rs

📄 CodeRabbit inference engine (programs/compressed-token/program/CLAUDE.md)

programs/compressed-token/program/src/**/*.rs: Compressed token accounts (ctoken solana accounts) must use the same account layout as SPL tokens with a custom Compressible extension
Compressed mint accounts (cmints) support only one extension: TokenMetadata

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
programs/compressed-token/program/src/create_*_account*.rs

📄 CodeRabbit inference engine (programs/compressed-token/program/CLAUDE.md)

Token account creation instructions (Create CToken Account and Create Associated CToken Account) require ACTIVE config validation only

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
**/programs/**/src/**/*.rs

📄 CodeRabbit inference engine (DOCS.md)

For accounts with associated methods, add a Methods section grouping methods by purpose (Validation, Constructors, PDA Derivation, etc.) with concise parameter names in signatures, one-line action-oriented descriptions, and concrete values where helpful (constants, defaults)

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
programs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in programs must not depend on light-test-utils; any test requiring light-test-utils must be in program-tests

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
🧠 Learnings (67)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/create_*_account*.rs : Token account creation instructions (Create CToken Account and Create Associated CToken Account) require ACTIVE config validation only
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-11-24T17:55:32.059Z
Learning: Implement all 8 core compressed token operations: create_cmint, mint_to_ctoken, create_token_account_invoke, create_token_account_invoke_signed, create_ata_invoke, create_ata_invoke_signed, transfer_interface_invoke, and transfer_interface_invoke_signed
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CLOSE_TOKEN_ACCOUNT.md : Close Token Account documentation must cover closing decompressed token accounts with rent distribution
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/MINT_ACTION.md : MintAction documentation must cover batch instruction for compressed mint management supporting 9 actions: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/PACKED_ACCOUNTS.md:0-0
Timestamp: 2025-11-24T17:59:54.233Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/**/*.rs : Provide descriptive names in ProgramPackedAccounts error messages (e.g., 'token_mint' instead of 'account')
📚 Learning: 2025-11-24T17:59:23.357Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:59:23.357Z
Learning: Applies to program-libs/account-checks/docs/src/**/*.rs : Use 8-byte discriminators for account type identification and implement the Discriminator trait for account identification

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:54.233Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/PACKED_ACCOUNTS.md:0-0
Timestamp: 2025-11-24T17:59:54.233Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/**/*.rs : Provide descriptive names in ProgramPackedAccounts error messages (e.g., 'token_mint' instead of 'account')

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:13.714Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_ITERATOR.md:0-0
Timestamp: 2025-11-24T17:59:13.714Z
Learning: Applies to program-libs/account-checks/docs/**/*.rs : Use descriptive account names when calling AccountIterator methods (e.g., `iter.next_account("token_mint")` instead of `iter.next_account("account_3")`)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/create_*_account*.rs : Token account creation instructions (Create CToken Account and Create Associated CToken Account) require ACTIVE config validation only

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/variant_enum.rs : Account variant enum (`CompressedAccountVariant`) generation and `CompressedAccountData` wrapper struct should be implemented in `variant_enum.rs`

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:36.701Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/DISCRIMINATOR.md:0-0
Timestamp: 2025-11-24T17:59:36.701Z
Learning: Applies to program-libs/account-checks/docs/**/account-checks/**/*.rs : Use check_account_info<T> function for full account validation including discriminator and ownership checks

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/**/packed_accounts.rs : Support dynamic account sets (mint, owner, delegate accounts) by index in account access utilities

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/test_account_info.rs : Create a test-only AccountInfo mock implementation without external dependencies for unit testing AccountInfoTrait implementations

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:36.701Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/DISCRIMINATOR.md:0-0
Timestamp: 2025-11-24T17:59:36.701Z
Learning: Applies to program-libs/account-checks/docs/**/account-checks/**/*.rs : Implement the Discriminator trait for account types, providing 8-byte LIGHT_DISCRIMINATOR constant and LIGHT_DISCRIMINATOR_SLICE reference in Rust account structures

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:14.087Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:14.087Z
Learning: Applies to program-libs/compressible/**/*.rs : Use `calculate_close_lamports` function to determine lamport distribution when closing CToken accounts

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:00:48.449Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/SOLANA_RENT.md:0-0
Timestamp: 2025-11-24T18:00:48.449Z
Learning: Applies to program-libs/compressible/docs/**/*.rs : Implement account compressibility states in the following order: Funded (rent for current + 1 epoch) → Compressible (lacks rent for current + 1 epoch) → Claimable (funded but past epochs unclaimed)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/close_token_account.rs : Close Token Account instruction must return rent exemption to rent recipient if compressible, and return remaining lamports to destination account

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:02:15.670Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:02:15.670Z
Learning: Applies to programs/registry/src/account_compression_cpi/*.rs : Create wrapper instruction module at `src/account_compression_cpi/new_operation.rs` with `NewOperationContext` struct defining required accounts

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/{claim,transfer2}/**/*.rs : Rent authority can only compress accounts when is_compressible() returns true; lamport distribution on close is: rent → rent_sponsor, unutilized → destination

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:30.012Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:30.012Z
Learning: Run account-compression tests using `cargo test-sbf -p account-compression-test` to test core account compression program (Merkle tree management)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:00:13.178Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/CONFIG_ACCOUNT.md:0-0
Timestamp: 2025-11-24T18:00:13.178Z
Learning: Applies to program-libs/compressible/docs/program-libs/compressible/src/config.rs : CompressibleConfig struct must use `#[repr(C)]` for proper memory layout with fixed field ordering: version (u16, 2 bytes), state (u8, 1 byte), bump (u8, 1 byte), update_authority (Pubkey, 32 bytes), withdrawal_authority (Pubkey, 32 bytes), rent_sponsor (Pubkey, 32 bytes), compression_authority (Pubkey, 32 bytes), rent_sponsor_bump (u8, 1 byte), compression_authority_bump (u8, 1 byte), rent_config (RentConfig, 8 bytes), address_space ([Pubkey; 4], 128 bytes), and _place_holder ([u8; 32], 32 bytes) for total of 256 bytes

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:30.012Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:30.012Z
Learning: Run Light system program compression tests using `cargo test-sbf -p system-test -- test_with_compression` and `cargo test-sbf -p system-test --test test_re_init_cpi_account` to test compressed account operations

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:59:23.357Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:59:23.357Z
Learning: Applies to program-libs/account-checks/docs/src/**/packed_accounts.rs : Implement index-based dynamic account access with bounds checking for handling variable account sets (mint, owner, delegate accounts)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/**/packed_accounts.rs : Implement index-based account access with bounds-checked retrieval and descriptive error messages in PackedAccounts

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/mint_action/**/*.rs : MintAction instruction must support 9 action types: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/**/*.rs : Compressed mint accounts (cmints) support only one extension: TokenMetadata

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:56:20.711Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md:0-0
Timestamp: 2025-11-24T17:56:20.711Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_address_tree.rs : `InitAddressTreeAccountsInstructionData` struct in `src/initialize_address_tree.rs` must include: height (u32, default 40), index (u64), root_history_capacity (u32, default 200), input_queue_batch_size (u64, default 15,000), input_queue_zkp_batch_size (u64, default 250), bloom_filter_capacity (u64, default batch_size * 8), bloom_filter_num_iters (u64, default 3 for test/10 for production), program_owner (Option<Pubkey>), forester (Option<Pubkey>), rollover_threshold (Option<u64>, default 95%), network_fee (Option<u64>, default 10,000 lamports), and close_threshold (Option<u64>).

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/MINT_ACTION.md : MintAction documentation must cover batch instruction for compressed mint management supporting 9 actions: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : ACCOUNTS.md must contain complete account layouts and data structures with references to code paths

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/Cargo.toml : Depend on light-zero-copy crate for zero-copy serialization for efficient account data access

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/{solana,pinocchio}.rs : Implement AccountInfoTrait with SDK-specific Pubkey types: `solana_pubkey::Pubkey` for solana-program feature and `[u8; 32]` raw bytes for pinocchio feature

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Validate account ownership by Light account compression program using `check_owner` from `light-account-checks` when deserializing `BatchedQueueAccount` with `output_from_account_info`

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/Cargo.toml : Depend on light-compressed-account crate for compressed account types and utilities

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Compute and store hashed pubkeys by hashing and truncating to 31 bytes for bn254 field compatibility in both queue and tree accounts

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Use zero-copy deserialization for all `BatchedQueueAccount` operations

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:00:13.178Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/CONFIG_ACCOUNT.md:0-0
Timestamp: 2025-11-24T18:00:13.178Z
Learning: Applies to program-libs/compressible/docs/**/*.rs : Validate CompressibleConfig account ownership against Light Registry Program address (`Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX`) before processing

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:02:15.670Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:02:15.670Z
Learning: Applies to programs/registry/src/account_compression_cpi/mod.rs : Export new wrapper modules in `account_compression_cpi/mod.rs` using `pub mod new_operation;` and `pub use new_operation::*;`, then import in `lib.rs`

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.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:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/pack_unpack.rs : Pubkey compression logic and `PackedXxx` struct generation with Pack/Unpack trait implementations should be in `pack_unpack.rs`

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/src/account_info/*.rs : Provide PDA derivation functions (`find_program_address`, `create_program_address`) and permission checks in AccountInfoTrait

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : All account documentation must include: description, discriminator, state layout, serialization example, hashing (for compressed accounts only), derivation (for PDAs only), and associated instructions

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `account_info_init` function to initialize account with discriminator, handling `BorrowAccountDataFailed` (20003) and `AlreadyInitialized` (20006) errors

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `check_account_info_mut` function to validate account is writable, owned by program_id, and discriminator matches type T

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `check_account_info` function to validate account ownership by program_id and verify discriminator matches type T

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `check_account_info_non_mut` function to validate account is NOT writable, owned by program_id, and discriminator matches type T

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:55:32.059Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-11-24T17:55:32.059Z
Learning: Implement all 8 core compressed token operations: create_cmint, mint_to_ctoken, create_token_account_invoke, create_token_account_invoke_signed, create_ata_invoke, create_ata_invoke_signed, transfer_interface_invoke, and transfer_interface_invoke_signed

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:02:15.670Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:02:15.670Z
Learning: Applies to programs/registry/src/account_compression_cpi/*.rs : Implement `process_new_operation()` function in wrapper module to handle PDA signer setup, account mapping, and CPI execution

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:14.087Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:14.087Z
Learning: Applies to program-libs/compressible/**/*.rs : Derive PDA addresses using `derive_pda` and `derive_v1_config_pda` functions for CToken account configuration

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/decompress_context.rs : Decompression trait implementation (`DecompressContext`) with account accessors, PDA/token separation logic, and token processing delegation should be in `decompress_context.rs`

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:32.059Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-11-24T17:55:32.059Z
Learning: Applies to sdk-tests/sdk-ctoken-test/**/*.rs : Use the builder pattern from `light-compressed-token-sdk::ctoken` module for CPI operations instead of manual instruction building

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/instructions.rs : Compress/decompress instruction handlers and context struct generation should be implemented in `instructions.rs`, with compress using PDA-only and decompress supporting full PDA + ctoken

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/**/*.rs : Compressed token accounts (ctoken solana accounts) must use the same account layout as SPL tokens with a custom Compressible extension

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:53.312Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:53.312Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : When deserializing BatchedMerkleTreeAccount in Solana programs, use `BatchedMerkleTreeAccount::state_from_account_info()` for state trees and `BatchedMerkleTreeAccount::address_from_account_info()` for address trees

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:14.087Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:14.087Z
Learning: Applies to program-libs/compressible/**/*.rs : Use Anchor serialization for CompressibleConfig account structures in Rust programs

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:46.693Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ERRORS.md:0-0
Timestamp: 2025-11-24T17:59:46.693Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/error.rs : Implement From<std::cell::BorrowError> and From<std::cell::BorrowMutError> to convert to AccountError::BorrowAccountDataFailed when using solana-program SDK

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : In Solana programs, deserialize output queues using `BatchedQueueAccount::output_from_account_info(account_info)?` from the `light_batched_merkle_tree::queue` module

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/solana.rs : Use `std::cell::Ref` and `std::cell::RefMut` for DataRef and DataRefMut associated types when implementing AccountInfoTrait for solana-program SDK

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:53.312Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:53.312Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : When deserializing BatchedMerkleTreeAccount in client code, use `BatchedMerkleTreeAccount::state_from_bytes()` for state trees and `BatchedMerkleTreeAccount::address_from_bytes()` for address trees

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:56:20.711Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md:0-0
Timestamp: 2025-11-24T17:56:20.711Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_address_tree.rs : Set discriminator to `BatchMta` `[66, 97, 116, 99, 104, 77, 116, 97]` (8 bytes) for BatchedMerkleTreeAccount in `src/initialize_address_tree.rs`.

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/**/discriminator.rs : Implement Discriminator trait with constant discriminator arrays for compile-time verification and 8-byte account type prefixes

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:23.357Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:59:23.357Z
Learning: Applies to program-libs/account-checks/docs/src/**/*.rs : Define constant discriminator arrays for compile-time verification of account types

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Set state Merkle tree account discriminator to b`BatchMta` (8 bytes) and initialize tree metadata with TreeType::StateV2 (4)

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `set_discriminator` function to set 8-byte discriminator on uninitialized account, returning `AlreadyInitialized` (20006) if discriminator is non-zero

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/traits.rs : Core trait implementations (`HasCompressionInfo`, `CompressAs`, `Compressible`) should be defined in `traits.rs`

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/transfer2/**/*.rs : Transfer2 instruction must support Compress, Decompress, and CompressAndClose operations with multi-mint support and sum checks

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:36.701Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/DISCRIMINATOR.md:0-0
Timestamp: 2025-11-24T17:59:36.701Z
Learning: Applies to program-libs/account-checks/docs/**/account-checks/**/*.rs : Call account_info_init<T> or set_discriminator<T> during account initialization to write discriminator to account data

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Use generic `AccountInfoTrait` parameter for all account validation functions to enable compatibility with both Solana and Pinocchio runtimes

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/src/account_info/*.rs : Implement AccountInfoTrait for runtime-agnostic account handling with unified data access interface (`try_borrow_data`, `try_borrow_mut_data`)

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/**/*.rs : Generic functions accepting AccountInfoTrait should use trait bounds in function signatures rather than concrete account types

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/*.rs : AccountInfoTrait implementations must return `AccountError` from all fallible operations: `BorrowAccountDataFailed` (12009) for borrow failures, `InvalidSeeds` (12016) for PDA creation, and `FailedBorrowRentSysvar` (12014) for rent access

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Forester e2e test
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo test -p light-compressed-token", "cargo-test-sbf -p c...
  • 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: Test program-libs-fast
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: Test program-libs-slow
🔇 Additional comments (5)
programs/compressed-token/program/src/create_associated_token_account.rs (1)

42-81: LGTM! Clean extraction of owner and mint from accounts.

The refactored process_create_associated_token_account_with_mode properly:

  1. Validates minimum account count before accessing
  2. Splits accounts to extract owner (index 0) and mint (index 1)
  3. Passes remaining_accounts to the inner function, maintaining the expected account order for downstream processing

The detailed account order documentation (lines 50-56) is helpful for maintainability.

sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs (3)

115-126: LGTM! Account ordering correctly matches program expectations.

The instruction account construction properly orders accounts as:

  1. owner (readonly)
  2. mint (readonly)
  3. payer (signer, mut)
  4. associated_token_account (mut)
  5. system_program (readonly)
    6-7. Optional compressible accounts

This aligns with the program's documented account order (lines 50-56 in create_associated_token_account.rs).


152-175: LGTM!

The invoke method correctly assembles account infos in the same order as the instruction accounts, handling both compressible and non-compressible cases.


203-224: LGTM!

The From implementation correctly converts CreateAssociatedTokenAccountInfos to CreateAssociatedTokenAccount, mapping all fields including the optional compressible configuration.

sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs (1)

70-82: LGTM! Test correctly validates the unified account structure.

The updated test properly validates 7 accounts for compressible ATA creation:

  • owner, mint, payer, ata, system_program (base 5)
  • config, rent_sponsor (compressible extension 2)

The inline comment documenting the account order is a nice touch for maintainability.

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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f90dbdd and c9a3753.

⛔ Files ignored due to path filters (4)
  • program-tests/compressed-token-test/tests/ctoken/create_ata.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/src/create_ata.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/src/create_ata2.rs is excluded by none and included by none
  • sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs is excluded by none and included by none
📒 Files selected for processing (8)
  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs (1 hunks)
  • program-libs/ctoken-types/src/instructions/create_associated_token_account2.rs (0 hunks)
  • program-libs/ctoken-types/src/instructions/mod.rs (0 hunks)
  • programs/compressed-token/program/src/create_associated_token_account.rs (3 hunks)
  • programs/compressed-token/program/src/create_associated_token_account2.rs (0 hunks)
  • programs/compressed-token/program/src/lib.rs (0 hunks)
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs (5 hunks)
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs (1 hunks)
💤 Files with no reviewable changes (4)
  • programs/compressed-token/program/src/lib.rs
  • program-libs/ctoken-types/src/instructions/mod.rs
  • program-libs/ctoken-types/src/instructions/create_associated_token_account2.rs
  • programs/compressed-token/program/src/create_associated_token_account2.rs
🧰 Additional context used
📓 Path-based instructions (6)
program-libs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in program-libs must not depend on light-test-utils; any test requiring light-test-utils must be in program-tests

Files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
sdk-libs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in sdk-libs must not depend on light-test-utils; any test requiring light-test-utils must be in sdk-tests

Files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
programs/compressed-token/program/src/**/*.rs

📄 CodeRabbit inference engine (programs/compressed-token/program/CLAUDE.md)

programs/compressed-token/program/src/**/*.rs: Compressed token accounts (ctoken solana accounts) must use the same account layout as SPL tokens with a custom Compressible extension
Compressed mint accounts (cmints) support only one extension: TokenMetadata

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
programs/compressed-token/program/src/create_*_account*.rs

📄 CodeRabbit inference engine (programs/compressed-token/program/CLAUDE.md)

Token account creation instructions (Create CToken Account and Create Associated CToken Account) require ACTIVE config validation only

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
**/programs/**/src/**/*.rs

📄 CodeRabbit inference engine (DOCS.md)

For accounts with associated methods, add a Methods section grouping methods by purpose (Validation, Constructors, PDA Derivation, etc.) with concise parameter names in signatures, one-line action-oriented descriptions, and concrete values where helpful (constants, defaults)

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
programs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in programs must not depend on light-test-utils; any test requiring light-test-utils must be in program-tests

Files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
🧠 Learnings (67)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-11-24T17:55:32.059Z
Learning: Implement all 8 core compressed token operations: create_cmint, mint_to_ctoken, create_token_account_invoke, create_token_account_invoke_signed, create_ata_invoke, create_ata_invoke_signed, transfer_interface_invoke, and transfer_interface_invoke_signed
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/create_*_account*.rs : Token account creation instructions (Create CToken Account and Create Associated CToken Account) require ACTIVE config validation only
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/MINT_ACTION.md : MintAction documentation must cover batch instruction for compressed mint management supporting 9 actions: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/mint_action/**/*.rs : MintAction instruction must support 9 action types: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey
📚 Learning: 2025-11-24T18:02:15.670Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:02:15.670Z
Learning: Applies to programs/registry/src/account_compression_cpi/*.rs : Create wrapper instruction module at `src/account_compression_cpi/new_operation.rs` with `NewOperationContext` struct defining required accounts

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/mint_action/**/*.rs : MintAction instruction must support 9 action types: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/close_token_account.rs : Close Token Account instruction must return rent exemption to rent recipient if compressible, and return remaining lamports to destination account

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/**/*.rs : Compressed mint accounts (cmints) support only one extension: TokenMetadata

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/create_*_account*.rs : Token account creation instructions (Create CToken Account and Create Associated CToken Account) require ACTIVE config validation only

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:54.233Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/PACKED_ACCOUNTS.md:0-0
Timestamp: 2025-11-24T17:59:54.233Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/**/*.rs : Provide descriptive names in ProgramPackedAccounts error messages (e.g., 'token_mint' instead of 'account')

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/**/*.rs : Compressed token accounts (ctoken solana accounts) must use the same account layout as SPL tokens with a custom Compressible extension

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/transfer2/**/*.rs : Transfer2 instruction must support Compress, Decompress, and CompressAndClose operations with multi-mint support and sum checks

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/MINT_ACTION.md : MintAction documentation must cover batch instruction for compressed mint management supporting 9 actions: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/Cargo.toml : Depend on light-zero-copy crate for zero-copy serialization for efficient account data access

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/{solana,pinocchio}.rs : Implement AccountInfoTrait with SDK-specific Pubkey types: `solana_pubkey::Pubkey` for solana-program feature and `[u8; 32]` raw bytes for pinocchio feature

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Validate account ownership by Light account compression program using `check_owner` from `light-account-checks` when deserializing `BatchedQueueAccount` with `output_from_account_info`

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/Cargo.toml : Depend on light-compressed-account crate for compressed account types and utilities

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Compute and store hashed pubkeys by hashing and truncating to 31 bytes for bn254 field compatibility in both queue and tree accounts

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Use zero-copy deserialization for all `BatchedQueueAccount` operations

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:00:13.178Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/CONFIG_ACCOUNT.md:0-0
Timestamp: 2025-11-24T18:00:13.178Z
Learning: Applies to program-libs/compressible/docs/**/*.rs : Validate CompressibleConfig account ownership against Light Registry Program address (`Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX`) before processing

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:02:15.670Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:02:15.670Z
Learning: Applies to programs/registry/src/account_compression_cpi/mod.rs : Export new wrapper modules in `account_compression_cpi/mod.rs` using `pub mod new_operation;` and `pub use new_operation::*;`, then import in `lib.rs`

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.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:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/pack_unpack.rs : Pubkey compression logic and `PackedXxx` struct generation with Pack/Unpack trait implementations should be in `pack_unpack.rs`

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:56:20.711Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md:0-0
Timestamp: 2025-11-24T17:56:20.711Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_address_tree.rs : `InitAddressTreeAccountsInstructionData` struct in `src/initialize_address_tree.rs` must include: height (u32, default 40), index (u64), root_history_capacity (u32, default 200), input_queue_batch_size (u64, default 15,000), input_queue_zkp_batch_size (u64, default 250), bloom_filter_capacity (u64, default batch_size * 8), bloom_filter_num_iters (u64, default 3 for test/10 for production), program_owner (Option<Pubkey>), forester (Option<Pubkey>), rollover_threshold (Option<u64>, default 95%), network_fee (Option<u64>, default 10,000 lamports), and close_threshold (Option<u64>).

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:00:13.178Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/CONFIG_ACCOUNT.md:0-0
Timestamp: 2025-11-24T18:00:13.178Z
Learning: Applies to program-libs/compressible/docs/program-libs/compressible/src/config.rs : CompressibleConfig struct must use `#[repr(C)]` for proper memory layout with fixed field ordering: version (u16, 2 bytes), state (u8, 1 byte), bump (u8, 1 byte), update_authority (Pubkey, 32 bytes), withdrawal_authority (Pubkey, 32 bytes), rent_sponsor (Pubkey, 32 bytes), compression_authority (Pubkey, 32 bytes), rent_sponsor_bump (u8, 1 byte), compression_authority_bump (u8, 1 byte), rent_config (RentConfig, 8 bytes), address_space ([Pubkey; 4], 128 bytes), and _place_holder ([u8; 32], 32 bytes) for total of 256 bytes

Applied to files:

  • program-libs/ctoken-types/src/instructions/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:59:13.714Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_ITERATOR.md:0-0
Timestamp: 2025-11-24T17:59:13.714Z
Learning: Applies to program-libs/account-checks/docs/**/*.rs : Use descriptive account names when calling AccountIterator methods (e.g., `iter.next_account("token_mint")` instead of `iter.next_account("account_3")`)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:59:23.357Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:59:23.357Z
Learning: Applies to program-libs/account-checks/docs/src/**/*.rs : Use 8-byte discriminators for account type identification and implement the Discriminator trait for account identification

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/**/packed_accounts.rs : Support dynamic account sets (mint, owner, delegate accounts) by index in account access utilities

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/variant_enum.rs : Account variant enum (`CompressedAccountVariant`) generation and `CompressedAccountData` wrapper struct should be implemented in `variant_enum.rs`

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:36.701Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/DISCRIMINATOR.md:0-0
Timestamp: 2025-11-24T17:59:36.701Z
Learning: Applies to program-libs/account-checks/docs/**/account-checks/**/*.rs : Use check_account_info<T> function for full account validation including discriminator and ownership checks

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : ACCOUNTS.md must contain complete account layouts and data structures with references to code paths

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:14.087Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:14.087Z
Learning: Applies to program-libs/compressible/**/*.rs : Use `calculate_close_lamports` function to determine lamport distribution when closing CToken accounts

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:00:48.449Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/SOLANA_RENT.md:0-0
Timestamp: 2025-11-24T18:00:48.449Z
Learning: Applies to program-libs/compressible/docs/**/*.rs : Implement account compressibility states in the following order: Funded (rent for current + 1 epoch) → Compressible (lacks rent for current + 1 epoch) → Claimable (funded but past epochs unclaimed)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/src/{claim,transfer2}/**/*.rs : Rent authority can only compress accounts when is_compressible() returns true; lamport distribution on close is: rent → rent_sponsor, unutilized → destination

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:30.012Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:30.012Z
Learning: Run account-compression tests using `cargo test-sbf -p account-compression-test` to test core account compression program (Merkle tree management)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:30.012Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:30.012Z
Learning: Run Light system program compression tests using `cargo test-sbf -p system-test -- test_with_compression` and `cargo test-sbf -p system-test --test test_re_init_cpi_account` to test compressed account operations

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:59:23.357Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:59:23.357Z
Learning: Applies to program-libs/account-checks/docs/src/**/packed_accounts.rs : Implement index-based dynamic account access with bounds checking for handling variable account sets (mint, owner, delegate accounts)

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/**/packed_accounts.rs : Implement index-based account access with bounds-checked retrieval and descriptive error messages in PackedAccounts

Applied to files:

  • sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:42.343Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:42.343Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : All account documentation must include: description, discriminator, state layout, serialization example, hashing (for compressed accounts only), derivation (for PDAs only), and associated instructions

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/src/account_info/*.rs : Provide PDA derivation functions (`find_program_address`, `create_program_address`) and permission checks in AccountInfoTrait

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `account_info_init` function to initialize account with discriminator, handling `BorrowAccountDataFailed` (20003) and `AlreadyInitialized` (20006) errors

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `check_account_info_mut` function to validate account is writable, owned by program_id, and discriminator matches type T

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `check_account_info` function to validate account ownership by program_id and verify discriminator matches type T

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `check_account_info_non_mut` function to validate account is NOT writable, owned by program_id, and discriminator matches type T

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T17:55:32.059Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-11-24T17:55:32.059Z
Learning: Implement all 8 core compressed token operations: create_cmint, mint_to_ctoken, create_token_account_invoke, create_token_account_invoke_signed, create_ata_invoke, create_ata_invoke_signed, transfer_interface_invoke, and transfer_interface_invoke_signed

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:02:15.670Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:02:15.670Z
Learning: Applies to programs/registry/src/account_compression_cpi/*.rs : Implement `process_new_operation()` function in wrapper module to handle PDA signer setup, account mapping, and CPI execution

Applied to files:

  • programs/compressed-token/program/src/create_associated_token_account.rs
📚 Learning: 2025-11-24T18:01:14.087Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:14.087Z
Learning: Applies to program-libs/compressible/**/*.rs : Derive PDA addresses using `derive_pda` and `derive_v1_config_pda` functions for CToken account configuration

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/decompress_context.rs : Decompression trait implementation (`DecompressContext`) with account accessors, PDA/token separation logic, and token processing delegation should be in `decompress_context.rs`

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:32.059Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-11-24T17:55:32.059Z
Learning: Applies to sdk-tests/sdk-ctoken-test/**/*.rs : Use the builder pattern from `light-compressed-token-sdk::ctoken` module for CPI operations instead of manual instruction building

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/instructions.rs : Compress/decompress instruction handlers and context struct generation should be implemented in `instructions.rs`, with compress using PDA-only and decompress supporting full PDA + ctoken

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:53.312Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:53.312Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : When deserializing BatchedMerkleTreeAccount in Solana programs, use `BatchedMerkleTreeAccount::state_from_account_info()` for state trees and `BatchedMerkleTreeAccount::address_from_account_info()` for address trees

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:14.087Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:14.087Z
Learning: Applies to program-libs/compressible/**/*.rs : Use Anchor serialization for CompressibleConfig account structures in Rust programs

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:46.693Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ERRORS.md:0-0
Timestamp: 2025-11-24T17:59:46.693Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/error.rs : Implement From<std::cell::BorrowError> and From<std::cell::BorrowMutError> to convert to AccountError::BorrowAccountDataFailed when using solana-program SDK

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : In Solana programs, deserialize output queues using `BatchedQueueAccount::output_from_account_info(account_info)?` from the `light_batched_merkle_tree::queue` module

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/solana.rs : Use `std::cell::Ref` and `std::cell::RefMut` for DataRef and DataRefMut associated types when implementing AccountInfoTrait for solana-program SDK

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:36.701Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/DISCRIMINATOR.md:0-0
Timestamp: 2025-11-24T17:59:36.701Z
Learning: Applies to program-libs/account-checks/docs/**/account-checks/**/*.rs : Implement the Discriminator trait for account types, providing 8-byte LIGHT_DISCRIMINATOR constant and LIGHT_DISCRIMINATOR_SLICE reference in Rust account structures

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:57:53.312Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:53.312Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : When deserializing BatchedMerkleTreeAccount in client code, use `BatchedMerkleTreeAccount::state_from_bytes()` for state trees and `BatchedMerkleTreeAccount::address_from_bytes()` for address trees

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:56:20.711Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md:0-0
Timestamp: 2025-11-24T17:56:20.711Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_address_tree.rs : Set discriminator to `BatchMta` `[66, 97, 116, 99, 104, 77, 116, 97]` (8 bytes) for BatchedMerkleTreeAccount in `src/initialize_address_tree.rs`.

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/**/discriminator.rs : Implement Discriminator trait with constant discriminator arrays for compile-time verification and 8-byte account type prefixes

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:23.357Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:59:23.357Z
Learning: Applies to program-libs/account-checks/docs/src/**/*.rs : Define constant discriminator arrays for compile-time verification of account types

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Set state Merkle tree account discriminator to b`BatchMta` (8 bytes) and initialize tree metadata with TreeType::StateV2 (4)

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Implement `set_discriminator` function to set 8-byte discriminator on uninitialized account, returning `AlreadyInitialized` (20006) if discriminator is non-zero

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/traits.rs : Core trait implementations (`HasCompressionInfo`, `CompressAs`, `Compressible`) should be defined in `traits.rs`

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:36.701Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/DISCRIMINATOR.md:0-0
Timestamp: 2025-11-24T17:59:36.701Z
Learning: Applies to program-libs/account-checks/docs/**/account-checks/**/*.rs : Call account_info_init<T> or set_discriminator<T> during account initialization to write discriminator to account data

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/test_account_info.rs : Create a test-only AccountInfo mock implementation without external dependencies for unit testing AccountInfoTrait implementations

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:58:50.237Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_CHECKS.md:0-0
Timestamp: 2025-11-24T17:58:50.237Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/checks.rs : Use generic `AccountInfoTrait` parameter for all account validation functions to enable compatibility with both Solana and Pinocchio runtimes

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T18:01:03.786Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:03.786Z
Learning: Applies to program-libs/account-checks/src/account_info/*.rs : Implement AccountInfoTrait for runtime-agnostic account handling with unified data access interface (`try_borrow_data`, `try_borrow_mut_data`)

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/**/*.rs : Generic functions accepting AccountInfoTrait should use trait bounds in function signatures rather than concrete account types

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
📚 Learning: 2025-11-24T17:59:03.485Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_INFO_TRAIT.md:0-0
Timestamp: 2025-11-24T17:59:03.485Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/account_info/*.rs : AccountInfoTrait implementations must return `AccountError` from all fallible operations: `BorrowAccountDataFailed` (12009) for borrow failures, `InvalidSeeds` (12016) for PDA creation, and `FailedBorrowRentSysvar` (12014) for rent access

Applied to files:

  • sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs
🧬 Code graph analysis (3)
sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs (1)
sdk-libs/program-test/src/indexer/test_indexer.rs (1)
  • accounts (2000-2035)
programs/compressed-token/program/src/create_associated_token_account.rs (2)
sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs (1)
  • from (204-224)
programs/compressed-token/program/src/lib.rs (1)
  • from (79-92)
sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs (1)
sdk-libs/compressed-token-sdk/src/ctoken/create.rs (4)
  • with_compressible (34-37)
  • instruction (39-90)
  • instruction (118-120)
  • from (160-178)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test batched-merkle-tree-simulate
🔇 Additional comments (8)
sdk-libs/compressed-token-sdk/tests/create_associated_token_account.rs (1)

80-81: LGTM!

The comment clearly documents the account order and the assertion correctly validates the expected 7 accounts for the unified compressible ATA creation path.

programs/compressed-token/program/src/create_associated_token_account.rs (3)

22-30: LGTM!

The documentation clearly indicates that owner and mint are now passed as accounts. The inline(always) hint is appropriate for this thin wrapper.


42-81: Clean refactoring with good documentation.

The account order documentation (lines 50-56) is clear and matches the implementation. The validation at lines 62-64 prevents panics from split_at. The delegation pattern to the inner function is well-structured.


192-192: ACTIVE config validation is correctly performed.

The next_config_account function at programs/compressed-token/program/src/create_token_account.rs:128 calls config.validate_active(), which enforces the requirement that token account creation instructions only proceed with ACTIVE config state. The implementation is correct.

sdk-libs/compressed-token-sdk/src/ctoken/create_ata.rs (4)

28-74: LGTM - Clean consolidated structure.

The unified CreateAssociatedTokenAccount struct consolidates the previous V1/V2 paths nicely. The default-compressible behavior (lines 48, 66) is appropriate for a compressed token program. The parameter rename to compressible_params (line 71) improves clarity.


81-133: LGTM!

The instruction builder correctly:

  1. Constructs instruction data with only bump and compressible_config (owner/mint removed per refactor).
  2. Selects the appropriate discriminator (100 for regular, 102 for idempotent).
  3. Orders accounts as: owner, mint, payer, ata, system_program, [optional: config, rent_sponsor].

This aligns with the program's expected account order documented in create_associated_token_account.rs.


136-201: LGTM!

The CreateAssociatedTokenAccountInfos struct and its invoke/invoke_signed methods correctly handle both compressible (7 accounts) and non-compressible (5 accounts) cases. The account ordering in the invoke arrays matches the instruction builder.


203-225: LGTM!

The From implementation correctly converts account infos to the builder struct. Setting compress_to_account_pubkey: None (line 219) is correct for ATAs, matching the program's validation that rejects ATAs with custom compression targets.

@ananas-block ananas-block force-pushed the jorrit/refactor-remove-create-ata2 branch from 7d666d8 to 822f861 Compare December 5, 2025 22:19
@ananas-block ananas-block merged commit 3e5d8e0 into main Dec 5, 2025
31 checks passed
@ananas-block ananas-block deleted the jorrit/refactor-remove-create-ata2 branch December 5, 2025 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants