Skip to content

chore: update streaming pages, update router pages, add pinocchio guide#24

Merged
SwenSchaeferjohann merged 7 commits intomainfrom
swen/upd-streaming
Feb 10, 2026
Merged

chore: update streaming pages, update router pages, add pinocchio guide#24
SwenSchaeferjohann merged 7 commits intomainfrom
swen/upd-streaming

Conversation

@SwenSchaeferjohann
Copy link
Contributor

@SwenSchaeferjohann SwenSchaeferjohann commented Feb 10, 2026

Summary by CodeRabbit

  • New Features

    • Pinocchio rent-free account integration guide added for DeFi programs.
    • Cold/inactive account detection and cold-account load workflows introduced.
    • New Data Streaming toolkit for PDAs with dual-subscription streaming patterns.
  • Documentation

    • Navigation restructured: Streaming pages moved into a new Data Streaming section; Toolkits trimmed to wallet-focused content.
    • Streaming token and mint guides overhauled with architecture, parsing, and detection steps.
    • DeFi docs updated with explicit cold-vs-hot flows and load-instruction guidance.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

This PR reorganizes Light Token docs navigation, adds a Pinocchio DeFi program guide, and updates streaming/cold-account handling docs and snippets while documenting public API changes to AmmSdk / LightProgramInterface and the runtime cold->hot load-instruction flow.

Changes

Cohort / File(s) Summary
Navigation
docs.json
Added DeFi entry programs-pinocchio and a new "Data Streaming" nav group; removed streaming pages from the Toolkits group.
Pinocchio Program Guide
light-token/defi/programs-pinocchio.mdx
New MDX guide describing Pinocchio rent-free account integration, initialization steps, SDK examples, CPIs, testing, and end-to-end flows.
Amm SDK & Program API docs
light-token/defi/programs.mdx
Documented public API signature changes: AmmSdk fields made public; LightProgramInterface redesigned (static program_id, removed from_keyed_accounts/update/get_specs_for_instruction; added instruction_accounts and load_specs); tests updated to use AmmSdk::new and new load-instruction flow.
Router / Cold-Hot Flow
light-token/defi/routers.mdx, snippets/code-snippets/streaming/find-closed-accounts.mdx
Introduced cold_cache and ColdContext handling, dual subscription pattern (accounts + transactions), find_closed_accounts logic, and guidance to prepend load instructions for cold accounts via load_specs.
Streaming Toolkits — Tokens & Mints
light-token/toolkits/for-streaming-tokens.mdx, light-token/toolkits/for-streaming-mints.mdx
Reworked token/mint streaming guides to two-subscription architecture, refined parsing and cache transitions, renamed front-matter/card titles, and swapped in FindClosedAccounts snippet.
Streaming Toolkits — PDAs & Overview
light-token/toolkits/for-streaming-pdas.mdx, light-token/toolkits/overview.mdx
Added PDAs streaming guide; removed legacy "Streaming Mints/Tokens" cards from overview.
Code Snippets & Minor Edits
snippets/code-samples/code-compare-snippets.jsx
Minor formatting reflow only.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Indexer as Indexer (stream)
    participant Cache as Hot/Cold Cache
    participant RPC as RPC/Node

    Client->>Indexer: Subscribe accounts & transactions
    Indexer-->>Client: Stream account updates (hot)
    Client->>Cache: store/update hot state

    Indexer-->>Client: Stream transaction (detect closed accounts)
    Client->>Client: run find_closed_accounts(tx)
    Client->>Cache: move closed pubkey -> cold_cache
    Client->>RPC: get_account_interface(pubkey) for cold accounts
    Client->>Client: load_specs(cold_accounts) -> AccountSpec[]
    Client->>RPC: create_load_instructions(AccountSpec[])
    Client->>RPC: send tx with prepended load instructions + action

    Indexer-->>Client: Account reactivated (cold->hot)
    Client->>Cache: move to hot cache
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇 I hopped through docs to mend the stream,

Cold keys tucked, hot states gleam.
Pinocchio seats set in a row,
Load instructions ready to go.
Hooray — the router hums, the caches beam!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the three main changes: streaming pages updates, router pages updates, and adding a Pinocchio guide documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch swen/upd-streaming

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

❤️ Share

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

Copy link

@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: 6

🤖 Fix all issues with AI agents
In `@light-token/defi/programs-pinocchio.mdx`:
- Line 139: Fix the typo in the sentence referencing the init instruction:
change "you init instruction" to "your init instruction" and ensure the sentence
reads clearly (e.g., "Update your init instruction. Use `light_token_pinocchio`
CPI builders to create rent-free token accounts."). Locate the sentence
mentioning the init instruction and the `light_token_pinocchio` CPI builders in
the program documentation and update the wording accordingly.

In `@light-token/defi/routers.mdx`:
- Line 21: Fix the minor typo in the sentence "this can be separate from your
regular account cache." by capitalizing the first letter: change "this" to
"This" in the routers.mdx content so the sentence begins with a capital letter.
- Line 99: The short example passes payer directly to create_load_instructions
but the full example uses payer.pubkey(); update the short example to pass the
same type expected by create_load_instructions (use payer.pubkey() if it expects
a Pubkey) so the argument form is consistent with the full example and the
function signature (refer to create_load_instructions and payer.pubkey()).
- Around line 214-215: Replace the incorrect proof-of-work term "miners" with
Solana-appropriate terminology such as "validators" in the sentence that
currently reads "miners compress them onto the Solana ledger" (search for the
string "miners compress them onto the Solana ledger" in routers.mdx); update the
phrasing so it reads e.g. "validators compress them onto the Solana ledger" or
"validators prune/compress them onto the Solana ledger" to keep meaning intact
and accurate.
- Around line 38-51: The example spawns an async task that clones rpc but
captures cold_cache by move, which will cause a move-once compile error; ensure
cold_cache is shared (e.g., wrapped in Arc—Arc<DashMap<...>> or Arc<Mutex<...>>)
and clone it before the tokio::spawn call (same pattern used for rpc) so each
iteration uses cold_cache.clone() inside the loop; update the snippet around
find_closed_accounts, the for pubkey loop, and the tokio::spawn closure to use
the cloned cold_cache and document the expected cold_cache type.

In `@light-token/toolkits/for-streaming-pdas.mdx`:
- Around line 130-147: The snippet uses return; inside the
UpdateOneof::Transaction arm which will exit the enclosing function; change that
to continue (to skip processing this stream event and proceed to the next loop
iteration) or a no-op block if the surrounding context isn't a loop;
specifically replace the return; after the has_compress_instruction(tx_info)
check so when has_compress_instruction(tx_info) is false you skip further
handling of tx_update rather than exiting the function—update the match arm
around UpdateOneof::Transaction / tx_update and ensure subsequent logic that
moves entries from cache to cold_cache remains reachable only when
has_compress_instruction(tx_info) is true.
🧹 Nitpick comments (7)
light-token/defi/programs.mdx (1)

460-478: Undeclared identifiers in test snippet may confuse readers.

config_pda (line 475) and payer (lines 475, 478) are used but never declared or commented as omitted in this test example. Consider adding a comment like // ... (payer, config_pda setup omitted) near the top of the test, similar to how Step 1/2 are annotated.

light-token/defi/programs-pinocchio.mdx (1)

346-361: AccountSpec::Pda used for token vaults here vs AccountSpec::Token in the Anchor guide.

In programs.mdx (line 419–420), token vaults are pushed as AccountSpec::Token(account.clone()). Here, token_a_vault is pushed as AccountSpec::Pda(PdaSpec::new(...)). If this is intentional (Pinocchio wraps tokens with seed data into a PDA spec), a brief inline comment would help readers who cross-reference both guides.

snippets/code-snippets/streaming/find-closed-accounts.mdx (1)

5-24: cold_cache captured by tokio::spawn without visible shared-ownership wrapper.

The spawned task captures cold_cache (line 18), but multiple spawns in a loop need shared access. Readers may not realize an Arc<Mutex<...>> (or DashMap) wrapper is required. A one-line comment like // cold_cache: Arc<DashMap<[u8;32], AccountInterface>> on the data-structure description (line 3) would prevent confusion.

light-token/toolkits/for-streaming-pdas.mdx (1)

310-314: User-facing TODO/Warning in documentation.

This <Warning> block contains a TODO that reads as an internal development note rather than user-facing guidance. While the page is currently hidden (visibility: "hidden"), this should be resolved or converted to an internal comment before the page is made visible.

light-token/toolkits/for-streaming-tokens.mdx (1)

188-191: Point queries example hardcodes devnet config.

The Connect step above offers both Mainnet and Devnet tabs, but the point queries example hardcodes api.devnet.solana.com and a placeholder YOUR_KEY. Consider using a tab layout here too, or at minimum note that this is a devnet example.

light-token/defi/routers.mdx (2)

238-239: Minor grammar nit: use a hyphen in compound adjective.

"1232 byte limit""1232-byte limit" (compound modifier before a noun).


254-263: Hardcoded Jito tip accounts may become stale.

These addresses are embedded directly in the example. If Jito rotates or adds tip accounts, this snippet becomes silently wrong. Consider adding a comment pointing readers to the canonical source (e.g., Jito's docs or on-chain tip program) so they can keep accounts up to date.

.value;
let cold: Vec<_> = interfaces.into_iter().flatten().collect();
let specs = sdk.load_specs(&cold)?;
ixs.extend(create_load_instructions(&specs, payer, config_pda, &rpc).await?);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent payer argument between code snippets.

Here payer is passed directly, but in the full example on line 173 it's payer.pubkey(). One of these is likely incorrect—if create_load_instructions expects a Pubkey, the short example should also use payer.pubkey().

🤖 Prompt for AI Agents
In `@light-token/defi/routers.mdx` at line 99, The short example passes payer
directly to create_load_instructions but the full example uses payer.pubkey();
update the short example to pass the same type expected by
create_load_instructions (use payer.pubkey() if it expects a Pubkey) so the
argument form is consistent with the full example and the function signature
(refer to create_load_instructions and payer.pubkey()).

Comment on lines +214 to +215
Accounts go cold after extended inactivity. Their virtual rent balance drops
below a threshold and miners compress them onto the Solana ledger.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incorrect terminology: Solana uses "validators," not "miners."

Solana is a proof-of-stake network. Using "miners" (a proof-of-work term) is inaccurate and may confuse readers.

Suggested fix
-below a threshold and miners compress them onto the Solana ledger.
+below a threshold and validators compress them onto the Solana ledger.
🧰 Tools
🪛 GitHub Check: Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

[warning] 215-215: light-token/defi/routers.mdx#L215
Did you really mean 'Solana'?

🤖 Prompt for AI Agents
In `@light-token/defi/routers.mdx` around lines 214 - 215, Replace the incorrect
proof-of-work term "miners" with Solana-appropriate terminology such as
"validators" in the sentence that currently reads "miners compress them onto the
Solana ledger" (search for the string "miners compress them onto the Solana
ledger" in routers.mdx); update the phrasing so it reads e.g. "validators
compress them onto the Solana ledger" or "validators prune/compress them onto
the Solana ledger" to keep meaning intact and accurate.

Comment on lines +130 to +147
```rust
use helius_laserstream::grpc::subscribe_update::UpdateOneof;

Some(UpdateOneof::Transaction(tx_update)) => {
if let Some(ref tx_info) = tx_update.transaction {
if !has_compress_instruction(tx_info) {
return; // 99.999% of transactions exit here.
}
for pubkey in find_closed_accounts(tx_info) {
// Only process accounts we're tracking.
// This filters out unrelated accounts that went to 0 in the same tx.
if let Some(last_hot_state) = cache.remove(&pubkey) {
cold_cache.insert(pubkey, last_hot_state);
}
}
}
}
```
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

return; may confuse — consider using continue or a no-op block.

Line 136 uses return; inside a match arm, which would exit the enclosing function rather than skip to the next stream event. In the full event-loop context, this is likely meant to be a continue or simply an empty {} block. Since this is a documentation snippet, the intent is clear, but using the correct keyword prevents copy-paste bugs.

📝 Suggested fix
         if !has_compress_instruction(tx_info) {
-            return; // 99.999% of transactions exit here.
+            continue; // 99.999% of transactions skip here.
         }
🤖 Prompt for AI Agents
In `@light-token/toolkits/for-streaming-pdas.mdx` around lines 130 - 147, The
snippet uses return; inside the UpdateOneof::Transaction arm which will exit the
enclosing function; change that to continue (to skip processing this stream
event and proceed to the next loop iteration) or a no-op block if the
surrounding context isn't a loop; specifically replace the return; after the
has_compress_instruction(tx_info) check so when
has_compress_instruction(tx_info) is false you skip further handling of
tx_update rather than exiting the function—update the match arm around
UpdateOneof::Transaction / tx_update and ensure subsequent logic that moves
entries from cache to cold_cache remains reachable only when
has_compress_instruction(tx_info) is true.

@SwenSchaeferjohann SwenSchaeferjohann merged commit 8ae88f1 into main Feb 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant