Skip to content

Conversation

@ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Nov 10, 2025

Summary by CodeRabbit

  • New Features

    • Address insertion and queueing, nullifier (input) and output queue insertions, and batched tree updates with ZKP-verified root transitions; two-batch alternating processing and immediate proof-by-index spending.
  • Documentation

    • Extensive docs added: library overview, initialization flows, tree & queue account models, batch lifecycle, bloom-filter & hash-chain semantics, root history, ZKP public inputs/verification, and contributor guide.
  • Chores

    • Added automated code-review/configuration for documentation and review workflows.

- Add CLAUDE.md with AI assistant documentation
- Add QUEUE_ACCOUNT.md with queue account structure docs
- Add TREE_ACCOUNT.md with tree account structure docs
Add INITIALIZE_STATE_TREE.md with detailed documentation for
state tree initialization process and parameters.
Add INITIALIZE_ADDRESS_TREE.md with detailed documentation for
address tree initialization process and parameters.
Add INSERT_OUTPUT_QUEUE.md with detailed documentation for
inserting elements into the output queue.
Add INSERT_INPUT_QUEUE.md with detailed documentation for
inserting nullifiers into the input queue.
Add INSERT_ADDRESS_QUEUE.md with detailed documentation for
inserting addresses into the address queue.
Add UPDATE_FROM_OUTPUT_QUEUE.md with detailed documentation for
updating the merkle tree from the output queue.
Add UPDATE_FROM_INPUT_QUEUE.md with detailed documentation for
updating the merkle tree from the input queue.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Walkthrough

Adds comprehensive documentation for the Batched Merkle Tree library (account models, queue behaviors, ZKP workflows, initialization and update flows), a CodeRabbit auto-review config, and new docs describing address/state tree initialization, queue inserts/updates, and one new public method plus related error variants; no runtime code changes beyond documented API additions.

Changes

Cohort / File(s) Summary
Top-level Guides
CLAUDE.md, DOCS.md
New root documentation and documentation guidelines covering repository structure, crate responsibilities, testing/build commands, and doc templates.
CodeRabbit Config
.coderabbit.yaml
New automated code-review configuration with path-specific rules, sensitive-file list, and tooling integrations.
Batched Merkle Tree — General
program-libs/batched-merkle-tree/docs/...
New comprehensive docs added under docs/ describing account shapes, queues, batch lifecycle, bloom filters, hash-chain stores, root history, serialization, validations, and cross-references.
Tree Account Reference
program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
Detailed spec for BatchedMerkleTreeAccount, metadata fields, tree-type variants (State/Address), root history, bloom filters, and zero-copy semantics.
Queue Account Reference
program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
Spec for BatchedQueueAccount, two-batch value/hash-chain vectors, queue metadata, zero-copy deserialization, and validations.
Initialization — Address Tree
program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
New doc: address-tree initialization, account sizing, integrated address queue, batch/z kp parameters, validations, rollover/fees, and errors.
Initialization — State Tree
program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
New doc: state-tree + output-queue initialization, sizing, batch/ZKP constraints, bloom settings, rent checks, initialization sequence, and error mapping.
Insert — Address Queue
program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md, src/merkle_tree.rs
Documentation of insert_address_into_queue flow and lifecycle. Documents a new method on BatchedMerkleTreeAccount and new error variants: MerkleTreeMetadataError::InvalidTreeType, BatchedMerkleTreeError::{TreeIsFull,BatchNotReady,BloomFilterNotZeroed,NonInclusionCheckFailed}.
Insert — Input Queue (Nullifiers)
program-libs/batched-merkle-tree/docs/INSERT_INPUT_QUEUE.md
New doc: insert_nullifier_into_queue flow for StateV2 trees, nullifier construction, non-inclusion checks, hash-chain updates, and batch lifecycle.
Insert — Output Queue
program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md
New doc: insert_into_current_batch for BatchedQueueAccount including leaf indexing, hash-chain updates, batch transitions, and immediate proof-by-index notes.
Update — From Input / Address Queues
program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md
New doc: update flows (Batch Nullify / Batch Address Append) using ZKP verification, public inputs, root updates, and bloom-zeroing rules.
Update — From Output Queue
program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md
New doc: batch-append from output queue with ZKP verification, public inputs, state transitions, root history updates, and zeroing rules.
Code Examples / Cross-links
program-libs/batched-merkle-tree/docs/CLAUDE.md
Added developer-facing pointers for prover circuits, client deserialization patterns, and testing references across crates.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Program
  participant TreeAcc as BatchedMerkleTreeAccount
  participant QueueAcc as BatchedQueueAccount
  participant Verifier as ZKP_Verifier

  rect rgb(240,248,255)
    Client->>Program: submit insert (address/nullifier/output)
    Program->>TreeAcc: validate owner, tree type, capacity
    Program->>QueueAcc: read/write batch vectors, bloom, hash-chains
    Program-->>Client: return success / error
  end

  rect rgb(245,255,240)
    Client->>Program: submit update tx + proof
    Program->>Verifier: verify proof (old_root,new_root,leaves_hash_chain[,start_index])
    alt verification success
      Program->>TreeAcc: append new_root, update sequence/root_history
      Program->>QueueAcc: advance pending/processing batches, maybe zero bloom
      Program-->>Client: success + event
    else verification failure
      Program-->>Client: error (verification/public_input)
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Focus areas:
    • Confirm the new insert_address_into_queue method signature and error codes in src/merkle_tree.rs.
    • Cross-check ZKP public inputs and referenced circuit paths against prover code (prover/server/prover/v2/...).
    • Verify account sizing and rent-exempt calculations referenced in initialization docs against get_merkle_tree_account_size / get_output_queue_account_size.

Suggested reviewers

  • sergeytimoshin

Poem

🌲 Pages bloom for queues and roots,

Two batches hum like tuned-up flutes,
Poseidon chains link leaf to sky,
Proofs attest and roots roll by,
Docs map the path — now ship it, crew!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add batched merkle tree documentation' accurately and clearly summarizes the primary change: comprehensive documentation additions for the Batched Merkle Tree Library across multiple new .md files and configuration updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jorrit/documentation-updates

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

🧹 Nitpick comments (3)
program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md (1)

53-53: Remove redundant phrase in line 53.

The phrase "still being filled or Full (completely filled)" contains redundancy. "Completely filled" is implied by "Full" state.

Suggested fix:

-  - If batch state is `Fill` (still being filled) or `Full` (completely filled) state
+  - If batch state is `Fill` (being filled) or `Full` state

Also applies to: 53-53

program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md (1)

36-39: Clarify wording in queue index description.

Line 38 uses awkward phrasing: "is the leaf index of the value up on Merkle tree insertion" should be "is the leaf index assigned when the value is inserted into the tree."

Suggested fix:

-   - This index is used for proof-by-index when spending compressed accounts
-   - Is the leaf index of the value up on Merkle tree insertion.
+   - This index is used for proof-by-index when spending compressed accounts
+   - Assigned at insertion time and determines the leaf position in the tree
program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md (1)

42-67: Document the two-batch system state transitions with sufficient detail.

The documentation of state transitions (lines 42-67) correctly describes the Fill/Full/Inserted cycle, but could benefit from a visual state diagram or a simplified table showing which transitions are valid at each step. This would reduce cognitive load for developers integrating this operation.

For example, a table like:

Current State  | Condition              | Next State | Action
Fill           | Accepting insertions   | Full       | When batch_size reached
Inserted       | Batch reused           | Fill       | After bloom filter zeroed
Full           | Not accepting new data | Error      | BatchNotReady

Based on learnings: Keep component documentation up to date with visual aids where appropriate.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 308268d and 70508a0.

📒 Files selected for processing (10)
  • program-libs/batched-merkle-tree/docs/CLAUDE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/INSERT_INPUT_QUEUE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md (1 hunks)
🧰 Additional context used
🧠 Learnings (27)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/CLAUDE.md : Maintain CLAUDE.md (this file) as the documentation structure guide for the compressed token program docs

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Include a CLAUDE.md in each relevant documentation directory that serves as the documentation structure guide for that directory

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Ensure the parent-level CLAUDE.md acts as the main entry point containing a summary and instruction index

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Use ../CLAUDE.md as the main entry point with summary and instruction index

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Each document should focus on a single module or concept

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Start with ../../CLAUDE.md for the instruction index and overview

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
📚 Learning: 2025-10-15T03:46:26.767Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/lib.rs : Load accounts according to type before check_forester: batched via BatchedMerkleTreeAccount::type_from_account_info(); regular via ctx.accounts.account.load()?.metadata; use custom deserialization when required.

Applied to files:

  • program-libs/batched-merkle-tree/docs/CLAUDE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/DISCRIMINATOR.md : DISCRIMINATOR.md must document 8-byte discriminators, the Discriminator trait, constant arrays for compile-time checks, and integration with account initialization

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_ITERATOR.md : ACCOUNT_ITERATOR.md must document the enhanced account iterator, including sequential processing, automatic validation, and location-based error reporting for debugging

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/instructions/CREATE_TOKEN_ACCOUNT.md : Provide CREATE_TOKEN_ACCOUNT.md in the instructions/ directory documenting create token account and associated token account instructions

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/PACKED_ACCOUNTS.md : PACKED_ACCOUNTS.md must document index-based dynamic account access, including accessing mint, owner, and delegate accounts by index with bounds checking

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/ACCOUNTS.md : Maintain ACCOUNTS.md with complete account layouts and data structures

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Document Create Token Account & Associated Token Account instructions in instructions/CREATE_TOKEN_ACCOUNT.md

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/docs/CONFIG_ACCOUNT.md : Document the CompressibleConfig account structure and methods in docs/CONFIG_ACCOUNT.md

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : On account initialization, call account_info_init to set the 8-byte discriminator

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
📚 Learning: 2025-10-15T03:46:26.767Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/lib.rs : Wrapper instruction handlers must: (1) load the target account metadata; (2) call check_forester with correct authority, target, forester PDA (optional), and computed work_units; (3) delegate via a CPI using a PDA signer.

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md
  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Refer to ../ACCOUNTS.md for account structure reference from instruction docs

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/src/create_associated_token_account.rs : Create Associated Token Account instruction must validate that the config state is ACTIVE only

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/src/create_token_account.rs : Create Token Account instruction must validate that the config state is ACTIVE only

Applied to files:

  • program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_INFO_TRAIT.md : ACCOUNT_INFO_TRAIT.md must document the AccountInfoTrait abstraction, including trait definition, implementations, and runtime-agnostic usage across Solana and Pinocchio

Applied to files:

  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/config.rs : Ensure serialization compatibility across Anchor, Pinocchio, and Borsh for core account types used by dependent programs

Applied to files:

  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : Validate account type with 8-byte discriminators using check_discriminator before deserialization

Applied to files:

  • program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md
📚 Learning: 2025-10-15T03:46:26.767Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/account_compression_cpi/*.rs : Context structs for wrapper instructions must include standard accounts: optional registered_forester_pda (mut), authority Signer, cpi_authority with seeds/bump for CPI_AUTHORITY_PDA_SEED, registered_program_pda, target program handle, log_wrapper, and mutable target_account.

Applied to files:

  • program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md
🪛 LanguageTool
program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md

[grammar] ~22-~22: Ensure spelling is correct
Context: ...trees: increments nullifier_next_index (offchain indexer tracking only) 6. Marks ZKP bat...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~85-~85: Ensure spelling is correct
Context: ...e proof verifies old_leaf value against onchain root, ensuring correct position - If ol...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~199-~199: Ensure spelling is correct
Context: ...nullifier_next_index by zkp_batch_size (offchain indexer tracking) - Address: Increme...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~235-~235: Ensure spelling is correct
Context: ..._index: Incremented by zkp_batch_size (offchain indexer tracking) - sequence_number`: ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md

[style] ~53-~53: This phrase is redundant. Consider writing “filled”.
Context: ... Fill (still being filled) or Full (completely filled) state 3. **Create public inputs hash:...

(COMPLETELY_ANNIHILATE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: Forester e2e test
  • GitHub Check: system-programs (native, ["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-t...
  • GitHub Check: system-programs (token test, ["cargo-test-sbf -p sdk-token-test"])
  • GitHub Check: system-programs (sdk-libs, light-sdk-macros light-sdk light-program-test light-client light-compr...
  • GitHub Check: system-programs (anchor & pinocchio, ["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk...
  • GitHub Check: programs (system-cpi-test-v2-functional-account-infos, ["cargo-test-sbf -p system-cpi-v2-test -- ...
  • GitHub Check: lint
  • GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
  • GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
  • GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "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, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • GitHub Check: programs (light-system-program-address, ["cargo-test-sbf -p system-test -- test_with_address", "c...
  • GitHub Check: stateless-js-v1
  • GitHub Check: Test program-libs-fast
  • GitHub Check: Test program-libs-slow
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: cli-v2
  • GitHub Check: stateless-js-v2
  • GitHub Check: cli-v1
🔇 Additional comments (14)
program-libs/batched-merkle-tree/docs/CLAUDE.md (1)

1-148: Excellent main entry point documentation.

CLAUDE.md serves as a well-structured guide to the Batched Merkle Tree Library with clear account hierarchy, operation flow, and cross-references to detailed documentation. The organization follows established documentation patterns with summary + index structure. All critical concepts are introduced with context.

program-libs/batched-merkle-tree/docs/INITIALIZE_ADDRESS_TREE.md (1)

1-101: Comprehensive address tree initialization documentation.

The documentation clearly differentiates address tree initialization (single account with integrated queue) from state tree initialization. Account layout, discriminator, and initialization sequence are well-documented with appropriate cross-references to source files and related documentation.

program-libs/batched-merkle-tree/docs/INSERT_INPUT_QUEUE.md (1)

1-97: Solid documentation of nullifier insertion with double-spend prevention.

The documentation clearly explains the two-batch bloom filter system for preventing double-spending. The nullifier creation logic and non-inclusion checks are well-explained. The note on line 43 appropriately clarifies the flexibility of nullifier values while maintaining the key requirement of preventing inclusion proofs.

program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md (1)

1-133: Well-structured state tree initialization documentation.

The documentation clearly explains the two-account structure (tree + output queue) with comprehensive initialization steps. Configuration validation rules are well-documented, particularly the root_history_capacity requirement accounting for both input and output queue operations. Discriminators and account types are properly specified.

program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md (1)

1-100: Complete queue account documentation with validation and serialization examples.

The documentation covers account structure, validation checks, serialization patterns for both on-chain and client code, and supporting data structures. The explanation of hashed pubkeys and bn254 field compatibility adds important context for understanding the zero-copy layout.

program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md (6)

122-150: Batch state machine documentation is clear, but verify against Batch struct implementation.

The state transitions (Fill → Full → Inserted → Fill) and the key insight about incremental ZKP processing (line 139) are well-explained. However, these should be verified to match the actual Batch struct and its methods to ensure forward compatibility.


60-84: Fix get_root_by_index usage in documentation example—method returns Option, not Result.

The method signature at line 858 shows get_root_by_index(&self, index: usize) -> Option<&[u8; 32]>, which returns an Option type. However, the documentation example at line 78 incorrectly uses the ? operator:

let root = tree.get_root_by_index(index)?;

The ? operator is for Result types, not Option. Update the example to handle the Option properly:

let root = tree.get_root_by_index(index);  // Returns Option<&[u8; 32]>

All other method signatures (state_from_account_info, address_from_account_info, state_from_bytes, address_from_bytes) are correctly documented and match their implementations.

⛔ Skipped due to learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Code examples should demonstrate both Solana and Pinocchio usage where applicable
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/lib.rs : Load accounts according to type before check_forester: batched via BatchedMerkleTreeAccount::type_from_account_info(); regular via ctx.accounts.account.load()?.metadata; use custom deserialization when required.
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/{solana.rs,pinocchio.rs,test_account_info.rs} : Gate SDK-specific implementations with #[cfg(feature = "solana"|"pinocchio"|"test-only")]
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/{solana.rs,pinocchio.rs,test_account_info.rs} : Provide SDK-specific AccountInfoTrait implementations in account_info/{solana.rs,pinocchio.rs,test_account_info.rs}
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/!(account_info)/**/*.rs : Use AccountInfoTrait for runtime-agnostic account handling; avoid direct solana-program or pinocchio AccountInfo in general logic
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/config.rs : Ensure serialization compatibility across Anchor, Pinocchio, and Borsh for core account types used by dependent programs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/packed_accounts.rs : For dynamic account sets, use PackedAccounts for index-based access with bounds checks instead of manual indexing
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/checks.rs : Expose and maintain account validation helpers (check_owner, check_program, check_mut/non_mut, check_signer, check_discriminator, set_discriminator, check_pda_seeds, check_account_balance_is_rent_exempt, account_info_init) in checks.rs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : Validate account type with 8-byte discriminators using check_discriminator before deserialization
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_iterator.rs : Use AccountIterator for sequential account retrieval to get precise file:line:column error locations; avoid manual index handling

50-54: No action required. The review comment is based on an incorrect assumption about documentation scope.

The code initialization is correct and already properly documented:

  • ADDRESS_TREE_INIT_ROOT_40 and next_index = 1 are correctly implemented in the code (merkle_tree.rs:298, merkle_tree_metadata.rs:104)
  • These initialization details are documented in INITIALIZE_ADDRESS_TREE.md: "Initial root: ADDRESS_TREE_INIT_ROOT_40" and "Starts at next_index: 1"
  • The TREE_ACCOUNT.md file (under review) accurately documents these same details

The review request for "consistency across INITIALIZE_ADDRESS_TREE.md and INSERT_ADDRESS_QUEUE.md" is based on a scope misunderstanding. INSERT_ADDRESS_QUEUE.md documents the queue insertion operation, not initialization. It should not duplicate initialization details—that belongs in INITIALIZE_ADDRESS_TREE.md, where it already exists correctly documented.

Likely an incorrect or invalid review comment.


24-40: Remove inaccurate bloom filter zeroing condition from documentation.

The phrase "and at least one batch update occured since batch completion" in line 29 is not enforced by the code. The actual condition is: previous batch fully inserted + bloom filter not yet zeroed + current batch reaches 50% capacity. This matches INSERT_ADDRESS_QUEUE.md, which correctly describes the zeroing as occurring "after the batch is fully inserted into the tree AND the next batch reaches 50% capacity" without the additional "batch update" requirement. Align TREE_ACCOUNT.md Section 3 with the accurate behavior.

Likely an incorrect or invalid review comment.


106-110: Correct error code mappings in TREE_ACCOUNT.md. The listed codes don't match AccountError definitions.

  • AccountError::AccountOwnedByWrongProgram maps to 20001, not 12012
  • AccountError::InvalidAccountSize maps to 20004, not 12006
  • AccountError::InvalidDiscriminator maps to 20000, not 12007
  • MerkleTreeMetadataError::InvalidTreeType maps to 14007 (currently unlisted)

Update lines 106-110 to reflect actual error code mappings from account-checks/src/error.rs and merkle-tree-metadata/src/errors.rs:

**Error codes:**
- `AccountError::AccountOwnedByWrongProgram` (20001) - Account not owned by compression program
- `AccountError::InvalidAccountSize` (20004) - Account size less than 8 bytes
- `AccountError::InvalidDiscriminator` (20000) - Discriminator mismatch
- `MerkleTreeMetadataError::InvalidTreeType` (14007) - Tree type mismatch (state vs address)
⛔ Skipped due to learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/error.rs : Maintain stable mapping of AccountError to ProgramError, including Pinocchio code mapping (1–11), in error.rs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : Return AccountError variants (codes 12006–12021) and rely on automatic ProgramError conversions; avoid returning raw ProgramError directly
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ERRORS.md : ERRORS.md must document error types with numeric codes in the 12006–12021 range, common causes, resolution strategies, and conversion mappings for Solana and Pinocchio
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ERRORS.md : Error codes should reference the actual values that appear in transaction logs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/error.rs : Define error types with numeric codes in the 19xxx range and propagate hasher errors in the 7xxx range; include ProgramError conversions (Anchor, Pinocchio, Solana) in src/error.rs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/ACCOUNTS.md : Maintain ACCOUNTS.md with complete account layouts and data structures
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Code examples should demonstrate both Solana and Pinocchio usage where applicable
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : Validate account type with 8-byte discriminators using check_discriminator before deserialization
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/account_compression_cpi/*.rs : Context structs for wrapper instructions must include standard accounts: optional registered_forester_pda (mut), authority Signer, cpi_authority with seeds/bump for CPI_AUTHORITY_PDA_SEED, registered_program_pda, target program handle, log_wrapper, and mutable target_account.
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Refer to ../ACCOUNTS.md for account structure reference from instruction docs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Use specific error variants for authorization and fee failures: InvalidSigner, InvalidNetworkFee, ForesterDefined/Undefined.

1-84: Fix incorrect tree type values and error codes in Account Validation section.

The Account Validation section contains two critical errors:

  1. Tree type values are incorrect (lines 100-102):

    • Document states: STATE_MERKLE_TREE_TYPE_V2 (4), ADDRESS_MERKLE_TREE_TYPE_V2 (5)
    • Actual values: STATE_MERKLE_TREE_TYPE_V2 = 3, ADDRESS_MERKLE_TREE_TYPE_V2 = 4
  2. Error codes are wrong (lines 107-109):

    • Document states: 12012, 12006, 12007
    • Actual values: AccountError::AccountOwnedByWrongProgram = 20001, InvalidAccountSize = 20004, InvalidDiscriminator = 20000

Update lines 100-102 to use correct numeric values (3 and 4), and lines 107-109 to use correct error codes (20001, 20004, 20000).

⛔ Skipped due to learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/DISCRIMINATOR.md : DISCRIMINATOR.md must document 8-byte discriminators, the Discriminator trait, constant arrays for compile-time checks, and integration with account initialization
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ERRORS.md : ERRORS.md must document error types with numeric codes in the 12006–12021 range, common causes, resolution strategies, and conversion mappings for Solana and Pinocchio
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/ACCOUNTS.md : Maintain ACCOUNTS.md with complete account layouts and data structures
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_ITERATOR.md : ACCOUNT_ITERATOR.md must document the enhanced account iterator, including sequential processing, automatic validation, and location-based error reporting for debugging
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/PACKED_ACCOUNTS.md : PACKED_ACCOUNTS.md must document index-based dynamic account access, including accessing mint, owner, and delegate accounts by index with bounds checking
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ERRORS.md : Error codes should reference the actual values that appear in transaction logs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_CHECKS.md : ACCOUNT_CHECKS.md must document all validation functions in the checks module, including ownership validation, permission checks, discriminator handling, and PDA verification with code examples
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/registry/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:26.767Z
Learning: Applies to programs/registry/src/lib.rs : Load accounts according to type before check_forester: batched via BatchedMerkleTreeAccount::type_from_account_info(); regular via ctx.accounts.account.load()?.metadata; use custom deserialization when required.
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/config.rs : Ensure serialization compatibility across Anchor, Pinocchio, and Borsh for core account types used by dependent programs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/**/*.rs : Validate account type with 8-byte discriminators using check_discriminator before deserialization
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Refer to ../ACCOUNTS.md for account structure reference from instruction docs
program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md (3)

72-96: No issues found—error codes and variants are accurate.

Verification confirms all referenced error codes match the BatchedMerkleTreeError enum mapping:

  • TreeIsFull → 14310 ✓
  • BatchNotReady → 14301 ✓
  • BloomFilterNotZeroed → 14312 ✓
  • NonInclusionCheckFailed → 14311 ✓

The documentation accurately reflects the actual implementation.


1-30: Method signature verified as accurate.

The implementation in src/merkle_tree.rs confirms the documented method signature is correct:

  • Method name: insert_address_into_queue
  • Parameter 1: address: &[u8; 32]
  • Parameter 2: current_slot: &u64

The documentation correctly reflects the actual implementation.


31-67: Documentation accurately describes the implementation.

The detailed operation logic described in lines 31-67 has been verified against the actual implementation:

  • Tree type validation, capacity check, and batch state management (Fill/Inserted/Full) all match
  • Bloom filter insertion and non-inclusion check (verifies value not in OTHER bloom filter) are correctly implemented
  • Hash chain updates use Poseidon as documented: Poseidon::hashv(&[last_hash_chain, value.as_slice()])
  • Element counter increments properly within the batch's internal state management
  • Batch full detection correctly triggers state transition via the zkp batch structure
  • Batch index advancement occurs via increment_currently_processing_batch_index_if_full()

- Add comprehensive review instructions for batched Merkle tree documentation consistency
- Ensure documentation accuracy matches implementation in program-libs/batched-merkle-tree/
- Include specific path instructions for critical components (account-compression, Cargo.toml)
- Enable automated tools (clippy, eslint, ruff, gitleaks) for code quality
- Configure sensitive file patterns for comprehensive reviews
- Add cross-verification requirements between code and documentation changes

This configuration helps maintain documentation accuracy and prevents drift between
documented API/behavior and actual implementation, especially for the batched
Merkle tree functionality that has undergone recent critical bug fixes.
…rategy

- Remove incorrect develop/staging branches (Light Protocol uses main + release branches)
- Add dependabot exclusions to prevent unnecessary reviews of dependency updates
- Extend documentation consistency checks to all program-libs crates with docs/
- Add comprehensive path instructions for account-checks and compressible crates
- Include CLAUDE.md files in documentation consistency verification
- Add pre-merge checks for documentation consistency
- Configure chat integrations and enhanced knowledge base features
- Add sensitive file patterns for comprehensive review coverage
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17fa754 and f0cb3c4.

📒 Files selected for processing (1)
  • .coderabbit.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Code examples should demonstrate both Solana and Pinocchio usage where applicable
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_ITERATOR.md : ACCOUNT_ITERATOR.md must document the enhanced account iterator, including sequential processing, automatic validation, and location-based error reporting for debugging
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_CHECKS.md : ACCOUNT_CHECKS.md must document all validation functions in the checks module, including ownership validation, permission checks, discriminator handling, and PDA verification with code examples
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/docs/CONFIG_ACCOUNT.md : Document the CompressibleConfig account structure and methods in docs/CONFIG_ACCOUNT.md
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/DISCRIMINATOR.md : DISCRIMINATOR.md must document 8-byte discriminators, the Discriminator trait, constant arrays for compile-time checks, and integration with account initialization
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Each document should focus on a single module or concept
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_INFO_TRAIT.md : ACCOUNT_INFO_TRAIT.md must document the AccountInfoTrait abstraction, including trait definition, implementations, and runtime-agnostic usage across Solana and Pinocchio
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: Test program-libs-slow
  • GitHub Check: Test program-libs-fast
  • GitHub Check: Forester e2e test
  • GitHub Check: system-programs (sdk-libs, light-sdk-macros light-sdk light-program-test light-client light-compr...
  • GitHub Check: system-programs (token test, ["cargo-test-sbf -p sdk-token-test"])
  • GitHub Check: system-programs (native, ["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-t...
  • GitHub Check: system-programs (anchor & pinocchio, ["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk...
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "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: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
  • 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 (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
  • GitHub Check: stateless-js-v2
  • GitHub Check: cli-v2
  • GitHub Check: stateless-js-v1
  • GitHub Check: lint
  • GitHub Check: cli-v1
🔇 Additional comments (2)
.coderabbit.yaml (2)

1-241: Configuration structure aligns well with documentation consistency goals.

The overall structure is well-designed for enforcing documentation/code cross-verification, with targeted path instructions for:

  • Batched Merkle Tree (lines 25-46): strong focus on docs-to-code accuracy
  • Account Checks (lines 49-63): validation function and security pattern consistency
  • Compressible (lines 66-80): compression API and trait alignment
  • General library documentation (lines 108-126): cross-verification patterns

The pre-merge checks (lines 150-169) and path-specific instructions align with learnings about maintaining documentation consistency. The configuration supports the PR's documentation update goals. Once the two structural issues above are resolved, this configuration should work effectively. Based on learnings

Once the early_access field is corrected to a boolean, please verify that sensitive_files is either removed or confirmed to be a supported extension before merging.


247-257: Remove the unsupported sensitive_files section; use path_filters instead to control review scope.

The CodeRabbit configuration reference (last updated November 4, 2025) does not include a sensitive_files field. Path-based instructions within the configuration provide specific additional guidelines for code review based on file paths, and path-based instructions are configured in the .coderabbit.yaml file under the reviews.path_instructions section. The file already uses path_filters (lines 8-20) which is the official way to control which files CodeRabbit reviews. Remove the sensitive_files block (lines 247-257) as it will be ignored by CodeRabbit and serves no purpose.

…tive paths in circuit implementation references

- Changed absolute paths like /Users/ananas/dev/light-protocol/ to relative paths
- Improves documentation portability across development environments
- Addresses CodeRabbit comment about absolute file path references
…ive path and remove redundant phrase

- Changed absolute path /Users/ananas/dev/light-protocol/ to relative path for portability
- Removed redundant phrase 'completely filled' as it's implied by 'Full' state
- Addresses CodeRabbit comments about absolute file paths and redundant wording
…a validation error

- Changed early_access from object with 'enabled: true' to boolean 'true'
- Fixes critical schema validation error in CodeRabbit configuration
- Addresses CodeRabbit comment about YAML schema compliance
…escription

- Improved awkward phrasing from 'is the leaf index of the value up on Merkle tree insertion'
- Changed to clearer description: 'Assigned at insertion time and determines the leaf position in the tree'
- Addresses CodeRabbit comment about unclear documentation wording
…es section

- Removed sensitive_files section as it's not supported in CodeRabbit schema
- Path-based review control is already handled by path_filters section
- Addresses CodeRabbit comment about unsupported configuration fields
…bloom filter zeroing

- Added missing condition 'at least one batch update has occurred since batch completion'
- Makes INSERT_ADDRESS_QUEUE.md consistent with TREE_ACCOUNT.md and UPDATE_FROM_OUTPUT_QUEUE.md
- Addresses CodeRabbit comment about incomplete bloom filter zeroing documentation
- Corrects previous assessment - this was a valid documentation inconsistency
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

📜 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 f0cb3c4 and b3f0947.

⛔ Files ignored due to path filters (1)
  • .coderabbit.yaml is excluded by none and included by none
📒 Files selected for processing (4)
  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md (1 hunks)
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
program-libs/batched-merkle-tree/docs/**/*.md

⚙️ CodeRabbit configuration file

program-libs/batched-merkle-tree/docs/**/*.md: When reviewing batched Merkle tree documentation changes:

  1. Critical: Verify that all function signatures, struct definitions, and behavior described in the documentation accurately match the actual implementation in program-libs/batched-merkle-tree/src/
  2. Cross-reference any mentioned function names, parameters, return types, and error conditions with the source code
  3. Check that code examples and usage patterns reflect the current API in the crate
  4. Validate that any referenced constants, enums, or type definitions exist and have correct values
  5. Ensure documentation describes the actual behavior, not outdated or planned behavior
  6. Flag any references to deprecated functions, renamed structs, or changed interfaces
  7. Verify that error handling and edge cases mentioned in docs match the implementation
  8. Check that performance characteristics and complexity claims are accurate

Files:

  • program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md
program-libs/**/docs/**/*.md

⚙️ CodeRabbit configuration file

program-libs/**/docs/**/*.md: When reviewing program library documentation:

  1. Cross-verification: Always verify documented APIs against actual implementation in the corresponding src/ directory
  2. Check that function signatures, struct definitions, and trait implementations match documentation
  3. Validate that error types, constants, and enums referenced in docs exist and have correct values
  4. Ensure that usage examples compile and work as described
  5. Flag any references to deprecated or renamed items
  6. Verify that performance claims and complexity analysis are accurate

Files:

  • program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md
**/*.md

⚙️ CodeRabbit configuration file

**/*.md: When reviewing general documentation changes:

  1. Verify that all source code references exist and are accurate
  2. Check that code examples compile and work as described
  3. Validate that GitHub URLs and file paths are correct and accessible
  4. Ensure consistency with the overall documentation structure
  5. Check for broken internal links and references

Files:

  • program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md
  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md
🧠 Learnings (4)
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed

Applied to files:

  • program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/PACKED_ACCOUNTS.md : PACKED_ACCOUNTS.md must document index-based dynamic account access, including accessing mint, owner, and delegate accounts by index with bounds checking

Applied to files:

  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/ACCOUNTS.md : Maintain ACCOUNTS.md with complete account layouts and data structures

Applied to files:

  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions

Applied to files:

  • program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md
🪛 LanguageTool
program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md

[duplication] ~77-~77: Possible typo: you repeated a word.
Context: ...: Updates running Poseidon hash for ZKP batch - Batch metadata: - num_inserted_elements: ...

(ENGLISH_WORD_REPEAT_RULE)


[grammar] ~81-~81: Use the plural noun, or add a word such as ‘the’ or ‘some’ in front of ‘other’.
Context: ..._processing_batch_index: May switch to other batch - pending_batch_index`: Updated when...

(OTHER_NN)

program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md

[grammar] ~22-~22: Ensure spelling is correct
Context: ...trees: increments nullifier_next_index (offchain indexer tracking only) 6. Marks ZKP bat...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~85-~85: Ensure spelling is correct
Context: ...e proof verifies old_leaf value against onchain root, ensuring correct position - If ol...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~199-~199: Ensure spelling is correct
Context: ...nullifier_next_index by zkp_batch_size (offchain indexer tracking) - Address: Increme...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~235-~235: Ensure spelling is correct
Context: ..._index: Incremented by zkp_batch_size (offchain indexer tracking) - sequence_number`: ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: programs (system-cpi-test-v2-functional-read-only, ["cargo-test-sbf -p system-cpi-v2-test -- func...
  • GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
  • GitHub Check: programs (system-cpi-test-v2-functional-account-infos, ["cargo-test-sbf -p system-cpi-v2-test -- ...
  • GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • 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 (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "cargo-...
  • GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
  • GitHub Check: Test program-libs-slow
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: Test program-libs-fast
  • GitHub Check: Forester e2e test
  • GitHub Check: cli-v1
  • GitHub Check: stateless-js-v1
🔇 Additional comments (3)
program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md (1)

1-191: Comprehensive documentation with past issue fixed.

The documentation correctly uses relative paths for circuit implementations (line 8) and provides detailed explanation of the bloom filter zeroing logic. The file demonstrates good cross-references to related documentation files and consistent error code patterns.

program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md (2)

5-7: Bloom filter zeroing condition comprehensively documented.

The documentation now correctly includes all three required conditions for bloom filter zeroing: batch fully inserted, next batch at 50% capacity, and at least one batch update since completion. This properly addresses the previous review feedback and maintains consistency with related documentation.


17-17: All documented APIs and error codes verified successfully.

All items have been confirmed to exist in the implementation:

  • BatchedMerkleTreeAccount::insert_address_into_queue ✓ public method in merkle_tree.rs
  • MerkleTreeMetadataError::InvalidTreeType ✓ variant defined
  • BatchedMerkleTreeError::TreeIsFull ✓ variant with code 14310
  • BatchedMerkleTreeError::BatchNotReady ✓ variant with code 14301
  • BatchedMerkleTreeError::BloomFilterNotZeroed ✓ variant with code 14312
  • BatchedMerkleTreeError::NonInclusionCheckFailed ✓ variant with code 14311

All error variants are properly mapped in the From<BatchedMerkleTreeError> for u32 implementation in errors.rs, and all variants are actively used throughout the codebase.

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

📜 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 b3f0947 and 705e8ff.

📒 Files selected for processing (1)
  • CLAUDE.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/CLAUDE.md

⚙️ CodeRabbit configuration file

**/CLAUDE.md: When reviewing CLAUDE.md files:

  1. Verify that all documented APIs, functions, and structures exist in the corresponding crate
  2. Check that AI assistant guidance reflects current implementation patterns
  3. Ensure that documented workflows and examples are up-to-date
  4. Validate that referenced file paths and module structures are correct
  5. Cross-reference any code snippets with actual implementation

Files:

  • CLAUDE.md
**/*.md

⚙️ CodeRabbit configuration file

**/*.md: When reviewing general documentation changes:

  1. Verify that all source code references exist and are accurate
  2. Check that code examples compile and work as described
  3. Validate that GitHub URLs and file paths are correct and accessible
  4. Ensure consistency with the overall documentation structure
  5. Check for broken internal links and references

Files:

  • CLAUDE.md
🧠 Learnings (16)
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/CLAUDE.md : Maintain CLAUDE.md (this file) as the documentation structure guide for the compressed token program docs

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Include a CLAUDE.md in each relevant documentation directory that serves as the documentation structure guide for that directory

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Ensure the parent-level CLAUDE.md acts as the main entry point containing a summary and instruction index

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Use ../CLAUDE.md as the main entry point with summary and instruction index

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Start with ../../CLAUDE.md for the instruction index and overview

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Start navigation at the parent CLAUDE.md for the instruction index and overview

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/docs/SOLANA_RENT.md : Maintain a comparison of Solana vs Light Protocol rent systems in docs/SOLANA_RENT.md

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Code examples should demonstrate both Solana and Pinocchio usage where applicable

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/program-libs/ctoken-types/** : Define all state and instruction data structures in the light-ctoken-types crate (program-libs/ctoken-types), including state/, instructions/, and state/extensions/

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/ACCOUNTS.md : Maintain ACCOUNTS.md with complete account layouts and data structures

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: When working with ctoken accounts that have the Compressible extension, consult the rent system documentation (RENT.md, CONFIG_ACCOUNT.md, SOLANA_RENT.md) to follow rent authority, compression, and lamport distribution rules

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Read this file and all referenced Markdown files in full before working on the compressed-token program

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/{solana.rs,pinocchio.rs,test_account_info.rs} : Gate SDK-specific implementations with #[cfg(feature = "solana"|"pinocchio"|"test-only")]

Applied to files:

  • CLAUDE.md
🪛 LanguageTool
CLAUDE.md

[duplication] ~67-~67: Possible typo: you repeated a word.
Context: ...lient** creates compressed accounts via SDK 2. SDK builds instructions using program-lib...

(ENGLISH_WORD_REPEAT_RULE)

🪛 markdownlint-cli2 (0.18.1)
CLAUDE.md

12-12: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


50-50: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


76-76: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


77-77: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


91-91: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


92-92: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


111-111: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


118-118: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


124-124: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


132-132: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


137-137: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


145-145: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


151-151: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


156-156: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: stateless-js-v1
  • GitHub Check: system-programs (anchor & pinocchio, ["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk...
  • GitHub Check: system-programs (sdk-libs, light-sdk-macros light-sdk light-program-test light-client light-compr...
  • GitHub Check: system-programs (token test, ["cargo-test-sbf -p sdk-token-test"])
  • GitHub Check: system-programs (native, ["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-t...
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: Test program-libs-slow
  • GitHub Check: Test program-libs-fast
  • GitHub Check: stateless-js-v2
  • GitHub Check: cli-v2
  • GitHub Check: Forester e2e test
  • GitHub Check: programs (system-cpi-test-v2-functional-account-infos, ["cargo-test-sbf -p system-cpi-v2-test -- ...
  • GitHub Check: programs (system-cpi-test-v2-functional-read-only, ["cargo-test-sbf -p system-cpi-v2-test -- func...
  • GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "cargo-...
  • GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
  • GitHub Check: programs (light-system-program-address, ["cargo-test-sbf -p system-test -- test_with_address", "c...
  • GitHub Check: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
  • GitHub Check: cli-v1
  • GitHub Check: lint
🔇 Additional comments (2)
CLAUDE.md (2)

124-141: All referenced file paths, crate names, and error code ranges in the CLAUDE.md snippet have been verified as accurate:

  • program-libs/batched-merkle-tree/src/merkle_tree.rs
  • program-libs/verifier/src/lib.rs
  • programs/system/src/lib.rs
  • programs/account-compression/src/processor/
  • sdk-libs/sdk/src/lib.rs
  • sdk-libs/client/src/rpc/mod.rs
  • ✓ Crate names: light-account-checks, light-verifier, light-batched-merkle-tree, light-zero-copy
  • ✓ Error code ranges (14301-14312) properly documented in program-libs/batched-merkle-tree/src/errors.rs

The documentation accurately reflects the current repository structure and is consistent with the CLAUDE.md guidelines.


156-161: All commands and tool references are accurate.

Verification confirms that the quick reference section correctly documents the testing tools and commands:

  • light test-validator is a real command from the globally-installed Light CLI (documented in cli/README.md)
  • light-program-test is the correct package name (located at sdk-libs/program-test, version 0.16.0)
  • LiteSVM is accurately referenced as the testing framework used by the package

The documentation in CLAUDE.md lines 156-161 is accurate and up-to-date.

- Repository overview with core technologies and architecture
- Complete directory structure with component purposes
- Component relationship diagram and data flow
- Development workflow with build, test, and code generation commands
- AI assistant guidelines with code patterns and navigation
- Key files for understanding subsystems and debugging
- Quick reference for frequently modified files and configuration
- Links to detailed component documentation

Provides AI assistants with essential context about Light Protocol
codebase structure, enabling efficient navigation and development
assistance across the ZK compression protocol implementation.
@ananas-block ananas-block force-pushed the jorrit/documentation-updates branch from 705e8ff to 44c9cf0 Compare November 11, 2025 00:30
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: 4

♻️ Duplicate comments (2)
CLAUDE.md (2)

74-98: Add blank lines around headings per markdown standards.

Multiple headings in the Development Workflow section lack required blank lines (MD022). Apply this pattern to "### Build Commands" and other subsections:

 ## Development Workflow

 ### Build Commands
+
 ```bash

Apply the same fix to:

  • Line 82: "### Testing Patterns"
  • Line 88: "#### 1. Unit Tests (program-libs/)"
  • Lines 104, 122, 135, 153, 172, and 184 for other section headings

13-55: Add language specifier to directory structure code fence.

The fenced code block lacks a language identifier. Since this is a directory tree (text content), add text to enable proper syntax highlighting and comply with markdown standards.

-```
+```text
 light-protocol/
📜 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 705e8ff and 44c9cf0.

⛔ Files ignored due to path filters (3)
  • .coderabbit.yaml is excluded by none and included by none
  • program-tests/CLAUDE.md is excluded by none and included by none
  • sdk-tests/CLAUDE.md is excluded by none and included by none
📒 Files selected for processing (2)
  • CLAUDE.md (1 hunks)
  • DOCS.md (1 hunks)
🧰 Additional context used
🧠 Learnings (28)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_ITERATOR.md : ACCOUNT_ITERATOR.md must document the enhanced account iterator, including sequential processing, automatic validation, and location-based error reporting for debugging
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/PACKED_ACCOUNTS.md : PACKED_ACCOUNTS.md must document index-based dynamic account access, including accessing mint, owner, and delegate accounts by index with bounds checking
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/docs/CONFIG_ACCOUNT.md : Document the CompressibleConfig account structure and methods in docs/CONFIG_ACCOUNT.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Include a CLAUDE.md in each relevant documentation directory that serves as the documentation structure guide for that directory

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/CLAUDE.md : Maintain CLAUDE.md (this file) as the documentation structure guide for the compressed token program docs

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Ensure the parent-level CLAUDE.md acts as the main entry point containing a summary and instruction index

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Each document should focus on a single module or concept

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Use ../CLAUDE.md as the main entry point with summary and instruction index

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/DISCRIMINATOR.md : DISCRIMINATOR.md must document 8-byte discriminators, the Discriminator trait, constant arrays for compile-time checks, and integration with account initialization

Applied to files:

  • DOCS.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Start with ../../CLAUDE.md for the instruction index and overview

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Include cross-references that link related concepts across documents

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ACCOUNT_CHECKS.md : ACCOUNT_CHECKS.md must document all validation functions in the checks module, including ownership validation, permission checks, discriminator handling, and PDA verification with code examples

Applied to files:

  • DOCS.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Code examples should demonstrate both Solana and Pinocchio usage where applicable

Applied to files:

  • DOCS.md
  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions

Applied to files:

  • DOCS.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/instructions/*.md : Every instruction description must include: path, description, instruction_data (code paths), Accounts (order and checks), instruction logic and checks, and Errors (with causes)

Applied to files:

  • DOCS.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md

Applied to files:

  • DOCS.md
📚 Learning: 2025-10-15T03:46:03.556Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/{CREATE_TOKEN_ACCOUNT,MINT_ACTION,TRANSFER2,CLAIM,CLOSE_TOKEN_ACCOUNT,DECOMPRESSED_TRANSFER,WITHDRAW_FUNDING_POOL}.md : Every instruction description must include sections: path, description, instruction_data, Accounts, instruction logic and checks, Errors

Applied to files:

  • DOCS.md
📚 Learning: 2025-10-11T21:59:52.712Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/ERRORS.md : ERRORS.md must document error types with numeric codes in the 12006–12021 range, common causes, resolution strategies, and conversion mappings for Solana and Pinocchio

Applied to files:

  • DOCS.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Start navigation at the parent CLAUDE.md for the instruction index and overview

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:45:40.038Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/ACCOUNTS.md : Maintain ACCOUNTS.md with complete account layouts and data structures

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/{solana.rs,pinocchio.rs,test_account_info.rs} : Gate SDK-specific implementations with #[cfg(feature = "solana"|"pinocchio"|"test-only")]

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:46:43.242Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-token-test/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:43.242Z
Learning: Applies to sdk-tests/sdk-token-test/**/tests/**/*.rs : Every test should only contain functional integration tests

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/**/Cargo.toml : Define features solana, pinocchio, and test-only in Cargo.toml; default build should enable none

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:55.362Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/program-libs/ctoken-types/** : Define all state and instruction data structures in the light-ctoken-types crate (program-libs/ctoken-types), including state/, instructions/, and state/extensions/

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/docs/SOLANA_RENT.md : Maintain a comparison of Solana vs Light Protocol rent systems in docs/SOLANA_RENT.md

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/account_info/{solana.rs,pinocchio.rs,test_account_info.rs} : Provide SDK-specific AccountInfoTrait implementations in account_info/{solana.rs,pinocchio.rs,test_account_info.rs}

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-15T03:46:43.242Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-token-test/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:43.242Z
Learning: Run tests with: cargo test-sbf -p sdk-token-test --test <test-file-name>

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-11T21:59:25.222Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/src/!(account_info)/**/*.rs : Use AccountInfoTrait for runtime-agnostic account handling; avoid direct solana-program or pinocchio AccountInfo in general logic

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-10-16T06:33:19.426Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/compressible/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:19.426Z
Learning: Applies to program-libs/compressible/src/config.rs : Ensure serialization compatibility across Anchor, Pinocchio, and Borsh for core account types used by dependent programs

Applied to files:

  • CLAUDE.md
🪛 LanguageTool
DOCS.md

[uncategorized] ~38-~38: Possible missing comma found.
Context: ...es** - Shared data structures For each module include: - File/directory name - Brief ...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~46-~46: Do not use a colon (:) before a series that is introduced by a preposition (‘with’). Remove the colon or add a noun or a noun phrase after the preposition.
Context: ...s extensive, create a docs/ directory with: - CLAUDE.md - Navigation guide for th...

(RP_COLON)


[grammar] ~101-~101: Collocation: With the noun “changes”, you should use the verb “make”.
Context: ...rate section): - What the instruction does - Key state changes - Usage scenari...

(MAKE_A_CHANGE)


[misspelling] ~132-~132: This word is normally spelled as one.
Context: ...s** - Attack vectors and mitigations Anti-patterns to avoid: - Generic performance optim...

(EN_COMPOUNDS_ANTI_PATTERNS)

CLAUDE.md

[duplication] ~153-~153: Possible typo: you repeated a word.
Context: ...s in js/ directory #### 5. Go Prover Tests Tests for the ZK proof generation server (Gna...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~195-~195: Loose punctuation mark.
Context: ...zation Principles - program-libs/: Pure Rust libraries, unit tests with `c...

(UNLIKELY_OPENING_PUNCTUATION)

🪛 markdownlint-cli2 (0.18.1)
CLAUDE.md

5-5: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


45-45: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


186-186: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


192-192: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: stateless-js-v1
  • GitHub Check: Forester e2e test
  • GitHub Check: lint
  • GitHub Check: system-programs (token test, ["cargo-test-sbf -p sdk-token-test"])
  • GitHub Check: system-programs (anchor & pinocchio, ["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk...
  • GitHub Check: system-programs (sdk-libs, light-sdk-macros light-sdk light-program-test light-client light-compr...
  • GitHub Check: 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: Test batched-merkle-tree-simulate
  • GitHub Check: Test program-libs-slow
  • GitHub Check: stateless-js-v2
  • GitHub Check: cli-v1
  • GitHub Check: cli-v2
  • GitHub Check: programs (light-system-program-compression, ["cargo-test-sbf -p system-test -- test_with_compress...
  • GitHub Check: programs (compressed-token-and-e2e, ["cargo-test-sbf -p compressed-token-test --test v1", "cargo-...
  • GitHub Check: programs (system-cpi-test, ["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-prog...
  • GitHub Check: programs (system-cpi-test-v2-functional-read-only, ["cargo-test-sbf -p system-cpi-v2-test -- func...
  • GitHub Check: programs (account-compression-and-registry, ["cargo-test-sbf -p account-compression-test", "cargo...
  • 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: programs (compressed-token-batched-tree, ["cargo-test-sbf -p compressed-token-test -- test_transf...
🔇 Additional comments (1)
DOCS.md (1)

1-225: Strong documentation guidelines aligned with repository standards.

This comprehensive guidelines document provides clear, actionable requirements for documentation across the codebase. The structure—covering crate documentation, topic-specific documentation (accounts, instructions, errors, serialization, CPI), and documentation standards—mirrors established patterns documented in learnings and aligns well with the repository's CLAUDE.md structure requirements.

Strengths:

  • Clear required vs. optional sections for each document type
  • Specific guidance on error codes, account layouts, and instruction documentation
  • Practical examples referencing actual repository locations
  • Anti-patterns section helps writers avoid common pitfalls
  • Code examples show both correct usage and context

This creates a strong foundation for maintaining consistent, high-quality documentation as new crates and features are added. The guidelines should be referenced in repository onboarding and CI/CD documentation to ensure adoption.

Consider adding this file to a central documentation index or linking it from the root README.md so contributors discover it early. Per learnings, CLAUDE.md files serve as navigation guides—this file extends that pattern repository-wide.

⛔ Skipped due to learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Include a CLAUDE.md in each relevant documentation directory that serves as the documentation structure guide for that directory
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/CLAUDE.md : Maintain CLAUDE.md (this file) as the documentation structure guide for the compressed token program docs
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Each document should focus on a single module or concept
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:52.712Z
Learning: Applies to program-libs/account-checks/docs/**/{ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,DISCRIMINATOR.md,ERRORS.md,PACKED_ACCOUNTS.md} : Code examples should demonstrate both Solana and Pinocchio usage where applicable
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : Account documentation must include: description, discriminator, state layout, serialization example, hashing (only for compressed accounts), derivation (only for PDAs), and associated instructions
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-10-16T06:33:55.362Z
Learning: Applies to programs/compressed-token/program/docs/instructions/*.md : Every instruction description must include: path, description, instruction_data (code paths), Accounts (order and checks), instruction logic and checks, and Errors (with causes)
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/{CREATE_TOKEN_ACCOUNT,MINT_ACTION,TRANSFER2,CLAIM,CLOSE_TOKEN_ACCOUNT,DECOMPRESSED_TRANSFER,WITHDRAW_FUNDING_POOL}.md : Every instruction description must include sections: path, description, instruction_data, Accounts, instruction logic and checks, Errors
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:45:40.038Z
Learning: Applies to programs/compressed-token/program/docs/**/CLAUDE.md : Ensure the parent-level CLAUDE.md acts as the main entry point containing a summary and instruction index
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-10-15T03:46:03.556Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : Provide complete account layouts and data structures in ACCOUNTS.md
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/CLAUDE.md:0-0
Timestamp: 2025-10-11T21:59:25.222Z
Learning: Applies to program-libs/account-checks/docs/{CLAUDE.md,ACCOUNT_INFO_TRAIT.md,ACCOUNT_CHECKS.md,ACCOUNT_ITERATOR.md,ERRORS.md,DISCRIMINATOR.md,PACKED_ACCOUNTS.md} : Keep component documentation up to date in the corresponding docs/*.md files listed

@ananas-block ananas-block merged commit f8325e2 into main Nov 11, 2025
32 checks passed
@ananas-block ananas-block deleted the jorrit/documentation-updates branch November 11, 2025 01:15
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.

3 participants