Skip to content

refactor: store mint signer in compressed mint struct#2169

Merged
SwenSchaeferjohann merged 3 commits intomainfrom
jorrit/refactor-include-mint-signer-mint
Jan 16, 2026
Merged

refactor: store mint signer in compressed mint struct#2169
SwenSchaeferjohann merged 3 commits intomainfrom
jorrit/refactor-include-mint-signer-mint

Conversation

@ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Jan 15, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Added validations for mint signer, derived bump and PDA with a new error for signer mismatches.
  • Refactor

    • Mint metadata reshaped: compressed address replaced by mint_signer + bump; reserved payload shortened and compressed address now derived via accessor.
    • Decompress flows no longer require passing a mint signer or bump; related public fields/APIs removed.
    • SDK/API surfaces updated to expose bump and simplify CPI/write flows.
  • Documentation

    • Clarified that mint_signer is required only for create_mint.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

Replaces stored compressed_address in compressed-mint metadata with mint_signer + bump, reduces reserved padding (17→16), removes cmint_bump from DecompressMintAction, and shifts PDA derivation/validation to use metadata-stored signer/bump across token-interface, program, SDK, and tests.

Changes

Cohort / File(s) Summary
Token Interface — Metadata & Instruction Data
program-libs/token-interface/src/instructions/mint_action/decompress_mint.rs, program-libs/token-interface/src/instructions/mint_action/instruction_data.rs, program-libs/token-interface/src/state/mint/compressed_mint.rs, program-libs/token-interface/src/state/mint/zero_copy.rs
Removed pub cmint_bump: u8 from DecompressMintAction. Replaced compressed_address: [u8;32] with mint_signer and bump. Reduced reserved from 17→16 bytes. Added compressed_address() derivation methods using derive_address/CMINT_ADDRESS_TREE.
Token Interface — Tests
program-libs/token-interface/tests/*
Updated fixtures and zero-copy tests to initialize/compare mint_signer and bump instead of compressed_address; adjusted reserved sizing.
Compressed Token Program — Errors & Accounts
programs/compressed-token/anchor/src/lib.rs, programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs
Added MintActionInvalidMintSigner error. Narrowed mint_signer requirement to only when create_mint is present and avoid consuming a signer when not required.
Compressed Token Program — Create/Decompress Flows
programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs, programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs, programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs
Create-mint: derive mint PDA+bump and validate mint_signer, bump, and derived PDA vs stored mint. Decompress-mint: removed external mint_signer parameter; derive CMint PDA seeds from compressed_mint.metadata.mint_signer and compressed_mint.metadata.bump. Removed mint_signer extraction and related error path in caller.
Compressed Token Program — I/O & Tests
programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs, .../mint_output.rs, programs/compressed-token/program/tests/*
Switched compressed address access from public field to method compressed_address(). Tests updated to use mint_signer + bump and new reserved size.
Token Client & SDK — Action Types & Builders
sdk-libs/token-client/src/actions/mint_action.rs, sdk-libs/token-client/src/instructions/mint_action.rs, sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs, sdk-libs/token-sdk/src/token/create_mint.rs, sdk-libs/token-sdk/src/token/decompress_mint.rs, sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs
Removed cmint_bump from MintActionType::DecompressMint. CPI/create flows now derive (mint_pda, bump) from mint_signer and populate mint_signer + bump in metadata. Removed with_mint_signer_no_sign helper and several CPI-write helpers; added bump to CreateMintParams. DecompressMint structs/CPI types no longer carry mint seed/pubkey.
Docs
programs/compressed-token/program/docs/compressed_token/MINT_ACTION.md
Clarified mint_signer is required only when create_mint is present (no longer required for DecompressMint).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant SDK
  participant Program
  participant CompressedMintState
  participant CMintPDA as CMint PDA
  rect rgba(50,150,250,0.5)
    Client->>SDK: build create_compressed_mint(inputs with mint_signer)
    SDK->>Program: create_compressed_mint instruction (metadata: mint_signer, bump derived)
    Program->>Program: derive mint_pda, validate bump & derived PDA == metadata.mint
    Program->>CompressedMintState: store metadata (mint_signer, bump, reserved)
  end
Loading
sequenceDiagram
  autonumber
  participant Client
  participant SDK
  participant Program
  participant CompressedMintState
  participant CMintPDA as CMint PDA
  rect rgba(50,200,100,0.5)
    Client->>SDK: build DecompressMint action (no cmint_bump)
    SDK->>Program: DecompressMint instruction referencing compressed mint
    Program->>CompressedMintState: read metadata (mint_signer, bump)
    Program->>Program: derive cmint PDA from mint_signer + bump (derive_address)
    Program->>CMintPDA: create/verify CMint PDA using derived seeds
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • sergeytimoshin

Poem

🌱 A mint no longer keeps its address near,
It carries signer bytes and one small bump to steer.
Derived from trees and program light,
PDAs now match by stored insight. ✨

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately captures the main refactoring: moving mint_signer storage from being passed as a parameter into the compressed mint struct itself.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 70.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jorrit/refactor-include-mint-signer-mint

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

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

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

⚠️ Outside diff range comments (7)
sdk-libs/token-sdk/src/token/decompress_mint.rs (1)

172-188: Clarify naming: mint_signer vs mint_seed.

The comment at line 174 refers to "mint_signer" but build_account_infos() passes self.mint_seed at that position. The struct field is named mint_seed (line 135) while the comment uses mint_signer.

From the broader PR context, mint_signer is now stored in the compressed mint metadata. If mint_seed and mint_signer refer to the same pubkey (the seed used to derive the CMint PDA), consider aligning the terminology for clarity.

Either:

  1. Update the comment to say "mint_seed" to match the struct field, or
  2. Rename the struct field to mint_signer if that's the canonical term post-refactoring
sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs (2)

106-119: Unused struct field mint_address should be removed.

The mint_address field in CreateCompressedMintInputsCpiWrite is never used in create_compressed_mint_cpi_write. The function derives the mint address internally at line 132 using find_mint_address(&input.mint_signer).

This unused field adds unnecessary serialization overhead and confuses API consumers.

🔧 Proposed fix
 #[derive(Debug, Clone, AnchorDeserialize, AnchorSerialize)]
 pub struct CreateCompressedMintInputsCpiWrite {
     pub decimals: u8,
     pub mint_authority: Pubkey,
     pub freeze_authority: Option<Pubkey>,
     pub address_merkle_tree_root_index: u16,
     pub mint_signer: Pubkey,
     pub payer: Pubkey,
-    pub mint_address: [u8; 32],
     pub cpi_context: CpiContext,
     pub cpi_context_pubkey: Pubkey,
     pub extensions: Option<Vec<ExtensionInstructionData>>,
     pub version: u8,
 }

203-208: Duplicate function - consolidate with existing find_mint_address in create_mint.rs.

This function is identical to the one at sdk-libs/token-sdk/src/token/create_mint.rs (lines 537-542). Having two copies violates DRY and risks divergence if one is updated without the other.

Consider re-exporting from a single canonical location or moving to a shared utilities module.

♻️ Suggested approach

Option 1: Import from the existing location:

-pub fn find_mint_address(mint_seed: &Pubkey) -> (Pubkey, u8) {
-    Pubkey::find_program_address(
-        &[COMPRESSED_MINT_SEED, mint_seed.as_ref()],
-        &Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID),
-    )
-}
+pub use crate::token::create_mint::find_mint_address;

Option 2: Move to a shared module (e.g., crate::utils::address) and have both files import from there.

#!/bin/bash
# Check for other duplicates of find_mint_address across the codebase
rg -n "fn find_mint_address" --type=rust
sdk-libs/token-sdk/src/token/create_mint.rs (3)

26-36: Unused fields remain in CreateMintParams after refactoring.

After your changes, compression_address (line 32) and mint (line 33) are no longer used in CreateMint::instruction() — the method now derives these values internally from mint_seed_pubkey. These fields are now dead code in the public API, which will confuse SDK users.

Consider removing these unused fields to keep the API clean:

♻️ Proposed cleanup
 pub struct CreateMintParams {
     pub decimals: u8,
     pub address_merkle_tree_root_index: u16,
     pub mint_authority: Pubkey,
     pub proof: CompressedProof,
-    pub compression_address: [u8; 32],
-    pub mint: Pubkey,
     pub freeze_authority: Option<Pubkey>,
     pub extensions: Option<Vec<ExtensionInstructionData>>,
 }

38-75: Documentation example is now misleading.

The doc example still shows users deriving and setting compression_address (line 54, 62) and mint (line 55, 63) in CreateMintParams. After your refactoring, these fields are unused — the instruction derives them internally. This will lead developers astray.

Update the example to match the new behavior once unused fields are removed from the struct.


175-208: Same dead-field issue in CreateMintCpiWriteParams.

compression_address (line 181) and mint (line 182) are unused after the refactoring — CreateCompressedMintCpiWrite::instruction() derives these from mint_signer at line 259. The new() constructor still accepts these parameters, forcing callers to compute values that are immediately discarded.

♻️ Proposed cleanup
 pub struct CreateMintCpiWriteParams {
     pub decimals: u8,
     pub mint_authority: Pubkey,
     pub freeze_authority: Option<Pubkey>,
     pub address_merkle_tree_root_index: u16,
-    pub compression_address: [u8; 32],
-    pub mint: Pubkey,
     pub cpi_context: CpiContext,
     pub extensions: Option<Vec<ExtensionInstructionData>>,
     pub version: u8,
 }
 
 impl CreateMintCpiWriteParams {
     pub fn new(
         decimals: u8,
         address_merkle_tree_root_index: u16,
         mint_authority: Pubkey,
-        compression_address: [u8; 32],
-        mint: Pubkey,
         cpi_context: CpiContext,
     ) -> Self {
         Self {
             decimals,
             version: 3,
             address_merkle_tree_root_index,
             mint_authority,
-            compression_address,
-            mint,
             cpi_context,
             freeze_authority: None,
             extensions: None,
         }
     }
programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs (1)

50-54: Minor: Comment numbering inconsistency.

The comment says "3. Validate derived PDA" but the first validation comment at line 40 says "1. Validate mint_signer" - there's no "2." comment for the bump validation. Consider adding consistent numbering for maintainability.

🔧 Suggested fix for comment consistency
     // 1. Validate mint_signer matches account
     if mint_signer.as_slice() != mint.metadata.mint_signer.array_ref() {
         msg!("Mint signer mismatch");
         return Err(ErrorCode::MintActionInvalidMintSigner.into());
     }
+    // 2. Validate bump matches derived PDA bump
     if mint_pda_bump != mint.metadata.bump {
         msg!("Mint bump mismatch");
         return Err(ErrorCode::MintActionInvalidMintBump.into());
     }

     // 3. Validate derived PDA matches stored mint
🤖 Fix all issues with AI agents
In `@program-libs/token-interface/src/state/mint/compressed_mint.rs`:
- Around line 78-93: The compressed_address() doc should clarify the two-step
derivation chain: note that mint_signer and bump are used to derive the mint PDA
(via COMPRESSED_MINT_SEED) and that compressed_address() derives the Light
Protocol compressed address from that mint PDA (using derive_address with
CMINT_ADDRESS_TREE and LIGHT_TOKEN_PROGRAM_ID); update the doc comment on the
compressed_address() method to state this relationship and mention the mint
field is the PDA derived from (mint_signer, bump).

In
`@sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs`:
- Around line 42-48: The parameter `_mint_address` on create_compressed_mint_cpi
is unused (mint is derived via find_mint_address(&input.mint_signer)); remove
the `_mint_address` parameter from the function signature and all call sites, or
if you must preserve API compatibility, mark the parameter/function as
deprecated with a clear note and add documentation explaining that mint address
is now derived from `input.mint_signer`, or alternatively introduce a new
function (e.g., create_compressed_mint_cpi_v2) without the parameter and
deprecate the old one; update any docs and tests referencing
create_compressed_mint_cpi accordingly.

In `@sdk-libs/token-sdk/src/token/decompress_mint.rs`:
- Line 64: The call to find_mint_address(&self.mint_seed_pubkey) returns a bump
that is never used (_cmint_bump) causing unnecessary work; replace this with a
variant that avoids computing the bump (e.g., use Pubkey::find_program_address
with the same seeds to obtain just the PDA or use Pubkey::create_program_address
if you can supply the known bump), update the code that references cmint_pda
accordingly, and remove the unused _cmint_bump local and any dead imports so the
decompression path no longer computes an unused bump in find_mint_address.

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

Caution

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

⚠️ Outside diff range comments (6)
sdk-libs/token-sdk/src/token/create_mint.rs (1)

48-61: Documentation example is missing the new bump field.

The code example in the docstring shows CreateMintParams without the newly added bump field. This will cause compilation errors for anyone following the example.

📝 Suggested documentation update
 /// let params = CreateMintParams {
 ///     decimals: 9,
 ///     address_merkle_tree_root_index, // from rpc.get_validity_proof
 ///     mint_authority,
 ///     proof, // from rpc.get_validity_proof
 ///     compression_address,
 ///     mint,
+///     bump, // from find_mint_address
 ///     freeze_authority: None,
 ///     extensions: None,
 /// };
sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs (2)

105-118: Unused mint_address field in CreateCompressedMintInputsCpiWrite.

Line 113 still declares pub mint_address: [u8; 32] but this value is never used in create_compressed_mint_cpi_write — the function derives mint_pda from input.mint_signer at line 131 instead. This is dead code that will confuse future maintainers.

♻️ Suggested fix
 pub struct CreateCompressedMintInputsCpiWrite {
     pub decimals: u8,
     pub mint_authority: Pubkey,
     pub freeze_authority: Option<Pubkey>,
     pub address_merkle_tree_root_index: u16,
     pub mint_signer: Pubkey,
     pub payer: Pubkey,
-    pub mint_address: [u8; 32],
     pub cpi_context: CpiContext,
     pub cpi_context_pubkey: Pubkey,
     pub extensions: Option<Vec<ExtensionInstructionData>>,
     pub version: u8,
 }

200-205: Extract find_mint_address to shared module to eliminate duplication.

This function is identically implemented in both sdk-libs/token-sdk/src/token/create_mint.rs (line 338) and sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs (line 200), creating unnecessary maintenance burden. Both modules actively use the function—consider consolidating into a shared location like the existing utils.rs module and re-exporting from each module as needed.

sdk-libs/token-sdk/src/token/decompress_mint.rs (1)

170-186: Account ordering comment lists 15 accounts but implementation has 14.

The comment at lines 170-185 lists mint_signer (no sign for decompress) as account #2, but build_account_infos() at lines 196-213 doesn't include a mint_signer account — it starts directly with authority. The comment is now stale and misleading.

📝 Suggested comment update
         // Account order must match to_account_metas() from MintActionMetaConfig:
         // 1. light_system_program
-        // 2. mint_signer (no sign for decompress)
-        // 3. authority (signer)
-        // 4. compressible_config
-        // 5. cmint
-        // 6. rent_sponsor
-        // 7. fee_payer (signer)
-        // 8. cpi_authority_pda
-        // 9. registered_program_pda
-        // 10. account_compression_authority
-        // 11. account_compression_program
-        // 12. system_program
-        // 13. output_queue
-        // 14. tree_pubkey (state_tree)
-        // 15. input_queue
+        // 2. authority (signer)
+        // 3. compressible_config
+        // 4. cmint
+        // 5. rent_sponsor
+        // 6. fee_payer (signer)
+        // 7. cpi_authority_pda
+        // 8. registered_program_pda
+        // 9. account_compression_authority
+        // 10. account_compression_program
+        // 11. system_program
+        // 12. output_queue
+        // 13. tree_pubkey (state_tree)
+        // 14. input_queue
programs/compressed-token/program/docs/compressed_token/MINT_ACTION.md (1)

60-61: Consider documenting DecompressMintAction fields for completeness.

Line 60 references DecompressMint(DecompressMintAction) but doesn't describe the action's fields. Since the cmint_bump field was removed as part of this refactor, it would help future readers to document the current fields:

- `DecompressMint(DecompressMintAction)` - Decompress compressed mint to CMint Solana account (decompress_mint.rs)
  - `rent_payment: u8` - Rent payment in epochs (must be >= 2)
  - `write_top_up: u32` - Lamports for future write operations

This matches the pattern used for other actions and helps verify the docs match the implementation.

programs/compressed-token/program/tests/mint.rs (1)

67-71: Address derivation uses wrong seed—this is causing the pipeline failure.

The compressed_account_address is derived using mint_pda.to_bytes(), but with the new design where mint_signer is stored in the metadata, the address should be derived using mint_signer as the seed. The test generates a random mint_signer at line 116 that's different from mint_pda, so the assertion at line 304 fails.

🐛 Proposed fix: Derive address from mint_signer

Move the address derivation after mint_signer is generated, and use it as the seed:

-        // Derive compressed account address
-        let compressed_account_address = derive_address(
-            &mint_pda.to_bytes(),
-            &address_merkle_tree.to_bytes(),
-            &program_id.to_bytes(),
-        );
-
         // Step 1: Create random extension data (simplified for current API)

Then after line 117 where mint_signer is defined:

         let mint_signer = Pubkey::new_from_array(rng.gen::<[u8; 32]>());
         let bump: u8 = rng.gen();
+
+        // Derive compressed account address from mint_signer (the new seed)
+        let compressed_account_address = derive_address(
+            &mint_signer.to_bytes(),
+            &address_merkle_tree.to_bytes(),
+            &program_id.to_bytes(),
+        );
+
         let mint_instruction_data = CompressedMintInstructionData {
🤖 Fix all issues with AI agents
In `@program-libs/token-interface/src/state/mint/compressed_mint.rs`:
- Around line 23-24: Update the misleading comment next to the `pub reserved:
[u8; 16]` declaration to state that the 16-byte reserved field positions
`account_type` at offset 165 for T22 compatibility and clarify that the `bump:
u8` in `CompressedMintMetadata` is not new (it has been part of
`CompressedMintMetadata` since its definition). Modify the description of
`CompressedMintMetadata` (referencing the fields `version`,
`cmint_decompressed`, `mint`, `mint_signer`, `bump`) to reflect the correct
67-byte metadata size, and update the outdated arithmetic comment in `top_up.rs`
to read `"82 (BaseMint) + 67 (metadata) + 16 (reserved) + 1 (account_type) =
166"`.
♻️ Duplicate comments (1)
program-libs/token-interface/src/state/mint/compressed_mint.rs (1)

70-93: Well-structured refactor of CompressedMintMetadata with clear derivation chain.

The replacement of compressed_address: [u8; 32] with mint_signer: [u8; 32] + bump: u8 is clean. The compressed_address() method correctly derives the Light Protocol address from the mint PDA (not directly from mint_signer), using the canonical CMINT_ADDRESS_TREE and LIGHT_TOKEN_PROGRAM_ID.

One suggestion per a previous review: consider adding a brief doc comment to compressed_address() clarifying the two-step derivation chain for future maintainers:

/// Derives the Light Protocol compressed address from the mint PDA.
/// Note: The mint PDA itself is derived from (mint_signer, bump) using COMPRESSED_MINT_SEED.

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

Caution

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

⚠️ Outside diff range comments (2)
sdk-libs/token-sdk/src/token/decompress_mint.rs (1)

169-184: Stale comment: account order no longer matches code.

The comment lists 15 accounts with mint_signer at position 2, but after this refactor the mint signer is stored in metadata and no longer passed as an account. The actual build_account_infos() below has 14 accounts starting with authority at position 2.

Update the comment to reflect the current account order:

  1. light_system_program
  2. authority (signer)
  3. compressible_config
  4. cmint
  5. rent_sponsor
  6. fee_payer (signer)
  7. cpi_authority_pda
  8. registered_program_pda
  9. account_compression_authority
  10. account_compression_program
  11. system_program
  12. output_queue
  13. tree_pubkey (state_tree)
  14. input_queue
sdk-libs/token-sdk/src/token/create_mint.rs (1)

21-31: Remove unused compression_address field from CreateMintParams.

The field at line 26 is never referenced in the instruction flow. While callers derive and pass it (as shown in the doc example at line 49), MintActionCompressedInstructionData::new_mint doesn't need it—it only uses address_merkle_tree_root_index and proof. The compressed address can be derived on-demand from mint_seed_pubkey and address_tree_pubkey if needed elsewhere, eliminating dead weight from the struct.

🤖 Fix all issues with AI agents
In `@programs/compressed-token/program/tests/mint.rs`:
- Around line 113-125: The test currently randomizes mint_signer, bump, and
mint_pda independently which breaks PDA invariants; update the test so mint_pda
and bump are derived from mint_signer using the same PDA derivation helper used
in production (e.g., the program's mint PDA helper or find_program_address)
before constructing CompressedMintInstructionData/CompressedMintMetadata,
ensuring mint_signer, bump, and mint_pda are consistent with the real PDA
derivation.
📜 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 f56835f and 13e7621.

⛔ Files ignored due to path filters (12)
  • js/compressed-token/src/v3/actions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint-action.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint.ts is excluded by none and included by none
  • sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs is excluded by none and included by none
  • sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs is excluded by none and included by none
📒 Files selected for processing (3)
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
  • sdk-libs/token-sdk/src/token/decompress_mint.rs
🧰 Additional context used
📓 Path-based instructions (4)
sdk-libs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

sdk-libs/**/*.rs: SDK libs must depend only on program-libs, light-prover-client, and external crates
SDK libs must not depend on programs without devenv feature

Files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
programs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

programs/**/*.rs: Programs must depend only on program-libs and external crates (except devenv feature)
Programs must not depend on other programs without devenv feature

Files:

  • programs/compressed-token/program/tests/mint.rs
programs/**/tests/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

programs/**/tests/**/*.rs: Unit tests in programs must not depend on light-test-utils; tests requiring light-test-utils must be in program-tests
Integration tests for programs must be in program-tests, not in programs crates

Files:

  • programs/compressed-token/program/tests/mint.rs
programs/compressed-token/program/**/*.rs

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

programs/compressed-token/program/**/*.rs: When converting SPL Token operation errors from pinocchio token program processors, use convert_pinocchio_token_error to map error codes (0-18) to named ErrorCode variants
When handling errors from functions returning TokenError directly (e.g., unpack_amount_and_decimals), use convert_token_error to map SPL Token error codes (0-18) to named ErrorCode variants
When converting errors from system program operations, data access operations, or lamport transfers, use convert_program_error which adds a +6000 offset to raw error codes

Files:

  • programs/compressed-token/program/tests/mint.rs
🧠 Learnings (90)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: README.md:0-0
Timestamp: 2026-01-11T01:05:03.142Z
Learning: Applies to programs/merkle-distributor/src/**/*.rs : Use compressed accounts (compressed PDAs) instead of regular PDAs for ClaimStatus accounts in the Solana merkle-distributor program to reduce cost per claim (~0.00005 SOL vs ~0.002 SOL per claim)
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: account-comparison/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:01.412Z
Learning: Applies to account-comparison/programs/**/tests/test_compressed_account.rs : Include Light Protocol tests in test_compressed_account.rs to verify compressed account operations using LightAccount primitives
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: account-comparison/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:01.412Z
Learning: Applies to account-comparison/programs/**/src/**/*.rs : Use `LightAccount::new_init` for compressed account creation and `LightAccount::new_mut` for updates in Light Protocol implementations
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: airdrop-implementations/simple-claim/README.md:0-0
Timestamp: 2026-01-10T19:24:56.367Z
Learning: Applies to airdrop-implementations/simple-claim/**/*.rs : Tokens must be minted as compressed tokens to PDAs derived from `[claimant, mint, unlock_slot, bump]`
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: programs/merkle-distributor/CLAUDE.md:0-0
Timestamp: 2026-01-11T01:05:19.378Z
Learning: Applies to programs/merkle-distributor/**/state/*.rs : Use `LightDiscriminator` derive for compressed account state structs (e.g., ClaimStatus)
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/README.md:0-0
Timestamp: 2026-01-10T19:25:28.052Z
Learning: Applies to create-and-update/**/*.rs : Use `LightAccount::new_mut()` to update existing compressed accounts
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/README.md:0-0
Timestamp: 2026-01-10T19:25:28.052Z
Learning: Applies to create-and-update/**/*.rs : Use `LightAccount::new_init()` to create new compressed accounts
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/CONFIG_ACCOUNT.md:0-0
Timestamp: 2026-01-14T00:05:47.820Z
Learning: Applies to program-libs/compressible/docs/**/*.rs : CompressibleConfig PDA must be derived using seeds [b"compressible_config", version.to_le_bytes()] with the bump stored in the account's bump field
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:46.444Z
Learning: Applies to programs/compressed-token/program/src/compressed_token/mint_action/**/*.rs : MintAction instruction must support exactly 10 action types: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey, DecompressMint, and CompressAndCloseCMint
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: counter/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:31.226Z
Learning: Applies to counter/**/{anchor,native,pinocchio}/src/**/*.rs : Compressed PDA address must be derived from seeds ["counter", signer] using derive_address() with the address_tree_pubkey and program_id parameters
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:46.444Z
Learning: Compressed mint accounts support only one extension: TokenMetadata
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: programs/merkle-distributor/CLAUDE.md:0-0
Timestamp: 2026-01-11T01:05:19.378Z
Learning: Applies to programs/merkle-distributor/**/instructions/{new_claim,claim_locked}.rs : ClaimStatus compressed account address is derived via `light_sdk::address::v2::derive_address` with `ADDRESS_TREE_V2` using seeds: `["ClaimStatus", claimant.key(), distributor.key()]`
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-light-token-test/README.md:0-0
Timestamp: 2026-01-14T00:05:32.217Z
Learning: Implement all 8 compressed token instructions: 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/CLAUDE.md:0-0
Timestamp: 2026-01-12T14:27:56.326Z
Learning: Applies to programs/compressed-token/program/docs/compressed_token/{TRANSFER2,MINT_ACTION,FREEZE,THAW,CREATE_TOKEN_POOL,ADD_TOKEN_POOL}.md : Compressed token operations documentation should be organized in a compressed_token/ subdirectory with separate files for TRANSFER2.md (batch transfer with compress/decompress), MINT_ACTION.md (mint operations), FREEZE.md (freeze operations), THAW.md (thaw operations), CREATE_TOKEN_POOL.md (initial token pool creation), and ADD_TOKEN_POOL.md (additional token pools)
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-light-token-test/README.md:0-0
Timestamp: 2026-01-14T00:05:32.217Z
Learning: Applies to sdk-tests/sdk-light-token-test/**/*.rs : Use the `invoke_signed()` method for PDA-signed CPI calls in compressed token operations
📚 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/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-10T19:24:56.367Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: airdrop-implementations/simple-claim/README.md:0-0
Timestamp: 2026-01-10T19:24:56.367Z
Learning: Applies to airdrop-implementations/simple-claim/**/*.rs : Tokens must be minted as compressed tokens to PDAs derived from `[claimant, mint, unlock_slot, bump]`

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-14T00:05:47.820Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/CONFIG_ACCOUNT.md:0-0
Timestamp: 2026-01-14T00:05:47.820Z
Learning: Applies to program-libs/compressible/docs/**/*.rs : CompressibleConfig PDA must be derived using seeds [b"compressible_config", version.to_le_bytes()] with the bump stored in the account's bump field

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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:

  • sdk-libs/token-sdk/src/token/decompress_mint.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:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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/**/seed_providers.rs : PDA and CToken seed provider implementations with client-side seed functions should be in `seed_providers.rs`

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-11T01:05:03.142Z
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: README.md:0-0
Timestamp: 2026-01-11T01:05:03.142Z
Learning: Applies to programs/merkle-distributor/src/**/*.rs : Use compressed accounts (compressed PDAs) instead of regular PDAs for ClaimStatus accounts in the Solana merkle-distributor program to reduce cost per claim (~0.00005 SOL vs ~0.002 SOL per claim)

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-14T00:05:47.820Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/CONFIG_ACCOUNT.md:0-0
Timestamp: 2026-01-14T00:05:47.820Z
Learning: Applies to program-libs/compressible/docs/**/*.rs : CompressibleConfig account state layout must follow the defined structure with version (u16), state (u8), bump (u8), update_authority (Pubkey), withdrawal_authority (Pubkey), rent_sponsor (Pubkey), compression_authority (Pubkey), rent_sponsor_bump (u8), compression_authority_bump (u8), rent_config (RentConfig), address_space ([Pubkey; 4]), and _place_holder ([u8; 32]) fields

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:10.578Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: airdrop-implementations/simple-claim/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:10.578Z
Learning: Applies to airdrop-implementations/simple-claim/program/src/processor.rs : Invoke light_ctoken_sdk::decompress via CPI to convert compressed tokens to SPL tokens in the Claim instruction processor

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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_pda_seeds_with_bump` function to verify PDA with known bump seed using `create_program_address`, returning `InvalidSeeds` (20010) error on mismatch

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:10.578Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: airdrop-implementations/simple-claim/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:10.578Z
Learning: Applies to airdrop-implementations/simple-claim/program/src/processor.rs : Airdrop PDA must be derived using seeds: [claimant.to_bytes(), mint.to_bytes(), unlock_slot.to_le_bytes(), bump] via Pubkey::create_program_address

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:31.226Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: counter/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:31.226Z
Learning: Applies to counter/**/{anchor,native,pinocchio}/src/**/*.rs : Compressed PDA address must be derived from seeds ["counter", signer] using derive_address() with the address_tree_pubkey and program_id parameters

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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 : PDA derivation functions should accept `&[&[u8]]` for seeds and `&[u8; 32]` for program_id when using AccountInfoTrait methods `find_program_address()` or `create_program_address()`

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-15T02:04:22.996Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/nullifier/README.md:0-0
Timestamp: 2026-01-15T02:04:22.996Z
Learning: Applies to zk/nullifier/programs/nullifier/src/**/*.rs : Program must derive addresses and create compressed accounts via CPI to Light system program, which will reject if any address already exists

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-15T02:04:22.996Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/nullifier/README.md:0-0
Timestamp: 2026-01-15T02:04:22.996Z
Learning: Applies to zk/nullifier/programs/nullifier/src/**/*.rs : Consider using compressed PDAs instead of regular PDAs for nullifiers to reduce rent costs (~0.000015 SOL vs ~0.001 SOL per nullifier)

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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_pda_seeds` function to derive PDA using `find_program_address` and verify it matches account key, returning `InvalidSeeds` (20010) error on mismatch

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-14T00:05:32.217Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-light-token-test/README.md:0-0
Timestamp: 2026-01-14T00:05:32.217Z
Learning: Applies to sdk-tests/sdk-light-token-test/**/*.rs : Derive PDAs using `Pubkey::find_program_address()` before using them as authority/owner in `invoke_signed()` calls

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.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 : Return error `AccountError::AccountNotRentExempt` (error code 12011) when account balance is insufficient for rent exemption at calculated size

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2025-11-24T18:00:21.501Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/docs/ERRORS.md:0-0
Timestamp: 2025-11-24T18:00:21.501Z
Learning: Applies to program-libs/compressible/docs/program-libs/compressible/src/error.rs : FailedBorrowRentSysvar (Error Code 19001): Ensure the rent sysvar is properly initialized in test environments and verify the sysvar is accessible for on-chain programs. Use `solana_program::rent::Rent::get()` with proper error handling for borrowing rent sysvar.

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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 : Verify merkle_tree_account balance is rent-exempt in `src/initialize_address_tree.rs`. Use `check_account_balance_is_rent_exempt` from `light-account-checks` library. Return error `AccountError::AccountNotRentExempt` (error code: 12011) if account balance is insufficient for rent exemption at calculated size.

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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 : All AccountError variants must convert automatically to `ProgramError::Custom(u32)` for both solana-program and pinocchio SDKs using From trait implementations

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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/pinocchio.rs : Pinocchio AccountInfo implementations should use native on-chain implementations for PDA functions when available, with fallback to solana_pubkey off-chain

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-10T19:26:10.578Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: airdrop-implementations/simple-claim/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:10.578Z
Learning: Applies to airdrop-implementations/simple-claim/program/src/instruction.rs : Include ClaimIxData structure with fields: proof (ValidityProof), packed_tree_info (PackedStateTreeInfo), amount (u64), lamports (Option<u64>), mint (Pubkey), unlock_slot (u64), and bump_seed (u8)

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-15T02:04:37.090Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/README.md:0-0
Timestamp: 2026-01-15T02:04:37.090Z
Learning: Applies to zk/zk-id/src/lib.rs : Create compressed accounts for issuer entities storing their pubkey and credential issuance counter in the create_issuer instruction

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-11T01:05:19.378Z
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: programs/merkle-distributor/CLAUDE.md:0-0
Timestamp: 2026-01-11T01:05:19.378Z
Learning: Applies to programs/merkle-distributor/**/instructions/{new_claim,claim_locked}.rs : ClaimStatus compressed account address is derived via `light_sdk::address::v2::derive_address` with `ADDRESS_TREE_V2` using seeds: `["ClaimStatus", claimant.key(), distributor.key()]`

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-14T00:06:46.444Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:46.444Z
Learning: Applies to programs/compressed-token/program/src/compressed_token/mint_action/**/*.rs : MintAction instruction must support exactly 10 action types: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey, DecompressMint, and CompressAndCloseCMint

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-11T01:05:19.378Z
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: programs/merkle-distributor/CLAUDE.md:0-0
Timestamp: 2026-01-11T01:05:19.378Z
Learning: Applies to programs/merkle-distributor/**/instructions/new_distributor.rs : MerkleDistributor PDA uses seeds: `["MerkleDistributor", mint.key(), version.to_le_bytes()]`

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-15T02:04:58.086Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/CLAUDE.md:0-0
Timestamp: 2026-01-15T02:04:58.086Z
Learning: Applies to zk/zk-id/src/lib.rs : zk_verify_credential instruction must decompress G1/G2 points and verify Groth16 proof using Groth16Verifier

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-14T00:06:46.444Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:46.444Z
Learning: Applies to programs/compressed-token/program/src/compressed_token/transfer2/**/*.rs : Transfer2 instruction must perform sum checks when supporting multi-mint Compress, Decompress, and CompressAndClose operations

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:10.578Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: airdrop-implementations/simple-claim/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:10.578Z
Learning: Applies to airdrop-implementations/simple-claim/program/src/processor.rs : Validate that the derived PDA matches the provided airdrop_pda account in the Claim instruction

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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: Wrapper instruction Account context must include: optional `registered_forester_pda` (mutable), `authority` signer, `cpi_authority` PDA with seeds, `registered_program_pda`, `account_compression_program`, `log_wrapper` for events, and `target_account` (mutable)

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-14T00:06:11.915Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:11.915Z
Learning: Applies to program-libs/compressible/src/config.rs : Provide PDA derivation methods (`derive_pda`, `derive_v1_config_pda`) for CompressibleConfig account location

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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 output queue account discriminator to b`queueacc` (8 bytes) and initialize queue metadata with QueueType::OutputStateV2

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-14T00:06:11.915Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:11.915Z
Learning: Applies to program-libs/compressible/src/config.rs : CompressibleConfig account structure must support multiple serialization features (Anchor, Pinocchio, Borsh) for program compatibility

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.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/**/initialize_state_tree.rs : State tree initialization must create two Solana accounts: BatchedMerkleTreeAccount with integrated input queue and separate BatchedQueueAccount

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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 : Initialize an output queue account as `BatchedQueueAccount` with `QueueType::OutputStateV2`, temporary storage for compressed account hashes before tree insertion with immediate spending capability via proof-by-index, using discriminator b`queueacc` [113, 117, 101, 117, 101, 97, 99, 99]

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-15T02:04:37.090Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/README.md:0-0
Timestamp: 2026-01-15T02:04:37.090Z
Learning: Applies to zk/zk-id/src/lib.rs : Use CpiAccounts::new() from light_sdk::cpi::v2 for account parameter handling

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-11T01:05:19.378Z
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: programs/merkle-distributor/CLAUDE.md:0-0
Timestamp: 2026-01-11T01:05:19.378Z
Learning: Applies to programs/merkle-distributor/**/instructions/{new_claim,claim_locked}.rs : Use Light SDK v2 CPI via `LightSystemProgramCpi::new_cpi` for compressed account interactions

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:48.012Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: read-only/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:48.012Z
Learning: Creates compressed accounts with derived addresses and validates them read-only via Light System Program CPI

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-10T19:26:10.578Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: airdrop-implementations/simple-claim/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:10.578Z
Learning: Applies to airdrop-implementations/simple-claim/program/src/instruction.rs : Define ClaimAccounts structure with 16 account fields in order: claimant, fee_payer, associated_airdrop_pda, ctoken_cpi_authority_pda, light_system_program, registered_program_pda, noop_program, account_compression_authority, account_compression_program, ctoken_program, spl_interface_pda, decompress_destination, token_program, system_program, state_tree, and queue

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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/token-sdk/src/token/decompress_mint.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/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-15T02:04:37.090Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/README.md:0-0
Timestamp: 2026-01-15T02:04:37.090Z
Learning: Applies to zk/zk-id/src/lib.rs : Use system_accounts_offset parameter to locate system accounts in remaining accounts when using Light SDK V2

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-15T02:04:37.090Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/README.md:0-0
Timestamp: 2026-01-15T02:04:37.090Z
Learning: Applies to zk/zk-id/src/lib.rs : Use sha::LightAccount for accounts with Vec fields (uses SHA256 flat hashing)

Applied to files:

  • sdk-libs/token-sdk/src/token/decompress_mint.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:

  • sdk-libs/token-sdk/src/token/decompress_mint.rs
📚 Learning: 2026-01-10T19:26:01.412Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: account-comparison/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:01.412Z
Learning: Applies to account-comparison/programs/**/tests/test_compressed_account.rs : Include Light Protocol tests in test_compressed_account.rs to verify compressed account operations using LightAccount primitives

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-10T19:25:28.052Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/README.md:0-0
Timestamp: 2026-01-10T19:25:28.052Z
Learning: Applies to create-and-update/**/*.rs : Use `LightAccount::new_mut()` to update existing compressed accounts

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-11T01:05:19.378Z
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: programs/merkle-distributor/CLAUDE.md:0-0
Timestamp: 2026-01-11T01:05:19.378Z
Learning: Applies to programs/merkle-distributor/**/state/*.rs : Use `LightDiscriminator` derive for compressed account state structs (e.g., ClaimStatus)

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-10T19:26:38.625Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:38.625Z
Learning: Applies to create-and-update/**/programs/**/src/**/*.rs : Define compressed account state structs with 8-byte discriminators derived via `LightDiscriminator` hash of struct name

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-11T01:05:19.378Z
Learnt from: CR
Repo: Lightprotocol/distributor PR: 0
File: programs/merkle-distributor/CLAUDE.md:0-0
Timestamp: 2026-01-11T01:05:19.378Z
Learning: Applies to programs/merkle-distributor/**/state/claim_status.rs : ClaimStatus compressed accounts are serialized with 8-byte discriminator + 56 bytes data = 64 bytes total

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-10T19:26:01.412Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: account-comparison/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:01.412Z
Learning: Applies to account-comparison/programs/**/src/**/*.rs : Validate address tree identity by comparing `address_tree_pubkey.to_bytes()` against the constant `ADDRESS_TREE_V2` in `create_compressed_account` instruction

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-14T00:06:28.451Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:28.451Z
Learning: Account compression tests should verify Merkle tree management functionality in the core account compression program

Applied to files:

  • programs/compressed-token/program/tests/mint.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 : Account validation for address trees must check: (1) account ownership by Light account compression program, (2) account discriminator is `BatchMta`, and (3) tree type is `ADDRESS_MERKLE_TREE_TYPE_V2` (5)

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-10T19:26:48.012Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: read-only/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:48.012Z
Learning: Applies to read-only/**/*.rs : Validate address tree pubkey matches `ADDRESS_TREE_V2` constant in `create_compressed_account` instruction

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-10T19:26:21.240Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: basic-operations/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:21.240Z
Learning: Applies to basic-operations/**/{anchor,native}/**/src/**/*.rs : Validate that `address_tree_pubkey.to_bytes() == ADDRESS_TREE_V2` before processing account operations

Applied to files:

  • programs/compressed-token/program/tests/mint.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 : Account validation for state trees must check: (1) account ownership by Light account compression program, (2) account discriminator is `BatchMta`, and (3) tree type is `STATE_MERKLE_TREE_TYPE_V2` (4)

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-10T19:26:38.625Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:38.625Z
Learning: Applies to create-and-update/**/programs/**/src/**/*.rs : Create compressed accounts with derived addresses using `LightAccount::new_init()` method

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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/**/*.rs : Use constants from constants.rs including ADDRESS_TREE_INIT_ROOT_40 generated from IndexedMerkleTree reference implementation

Applied to files:

  • programs/compressed-token/program/tests/mint.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:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-14T00:06:46.444Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:46.444Z
Learning: Compressed mint accounts support only one extension: TokenMetadata

Applied to files:

  • programs/compressed-token/program/tests/mint.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:

  • programs/compressed-token/program/tests/mint.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 : Define access control parameters: program_owner (Option<Pubkey>), forester (Option<Pubkey>) for non-Light foresters, and owner (Pubkey passed as function parameter)

Applied to files:

  • programs/compressed-token/program/tests/mint.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:

  • programs/compressed-token/program/tests/mint.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 : Compute hashed_pubkey in `src/initialize_address_tree.rs` by hashing and truncating the owner pubkey to 31 bytes for bn254 field compatibility.

Applied to files:

  • programs/compressed-token/program/tests/mint.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:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-15T02:04:37.090Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/README.md:0-0
Timestamp: 2026-01-15T02:04:37.090Z
Learning: Applies to zk/zk-id/src/lib.rs : Use into_new_address_params_assigned_packed(seed, Some(index)) for address parameter construction in Light SDK V2

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:48.012Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: read-only/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:48.012Z
Learning: Applies to read-only/**/*.rs : Derive compressed account addresses using seed pattern `["first", signer.key()]` via `derive_address()` with address tree and program ID

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.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 : Initialize address tree with integrated address queue in `src/initialize_address_tree.rs`. Creates one `BatchedMerkleTreeAccount` with account layout defined in `src/merkle_tree.rs`, metadata in `src/merkle_tree_metadata.rs`, tree type `TreeType::AddressV2` (5), initial root `ADDRESS_TREE_INIT_ROOT_40`, starts at next_index 1, and discriminator `BatchMta` (8 bytes).

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-10T19:25:28.052Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/README.md:0-0
Timestamp: 2026-01-10T19:25:28.052Z
Learning: Applies to create-and-update/**/*.rs : Use deterministic seeds (e.g., `FIRST_SEED`, `SECOND_SEED`) for compressed account address derivation

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:21.240Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: basic-operations/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:21.240Z
Learning: Applies to basic-operations/**/{anchor,native}/**/src/**/*.rs : Derive addresses from seeds `[b"message", signer.key.as_ref()]` combined with `ADDRESS_TREE_V2` and program ID

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-15T02:04:58.086Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/CLAUDE.md:0-0
Timestamp: 2026-01-15T02:04:58.086Z
Learning: Applies to zk/zk-id/src/lib.rs : IssuerAccount address must derive using derive_address() with seeds [b"issuer", signer_pubkey] and ADDRESS_TREE_V2

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-15T02:04:37.090Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: zk/zk-id/README.md:0-0
Timestamp: 2026-01-15T02:04:37.090Z
Learning: Applies to zk/zk-id/src/lib.rs : Issue credentials by creating compressed accounts binding a user's pubkey to an issuer and incrementing the issuer's credential counter in the add_credential instruction

Applied to files:

  • programs/compressed-token/program/tests/mint.rs
📚 Learning: 2026-01-14T00:05:32.217Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-light-token-test/README.md:0-0
Timestamp: 2026-01-14T00:05:32.217Z
Learning: Applies to sdk-tests/sdk-light-token-test/**/*.rs : Use the builder pattern from `light-token-sdk::ctoken` module for CPI operations instead of manual instruction building

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.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/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-14T00:06:46.444Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2026-01-14T00:06:46.444Z
Learning: Applies to programs/compressed-token/program/src/ctoken/*.rs : CToken operations must validate that the CompressibleConfig state is ACTIVE only for CreateTokenAccount, CreateAssociatedTokenAccount, and CreateAssociatedTokenAccountIdempotent instructions

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-14T00:05:32.217Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-light-token-test/README.md:0-0
Timestamp: 2026-01-14T00:05:32.217Z
Learning: Implement all 8 compressed token instructions: 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:

  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2025-11-24T17:54:33.614Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/anchor/README.md:0-0
Timestamp: 2025-11-24T17:54:33.614Z
Learning: Implement the Compressed Token Program interface for creating and using compressed tokens on Solana with ZK Compression

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2025-11-24T17:54:38.537Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/README.md:0-0
Timestamp: 2025-11-24T17:54:38.537Z
Learning: Implement compressed token program interfaces for third-party token creation and usage on Solana using ZK Compression

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:38.625Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:38.625Z
Learning: Applies to create-and-update/**/programs/**/src/**/*.rs : Derive addresses from seeds using format `[seed, signer.key()]` with program ID and address tree

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:26:48.012Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: read-only/CLAUDE.md:0-0
Timestamp: 2026-01-10T19:26:48.012Z
Learning: Applies to read-only/**/*.rs : Include `proof: ValidityProof` and `address_tree_info: PackedAddressTreeInfo` parameters for account creation instructions

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:25:33.379Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: read-only/README.md:0-0
Timestamp: 2026-01-10T19:25:33.379Z
Learning: Applies to read-only/**/*.rs : Mark fields with `#[hash]` attribute when they should be included in validity proofs for compressed accounts

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.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:

  • sdk-libs/token-sdk/src/token/create_mint.rs
📚 Learning: 2026-01-10T19:25:28.052Z
Learnt from: CR
Repo: Lightprotocol/program-examples PR: 0
File: create-and-update/README.md:0-0
Timestamp: 2026-01-10T19:25:28.052Z
Learning: Applies to create-and-update/**/*.rs : Use `LightAccount::new_init()` to create new compressed accounts

Applied to files:

  • sdk-libs/token-sdk/src/token/create_mint.rs
🧬 Code graph analysis (2)
programs/compressed-token/program/tests/mint.rs (1)
program-libs/compressed-account/src/pubkey.rs (1)
  • new_from_array (79-81)
sdk-libs/token-sdk/src/token/create_mint.rs (1)
sdk-libs/token-client/src/actions/mint_action.rs (1)
  • mint_action (27-62)
⏰ 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). (11)
  • GitHub Check: Forester e2e test
  • GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • GitHub Check: lint
  • GitHub Check: programs (light-system-program-address, ["cargo-test-sbf -p system-test -- test_with_address", "c...
  • GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
  • GitHub Check: programs (system-cpi-test-v2-functional-read-only, ["cargo-test-sbf -p system-cpi-v2-test -- func...
  • GitHub Check: programs (system-cpi-test-v2-functional-account-infos, ["cargo-test-sbf -p system-cpi-v2-test -- ...
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo test -p light-compressed-token", "cargo-test-sbf -p c...
  • GitHub Check: Test program-libs-slow
  • GitHub Check: Test program-libs-fast

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@ananas-block ananas-block force-pushed the jorrit/refactor-include-mint-signer-mint branch from 13e7621 to 3630511 Compare January 15, 2026 23:30
@ananas-block ananas-block force-pushed the jorrit/refactor-include-mint-signer-mint branch from 3630511 to f6ee6e2 Compare January 15, 2026 23: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

🤖 Fix all issues with AI agents
In `@sdk-libs/token-sdk/src/token/create_mint.rs`:
- Around line 110-120: In instruction(), before building
CompressedMintInstructionData, validate that the PDA derived from
mint_seed_pubkey (using the same seed derivation logic your program uses)
matches params.mint and that the derived bump equals params.bump; if they don’t
match, return an early Err (e.g., ProgramError::InvalidArgument or a more
specific program error) to fail fast and avoid emitting inconsistent metadata
(check the symbols instruction(), CompressedMintInstructionData, params.mint,
params.bump, and mint_seed_pubkey to locate where to insert the guard).

Comment on lines 110 to 120
pub fn instruction(self) -> Result<Instruction, ProgramError> {
let compression_address = self.params.compression_address;

let compressed_mint_instruction_data = CompressedMintInstructionData {
supply: 0,
decimals: self.params.decimals,
metadata: light_token_interface::state::CompressedMintMetadata {
version: 3,
mint: self.params.mint.to_bytes().into(),
cmint_decompressed: false,
compressed_address: compression_address,
mint_signer: self.mint_seed_pubkey.to_bytes(),
bump: self.params.bump,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Fail fast if mint/bump don’t match mint_seed_pubkey.

Now that metadata stores mint_signer + bump, a mismatch between params.mint/params.bump and the PDA derived from mint_seed_pubkey will silently create inconsistent metadata and likely fail on-chain. Consider validating early.

✅ Suggested guard
 pub fn instruction(self) -> Result<Instruction, ProgramError> {
+    let (derived_mint, derived_bump) = find_mint_address(&self.mint_seed_pubkey);
+    if derived_mint != self.params.mint || derived_bump != self.params.bump {
+        return Err(ProgramError::InvalidArgument);
+    }
     let compressed_mint_instruction_data = CompressedMintInstructionData {
         supply: 0,
         decimals: self.params.decimals,
         metadata: light_token_interface::state::CompressedMintMetadata {
🤖 Prompt for AI Agents
In `@sdk-libs/token-sdk/src/token/create_mint.rs` around lines 110 - 120, In
instruction(), before building CompressedMintInstructionData, validate that the
PDA derived from mint_seed_pubkey (using the same seed derivation logic your
program uses) matches params.mint and that the derived bump equals params.bump;
if they don’t match, return an early Err (e.g., ProgramError::InvalidArgument or
a more specific program error) to fail fast and avoid emitting inconsistent
metadata (check the symbols instruction(), CompressedMintInstructionData,
params.mint, params.bump, and mint_seed_pubkey to locate where to insert the
guard).

@SwenSchaeferjohann SwenSchaeferjohann merged commit 52b1f11 into main Jan 16, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants