Skip to content

fix: remove unused accounts and variables#2105

Merged
ananas-block merged 1 commit intomainfrom
jorrit/fix-unused-accounts-and-variables
Dec 7, 2025
Merged

fix: remove unused accounts and variables#2105
ananas-block merged 1 commit intomainfrom
jorrit/fix-unused-accounts-and-variables

Conversation

@ananas-block
Copy link
Contributor

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

  • Remove unused fee_payer from UpdateCompressibleConfig
  • Remove unused has_top_up from CompressibleExtensionInstructionData
  • Add TODO for spl_mint_initialized account optimization

Summary by CodeRabbit

  • Bug Fixes

    • Updated transaction signing requirements for configuration updates.
  • Chores

    • Removed unused flag from extension instruction data to reduce payload size.
  • Documentation

    • Added clarification on account requirements for specific operations.

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

- Remove unused fee_payer from UpdateCompressibleConfig
- Remove unused has_top_up from CompressibleExtensionInstructionData
- Add TODO for spl_mint_initialized account optimization
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 7, 2025

Walkthrough

The pull request removes the has_top_up field from CompressibleExtensionInstructionData across the interface and SDK layers, and removes the fee_payer signer requirement from the UpdateCompressibleConfig account context. Documentation is added to clarify SPL token account requirements.

Changes

Cohort / File(s) Summary
CompressibleExtensionInstructionData struct definition
program-libs/ctoken-interface/src/instructions/extensions/compressible.rs
Removed public field has_top_up: u8 from struct definition, simplifying the on-chain instruction data structure.
SDK CToken creation builders
sdk-libs/ctoken-sdk/src/ctoken/create.rs, sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs
Removed population of has_top_up field in CompressibleExtensionInstructionData construction during account creation and ATA creation flows.
UpdateCompressibleConfig account context
programs/registry/src/compressible/update_config.rs
Removed fee_payer: Signer<'info> field from account validation struct, changing signer requirements for config updates.
Documentation improvements
programs/compressed-token/program/src/mint_action/accounts.rs
Added doc comments explaining that SPL token accounts (mint, token_pool_pda, token_program) are only required for specific Mint actions (MintToCompressed, MintToCToken, CreateSplMint), not for authority/metadata updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Field removal consistency: Verify that removing has_top_up from both interface and SDK construction sites doesn't break downstream consumers relying on this indicator for top-up logic flow.
  • Fee payer removal impact: Confirm that removing fee_payer from UpdateCompressibleConfig doesn't affect transaction fee handling and that fee responsibility is properly reassigned elsewhere in the system.
  • Cross-module coherence: Ensure the changes across interface, registry programs, and SDK maintain alignment—particularly whether any instruction handlers still expect the removed has_top_up field.

Possibly related PRs

Suggested labels

ai-review

Suggested reviewers

  • sergeytimoshin
  • SwenSchaeferjohann

Poem

✨ Fields fade like morning dew,
has_top_up waves goodbye so true,
Fee payers bid their calm adieu,
Simplicity blooms—the code shines new! 🌱

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: remove unused accounts and variables' directly and accurately summarizes the main changes: removing the fee_payer account and has_top_up field across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/fix-unused-accounts-and-variables

📜 Recent 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 59b26c6 and ed96d54.

⛔ Files ignored due to path filters (2)
  • program-tests/compressed-token-test/tests/ctoken/create_ata.rs is excluded by none and included by none
  • program-tests/registry-test/tests/compressible.rs is excluded by none and included by none
📒 Files selected for processing (5)
  • program-libs/ctoken-interface/src/instructions/extensions/compressible.rs (0 hunks)
  • programs/compressed-token/program/src/mint_action/accounts.rs (1 hunks)
  • programs/registry/src/compressible/update_config.rs (0 hunks)
  • sdk-libs/ctoken-sdk/src/ctoken/create.rs (0 hunks)
  • sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs (0 hunks)
💤 Files with no reviewable changes (4)
  • program-libs/ctoken-interface/src/instructions/extensions/compressible.rs
  • sdk-libs/ctoken-sdk/src/ctoken/create.rs
  • programs/registry/src/compressible/update_config.rs
  • sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs
🧰 Additional context used
📓 Path-based instructions (2)
programs/compressed-token/program/**/mint_action/*.rs

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

programs/compressed-token/program/**/mint_action/*.rs: MintAction instruction is a batch instruction supporting 9 action types: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey, with support for both compressed and decompressed token minting
Compressed mint accounts support one extension: TokenMetadata

Files:

  • programs/compressed-token/program/src/mint_action/accounts.rs
programs/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in programs must not depend on light-test-utils; integration tests must be located in program-tests/

Files:

  • programs/compressed-token/program/src/mint_action/accounts.rs
🧠 Learnings (12)
📓 Common learnings
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
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 : Light Protocol accounts must satisfy both Solana rent exemption and Light Protocol rent requirements, plus an 11,000 lamport compression incentive during creation
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/DECOMPRESSED_TRANSFER.md : Decompressed Transfer documentation must cover SPL-compatible transfers between decompressed accounts
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/create_*token_account*.rs : CToken account layout is the same as SPL tokens but implements a custom Compressible extension
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/extensions/*compressible*.rs : When working with ctoken accounts that have the compressible extension, you MUST read program-libs/compressible/docs/ including RENT.md, CONFIG_ACCOUNT.md, and SOLANA_RENT.md for complete rent system documentation
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-12-07T00:45:07.921Z
Learning: Compressible token accounts should support compression back into compressed state and rent payment mechanisms
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/ctoken_transfer.rs : CTokenTransfer instruction is SPL-compatible and transfers between decompressed accounts only
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`
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)
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
📚 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:

  • programs/compressed-token/program/src/mint_action/accounts.rs
📚 Learning: 2025-12-06T00:49:37.752Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/mint_action/*.rs : Compressed mint accounts support one extension: TokenMetadata

Applied to files:

  • programs/compressed-token/program/src/mint_action/accounts.rs
📚 Learning: 2025-12-06T00:49:37.752Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/mint_action/*.rs : MintAction instruction is a batch instruction supporting 9 action types: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey, with support for both compressed and decompressed token minting

Applied to files:

  • programs/compressed-token/program/src/mint_action/accounts.rs
📚 Learning: 2025-12-06T00:49:37.752Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/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 (create, update, close)

Applied to files:

  • programs/compressed-token/program/src/mint_action/accounts.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:

  • programs/compressed-token/program/src/mint_action/accounts.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:

  • programs/compressed-token/program/src/mint_action/accounts.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 : Document discriminator values in code comments to make account types discoverable and maintainable

Applied to files:

  • programs/compressed-token/program/src/mint_action/accounts.rs
📚 Learning: 2025-12-06T00:49:37.752Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/create_*token_account*.rs : CToken account layout is the same as SPL tokens but implements a custom Compressible extension

Applied to files:

  • programs/compressed-token/program/src/mint_action/accounts.rs
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/docs/*accounts* : Account documentation must include: description (what account represents and role), state layout (path to struct and field descriptions), associated instructions (list with discriminators), discriminator (8-byte value if applicable), size (in bytes), ownership (expected owner), serialization (zero-copy for programs and Borsh for clients with code snippets). For PDAs include derivation (seeds) and bump (stored or derived). For compressed accounts include version, hashing (method and discriminator), and data layout.

Applied to files:

  • programs/compressed-token/program/src/mint_action/accounts.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:

  • programs/compressed-token/program/src/mint_action/accounts.rs
📚 Learning: 2025-12-06T00:49:37.752Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:37.752Z
Learning: Applies to programs/compressed-token/program/**/ctoken_transfer.rs : CTokenTransfer instruction is SPL-compatible and transfers between decompressed accounts only

Applied to files:

  • programs/compressed-token/program/src/mint_action/accounts.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). (18)
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo test -p light-compressed-token", "cargo-test-sbf -p c...
  • GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
  • 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: programs (light-system-program-address, ["cargo-test-sbf -p system-test -- test_with_address", "c...
  • GitHub Check: stateless-js-v2
  • GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
  • GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
  • GitHub Check: Forester e2e test
  • GitHub Check: system-programs (native, ["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-t...
  • GitHub Check: Test program-libs-fast
  • GitHub Check: stateless-js-v1
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: Test program-libs-slow
  • GitHub Check: cli-v2
  • GitHub Check: cli-v1
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
programs/compressed-token/program/src/mint_action/accounts.rs (1)

367-371: Excellent documentation of optimization opportunity for future work.

The TODO clearly explains why SPL token accounts are currently required unconditionally for spl_mint_initialized=true, yet are only actually used by certain mint actions (MintToCompressed, MintToCToken, CreateSplMint). Authority and metadata update actions don't need these accounts, making this a valid candidate for optimization. The blocker—that this cannot be tested until SPL mint support exists—is well-documented. This will help future maintainers understand why a more granular account conditional wasn't implemented earlier.


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

@SwenSchaeferjohann SwenSchaeferjohann left a comment

Choose a reason for hiding this comment

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

Lgtm

@ananas-block ananas-block merged commit 445952a into main Dec 7, 2025
32 checks passed
@ananas-block ananas-block deleted the jorrit/fix-unused-accounts-and-variables branch December 7, 2025 01:15
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