Skip to content

chore: remove sdk deps from programs, add detection to lint#2188

Merged
SwenSchaeferjohann merged 1 commit intomainfrom
jorrit/fix-remove-sdk-deps-from-programs
Jan 21, 2026
Merged

chore: remove sdk deps from programs, add detection to lint#2188
SwenSchaeferjohann merged 1 commit intomainfrom
jorrit/fix-remove-sdk-deps-from-programs

Conversation

@ananas-block
Copy link
Contributor

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

Summary by CodeRabbit

  • New Features

    • Added an AddressSeed type and a PackedAddressTreeInfo representation with helper access.
    • Re-exported address/tree types and constants for simpler SDK usage.
  • Deprecations

    • SYSTEM_PROGRAM_ID deprecated — use LIGHT_SYSTEM_PROGRAM_ID.
  • Chores

    • Consolidated imports, re-exports, and adjusted dependency/macro sourcing to streamline modules.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

Introduces a new AddressSeed type and PackedAddressTreeInfo helpers in light_compressed_account, moves compression-related constants (including LIGHT_SYSTEM_PROGRAM_ID) into that crate, and updates SDK and program crates to re-export/use these canonical locations and adjusted imports.

Changes

Cohort / File(s) Summary
New types in light_compressed_account
program-libs/compressed-account/src/address.rs, program-libs/compressed-account/src/instruction_data/data.rs
Added pub struct AddressSeed(pub [u8; 32]) with From conversions; added PackedAddressTreeInfo and conversion helpers mapping tree/queue/root indices into NewAddressParams variants.
New constants in light_compressed_account
program-libs/compressed-account/src/constants.rs
Added LIGHT_SYSTEM_PROGRAM_ID, ACCOUNT_COMPRESSION_AUTHORITY_PDA, CPI_AUTHORITY_PDA_SEED; added deprecated alias SYSTEM_PROGRAM_ID.
SDK-types consolidation & trait
sdk-libs/sdk-types/src/address.rs, sdk-libs/sdk-types/src/constants.rs, sdk-libs/sdk-types/src/instruction/tree_info.rs
Replaced local AddressSeed/constants with pub use re-exports from light_compressed_account; removed inline constants; added PackedAddressTreeInfoExt trait and re-exported PackedAddressTreeInfo.
SDK re-export updates
sdk-libs/sdk/src/lib.rs
Updated public exports to include instruction::PackedAddressTreeInfo and PackedAddressTreeInfoExt via sdk-types.
Program import updates (compressed-token)
programs/compressed-token/program/src/**/*.rs, programs/compressed-token/program/Cargo.toml
Updated imports to source PackedMerkleContext, ZOutputCompressedAccountWithPackedContextMut, CpiSigner, derive macro and constants from light_compressed_account / light-macros; removed some workspace deps.
Compressible crate feature cleanup
program-libs/compressible/Cargo.toml, program-libs/compressible/src/lib.rs
Removed light-sdk-types/anchor feature and workspace dependency; adjusted grouped imports to use light_compressed_account::instruction_data::data::PackedAddressTreeInfo.
Tests import updates
programs/compressed-token/program/tests/mint.rs, programs/compressed-token/program/tests/token_input.rs
Updated PackedMerkleContext import paths to light_compressed_account::compressed_account::PackedMerkleContext.
Event parsing update
sdk-libs/event/src/parse.rs
Replaced checks/imports of SYSTEM_PROGRAM_ID with LIGHT_SYSTEM_PROGRAM_ID and adjusted classification branch to emit ProgramId::LightSystem where applicable.
CPI/constants import adjustments
programs/compressed-token/program/src/shared/*.rs
Switched CPI/authority and compression-related constant imports to light_compressed_account::constants::....

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

ai-review

Suggested reviewers

  • sergeytimoshin

Poem

🌱 A seed is named, a tree now known,
Constants moved to one true home,
Imports tidy, paths align,
SDK sings in shared design,
Small refactors, steady tone.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 70.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main objective: removing SDK dependencies from programs and adding linting detection.

✏️ 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/fix-remove-sdk-deps-from-programs

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

Caution

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

⚠️ Outside diff range comments (1)
sdk-libs/sdk-types/src/instruction/tree_info.rs (1)

28-46: Remove the unused Clone bound to avoid unnecessary constraints (Lines 31-40).
The method never clones T, so the extra bound just restricts implementors.

♻️ Suggested refinement
-    fn get_tree_pubkey<T: AccountInfoTrait + Clone>(
+    fn get_tree_pubkey<T: AccountInfoTrait>(
         &self,
         cpi_accounts: &impl TreeAccounts<T>,
     ) -> Result<T::Pubkey, crate::error::LightSdkTypesError>;
-    fn get_tree_pubkey<T: AccountInfoTrait + Clone>(
+    fn get_tree_pubkey<T: AccountInfoTrait>(
         &self,
         cpi_accounts: &impl TreeAccounts<T>,
     ) -> Result<T::Pubkey, crate::error::LightSdkTypesError> {
🤖 Fix all issues with AI agents
In `@program-libs/compressed-account/src/address.rs`:
- Around line 5-7: The AddressSeed struct currently derives PartialEq but not
Eq; since it is Copy and contains only [u8; 32] (which implements Eq), update
the derive attribute for AddressSeed to include Eq (i.e., change #[derive(Debug,
PartialEq, Clone, Copy)] to #[derive(Debug, PartialEq, Eq, Clone, Copy)]) so the
type fully implements equality semantics and can be used more idiomatically in
places requiring Eq.

In `@program-libs/compressed-account/src/constants.rs`:
- Around line 13-16: Add a unit test in programs/system/src/constants.rs that
derives the CPI authority PDA and asserts it equals the hardcoded
ACCOUNT_COMPRESSION_AUTHORITY_PDA: call
find_program_address(&[CPI_AUTHORITY_PDA_SEED],
&ACCOUNT_COMPRESSION_PROGRAM_ID).0, convert/compare the derived Pubkey to
ACCOUNT_COMPRESSION_AUTHORITY_PDA and assert equality, ensuring the test name
clearly states it verifies the hardcoded address matches on-chain derivation
(e.g., test_account_compression_authority_address_match).

@ananas-block ananas-block force-pushed the jorrit/fix-remove-sdk-deps-from-programs branch from 4e2927e to 4d77a9d Compare January 21, 2026 17:24
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 `@programs/compressed-token/program/tests/mint.rs`:
- Line 174: Move the inline import of PackedMerkleContext out of the test
function into the file's top-level imports to match the existing
light_compressed_account imports; locate the inline use statement referencing
light_compressed_account::compressed_account::PackedMerkleContext in the mint.rs
test and add it to the module-level use block alongside the other
light_compressed_account imports (keeping the same path and name
PackedMerkleContext) and remove the redundant inline import from the test
function.
♻️ Duplicate comments (1)
program-libs/compressed-account/src/constants.rs (1)

3-16: Add a derivation test for the hardcoded CPI authority PDA.
The hardcoded ACCOUNT_COMPRESSION_AUTHORITY_PDA is used for runtime validation; a test that derives the PDA from the seed and program ID would prevent silent drift.

@SwenSchaeferjohann SwenSchaeferjohann merged commit 9825fc6 into main Jan 21, 2026
32 checks passed
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