Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ mintlify-docs/

# Dependencies
node_modules/

stash
Copy link
Contributor

Choose a reason for hiding this comment

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

that's odd

11 changes: 10 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,16 @@
"stablecoins",
"fintechs",
"micropayments",
"clawback"
"clawback",
"hackathon",
"altbn",
"circom",
"snarkjs",
"Zcash",
"zcash",
"circomlibjs",
"Jotaro",
"Yano"
],
"ignorePaths": [
"node_modules",
Expand Down
48 changes: 28 additions & 20 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,33 @@
"quickstart"
]
},
{
"group": "ZK",
"pages": [
"zk/overview",
"zk/examples"
]
},
{
"group": "Compressed PDAs",
"pages": [
"compressed-pdas/overview",
{
"group": "Program Guides",
"pages": [
"compressed-pdas/guides",
"compressed-pdas/guides/how-to-create-compressed-accounts",
"compressed-pdas/guides/how-to-update-compressed-accounts",
"compressed-pdas/guides/how-to-close-compressed-accounts",
"compressed-pdas/guides/how-to-reinitialize-compressed-accounts",
"compressed-pdas/guides/how-to-burn-compressed-accounts"
]
},
"compressed-pdas/program-examples",
"client-library/client-guide",
"compressed-pdas/solana-attestation-service"
]
},
Comment on lines +109 to +128
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the client-library/client-guide path exists
fd -t f "client-guide" --extension mdx --extension md

# Check if there's also a compressed-pdas version
fd -t f -p "compressed-pdas.*client" --extension mdx --extension md

# Also check the overall structure
find . -type d -name "client-library" 2>/dev/null
find . -type d -name "compressed-pdas" 2>/dev/null | head -20

Repository: Lightprotocol/docs-v2

Length of output: 131


🏁 Script executed:

#!/bin/bash
# Check the full docs.json structure around the Compressed PDAs section
cat -n docs.json | sed -n '100,150p'

# Search for all occurrences of client-library in docs.json
rg "client-library" docs.json -n

# Also check the overall structure to see if client-library appears in other groups
rg '"group"' docs.json -A 15 | head -100

Repository: Lightprotocol/docs-v2

Length of output: 5712


🏁 Script executed:

#!/bin/bash
# Check if client-library directory contains content and what it covers
ls -la client-library/ 2>/dev/null || echo "Directory listing failed"

# Check the content of client-guide to understand its scope
head -50 client-library/client-guide.mdx 2>/dev/null || echo "File read failed"

# Check if there are any references in the codebase to justify this placement
rg "client-guide" . --type md --type mdx -B 2 -A 2 | head -50

Repository: Lightprotocol/docs-v2

Length of output: 2695


Move or rename the client guide to match the Compressed PDAs path pattern.

The file client-library/client-guide is documented as a Compressed PDAs client guide (based on its metadata and content describing "compressed pda client"), but it breaks the consistent compressed-pdas/ prefix pattern used throughout the group. Either move the file to compressed-pdas/client-guide.mdx and update the reference in docs.json, or clarify if this shared content should remain in client-library/ with explicit documentation of why it's an exception to the group's naming convention.

🤖 Prompt for AI Agents
In @docs.json around lines 111 - 130, The "Compressed PDAs" group in docs.json
currently references "client-library/client-guide" which breaks the group's
"compressed-pdas/" prefix convention; either move/rename the source file to
compressed-pdas/client-guide.mdx and update the entry in docs.json to
"compressed-pdas/client-guide", or if the file must remain under client-library,
explicitly document the exception and replace the docs.json entry with a brief
comment or an alternate group that explains why "client-library/client-guide" is
shared; locate the docs.json entry for the "Compressed PDAs" group and update
the referenced string accordingly and/or move the file and adjust any
imports/metadata to match the new path.

{
"group": "Compressed Tokens",
"pages": [
Expand Down Expand Up @@ -144,26 +171,6 @@
}
]
},
{
"group": "Compressed PDAs",
"pages": [
"compressed-pdas/create-a-program-with-compressed-pdas",
{
"group": "Program Guides",
"pages": [
"compressed-pdas/guides",
"compressed-pdas/guides/how-to-create-compressed-accounts",
"compressed-pdas/guides/how-to-update-compressed-accounts",
"compressed-pdas/guides/how-to-close-compressed-accounts",
"compressed-pdas/guides/how-to-reinitialize-compressed-accounts",
"compressed-pdas/guides/how-to-burn-compressed-accounts"
]
},
"compressed-pdas/program-examples",
"client-library/client-guide",
"compressed-pdas/solana-attestation-service"
]
},
{
"group": "JSON RPC Methods",
"pages": [
Expand Down Expand Up @@ -240,6 +247,7 @@
"references/whitepaper",
"references/node-operators",
"references/terminology",
"references/migration-v1-to-v2",
"support",
"references/security"
]
Expand Down
2 changes: 1 addition & 1 deletion home.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ import WelcomePageInstall from "/snippets/setup/welcome-page-install.mdx";
<Card
title="Compressed PDAs"
icon="users"
href="/compressed-pdas/create-a-program-with-compressed-pdas"
href="/compressed-pdas/overview"
>
Program and client guides for rent-free PDA accounts.
</Card>
Expand Down
2 changes: 1 addition & 1 deletion learn/core-concepts/considerations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ You're ready to take the next step and start building!
title="Compressed PDAs"
icon="chevron-right"
color="#0066ff"
href="/compressed-pdas/create-a-program-with-compressed-pdas"
href="/compressed-pdas/overview"
horizontal
/>
</CardGroup>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
"ci": "npm run format:check && npm run lint && npm run spellcheck"
},
"devDependencies": {
"cspell": "^8.6.0",
"cspell": "^8.19.4",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"prettier": "^3.2.5"
}
}

22 changes: 14 additions & 8 deletions references/migration-v1-to-v2.mdx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
---
title: Guide to Migrate Programs from v1 to v2 Merkle trees
description: V2 reduces CU consumption by up to 70%. V1 remains supported for existing deployments.
sidebarTitle: Update Guide to V2
sidebarTitle: V2 Migration Guide
---

## V2 Improvements
import V1ToV2MigrationPrompt from "/snippets/ai-prompts/v1-to-v2-migration.mdx";

| | v1 | v2 |
|---------------------|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| Merkle tree type | Concurrent | Batched |
| State tree depth | 26 (~67M leaves) | 32 (~4B leaves) |
| Address tree depth | 26 | 40 |
| Address tree accounts| Separate tree + queue | Single batch tree |
## V2 Improvements

| | v1 | v2 |
|-----------------------|-----------------------|--------------------|
| Merkle tree type | Concurrent | Batched |
| State tree depth | 26 (~67M leaves) | 32 (~4B leaves) |
| Address tree depth | 26 | 40 |
| Address tree accounts | Separate tree + queue | Single batch tree |

<Tabs>
<Tab title="TypeScript">
Expand Down Expand Up @@ -250,6 +251,11 @@ let new_address_params = instruction_data
.into_new_address_params_assigned_packed(address_seed, Some(0));
```

</Tab>
<Tab title="AI Prompt">

<V1ToV2MigrationPrompt />

</Tab>
</Tabs>

Expand Down
38 changes: 20 additions & 18 deletions resources/addresses-and-urls.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,7 @@ Find all JSON RPC Methods for ZK Compression [here](/api-reference/json-rpc-meth
</Check>

<Tabs>
<Tab title="V1">

| | Devnet | Mainnet | Public Key |
|:-|:-:|:-:|:-|
| State Tree | ✓ | ✓ | **smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho** |
| Nullifier Queue | ✓ | ✓ | **nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X** |
| CPI Context | ✓ | ✓ | **cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK** |

</Tab>

<Tab title="V2">
<Tab title="V2 (Default)">

| | Devnet | Mainnet | Public Key |
|:-|:-:|:-:|:-|
Expand Down Expand Up @@ -86,23 +76,35 @@ Find all JSON RPC Methods for ZK Compression [here](/api-reference/json-rpc-meth
| #5 CPI Context | ✓ | - | **cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6** |

</Tab>

<Tab title="V1 (For ZK)">

| | Devnet | Mainnet | Public Key |
|:-|:-:|:-:|:-|
| State Tree | ✓ | ✓ | **smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho** |
| Nullifier Queue | ✓ | ✓ | **nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X** |
| CPI Context | ✓ | ✓ | **cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK** |

</Tab>


</Tabs>

## Address Trees & Queues

<Tabs>
<Tab title="V1">
| Address Tree #1 | |
|:-|:-|
| Address Tree #1 | **amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2** |
| Address Queue #1 | **aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F** |
</Tab>

<Tab title="V2">
| Address Tree | |
|:-|:-|
| Address Tree | **amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx** |
</Tab>
<Tab title="V1 (Deprecated)">
| Address Tree #1 | |
|:-|:-|
| Address Tree #1 | **amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2** |
| Address Queue #1 | **aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F** |
</Tab>
</Tabs>

## Interface PDA
Expand Down Expand Up @@ -186,7 +188,7 @@ Start building with Compressed Tokens or PDAs
title="Compressed PDAs"
icon="chevron-right"
color="#0066ff"
href="/compressed-pdas/create-a-program-with-compressed-pdas"
href="/compressed-pdas/overview"
horizontal
/>
</CardGroup>
2 changes: 1 addition & 1 deletion resources/cli-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ FLAGS
title="Build with compressed PDAs"
icon="chevron-right"
color="#0066ff"
href="/compressed-pdas/create-a-program-with-compressed-pdas"
href="/compressed-pdas/overview"
horizontal
/>
</CardGroup>
43 changes: 43 additions & 0 deletions scripts/copy-zk-merkle-proof.sh
Copy link
Contributor

@ananas-block ananas-block Jan 15, 2026

Choose a reason for hiding this comment

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

do we still need this file?

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Script to copy zk-merkle-proof code from program-examples to docs/snippets
# Wraps each file in appropriate markdown code blocks

PROGRAM_EXAMPLES="/home/tilo/Workspace/program-examples/zk/zk-merkle-proof"
SNIPPETS_DIR="/home/tilo/Workspace/docs/snippets/code-snippets/zk/merkle-proof"

mkdir -p "$SNIPPETS_DIR"
Comment on lines +6 to +9
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Hard-coded absolute paths make this script effectively non-portable.

Use repo-relative paths (based on the script’s directory) and/or accept PROGRAM_EXAMPLES + SNIPPETS_DIR as args/env vars so others (and CI) can run it.

Proposed fix
-#!/bin/bash
+#!/usr/bin/env bash
+set -euo pipefail

-PROGRAM_EXAMPLES="/home/tilo/Workspace/program-examples/zk/zk-merkle-proof"
-SNIPPETS_DIR="/home/tilo/Workspace/docs/snippets/code-snippets/zk/merkle-proof"
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
+
+# Allow overrides: ./copy-zk-merkle-proof.sh [program_examples_dir] [snippets_dir]
+PROGRAM_EXAMPLES="${1:-${PROGRAM_EXAMPLES:-${REPO_ROOT}/program-examples/zk/zk-merkle-proof}}"
+SNIPPETS_DIR="${2:-${SNIPPETS_DIR:-${REPO_ROOT}/snippets/code-snippets/zk/merkle-proof}}"

 mkdir -p "$SNIPPETS_DIR"
🤖 Prompt for AI Agents
In @scripts/copy-zk-merkle-proof.sh around lines 6 - 9, The script currently
hardcodes PROGRAM_EXAMPLES and SNIPPETS_DIR which breaks portability; change it
to accept PROGRAM_EXAMPLES and SNIPPETS_DIR from environment or command-line
args and fall back to repo-relative defaults computed from the script directory
(e.g., a SCRIPT_DIR derived from the script location) before calling mkdir -p;
update the variable assignments so $PROGRAM_EXAMPLES and $SNIPPETS_DIR are set
from provided args/env or from the computed repo-relative paths and ensure the
rest of the script uses those variables.


wrap_code() {
local input_file="$1"
local output_file="$2"
local lang="$3"
echo "\`\`\`$lang" > "$output_file"
cat "$input_file" >> "$output_file"
echo '```' >> "$output_file"
echo "Created: $output_file"
}
Comment on lines +11 to +19
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

Prefer printf + warn on missing inputs (current behavior silently produces partial snippet sets).

Proposed fix
 wrap_code() {
     local input_file="$1"
     local output_file="$2"
     local lang="$3"
-    echo "\`\`\`$lang" > "$output_file"
-    cat "$input_file" >> "$output_file"
-    echo '```' >> "$output_file"
+    printf '```%s\n' "$lang" > "$output_file"
+    cat -- "$input_file" >> "$output_file"
+    printf '```\n' >> "$output_file"
     echo "Created: $output_file"
 }

 # Circuit
 if [ -f "$PROGRAM_EXAMPLES/circuits/merkle_proof.circom" ]; then
     wrap_code "$PROGRAM_EXAMPLES/circuits/merkle_proof.circom" "$SNIPPETS_DIR/circuit.mdx" "circom expandable"
+else
+    echo "WARN: Missing $PROGRAM_EXAMPLES/circuits/merkle_proof.circom" >&2
 fi

Also applies to: 22-34, 36-38

🤖 Prompt for AI Agents
In @scripts/copy-zk-merkle-proof.sh around lines 11 - 19, The wrap_code function
silently produces partial outputs and uses echo for backticks; update wrap_code
to validate its inputs and use printf and safe cat usage: in wrap_code (function
wrap_code) check that both input_file and output_file exist and are non-empty
and print a warning to stderr and return non-zero if the source is missing,
replace echo "\`\`\`$lang" with printf '```%s\n' "$lang" > "$output_file", use
cat -- "$input_file" to append, and replace the closing echo '```' with printf
'```\n' >> "$output_file"; also add existence warnings (to stderr) for the three
other snippet-generation blocks referenced (the blocks around lines 22-34 and
36-38) so they print a WARN with the missing source path when files are absent.


# Circuit
if [ -f "$PROGRAM_EXAMPLES/circuits/merkle_proof.circom" ]; then
wrap_code "$PROGRAM_EXAMPLES/circuits/merkle_proof.circom" "$SNIPPETS_DIR/circuit.mdx" "javascript expandable"
fi

# Program
if [ -f "$PROGRAM_EXAMPLES/src/lib.rs" ]; then
wrap_code "$PROGRAM_EXAMPLES/src/lib.rs" "$SNIPPETS_DIR/program.mdx" "rust expandable"
fi

# Rust client
if [ -f "$PROGRAM_EXAMPLES/tests/test.rs" ]; then
wrap_code "$PROGRAM_EXAMPLES/tests/test.rs" "$SNIPPETS_DIR/rust-client.mdx" "rust expandable"
fi

# TypeScript client
if [ -f "$PROGRAM_EXAMPLES/ts-tests/merkle-proof.test.ts" ]; then
wrap_code "$PROGRAM_EXAMPLES/ts-tests/merkle-proof.test.ts" "$SNIPPETS_DIR/typescript-client.mdx" "typescript expandable"
fi

echo ""
echo "Done! Created snippets in: $SNIPPETS_DIR"
find "$SNIPPETS_DIR" -name "*.mdx" -type f | sort
42 changes: 42 additions & 0 deletions scripts/copy-zk-nullifier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Script to copy zk-nullifier code from program-examples to docs/snippets

PROGRAM_EXAMPLES="/home/tilo/Workspace/program-examples/zk/zk-nullifier"
SNIPPETS_DIR="/home/tilo/Workspace/docs/snippets/code-snippets/zk/nullifier"
Comment on lines +5 to +6
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Replace hardcoded absolute paths with portable alternatives.

The script uses hardcoded absolute paths specific to a local development environment (/home/tilo/Workspace/...), making it unusable for other contributors. Use relative paths or environment variables instead:

Proposed fix
-PROGRAM_EXAMPLES="/home/tilo/Workspace/program-examples/zk/zk-nullifier"
-SNIPPETS_DIR="/home/tilo/Workspace/docs/snippets/code-snippets/zk/nullifier"
+# Configure these paths or set via environment variables
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
+
+PROGRAM_EXAMPLES="${PROGRAM_EXAMPLES:-../program-examples/zk/zk-nullifier}"
+SNIPPETS_DIR="${SNIPPETS_DIR:-$REPO_ROOT/snippets/code-snippets/zk/nullifier}"
🤖 Prompt for AI Agents
In @scripts/copy-zk-nullifier.sh around lines 5 - 6, Replace the hardcoded
absolute paths assigned to PROGRAM_EXAMPLES and SNIPPETS_DIR with portable
alternatives: read their values from environment variables (e.g., use
PROGRAM_EXAMPLES and SNIPPETS_DIR if set) and otherwise construct sensible
relative defaults based on the script location (using the script directory as
the base) so contributors can run the script from different workspaces; update
the assignments for PROGRAM_EXAMPLES and SNIPPETS_DIR accordingly and ensure
downstream uses of those variables remain unchanged.


mkdir -p "$SNIPPETS_DIR"
Comment on lines +5 to +8
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Hard-coded absolute paths make this script non-portable (same issue as merkle-proof script).

Proposed fix (same pattern)
-#!/bin/bash
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Allow overrides: ./copy-zk-nullifier.sh [program_examples_dir] [snippets_dir]
+# (derive defaults relative to repo root)


wrap_code() {
local input_file="$1"
local output_file="$2"
local lang="$3"
echo "\`\`\`$lang" > "$output_file"
cat "$input_file" >> "$output_file"
echo '```' >> "$output_file"
echo "Created: $output_file"
}
Comment on lines +10 to +18
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

Use printf and consider warnings on missing inputs to avoid silent partial outputs.


# Circuit
if [ -f "$PROGRAM_EXAMPLES/circuits/nullifier.circom" ]; then
wrap_code "$PROGRAM_EXAMPLES/circuits/nullifier.circom" "$SNIPPETS_DIR/circuit.mdx" "javascript expandable"
fi

# Program
if [ -f "$PROGRAM_EXAMPLES/programs/zk-nullifier/src/lib.rs" ]; then
wrap_code "$PROGRAM_EXAMPLES/programs/zk-nullifier/src/lib.rs" "$SNIPPETS_DIR/program.mdx" "rust expandable"
fi

# Rust client (unified)
if [ -f "$PROGRAM_EXAMPLES/programs/zk-nullifier/tests/test.rs" ]; then
wrap_code "$PROGRAM_EXAMPLES/programs/zk-nullifier/tests/test.rs" "$SNIPPETS_DIR/rust-client.mdx" "rust expandable"
fi

# TypeScript client
if [ -f "$PROGRAM_EXAMPLES/ts-tests/nullifier.test.ts" ]; then
wrap_code "$PROGRAM_EXAMPLES/ts-tests/nullifier.test.ts" "$SNIPPETS_DIR/typescript-client.mdx" "typescript expandable"
fi

echo ""
echo "Done! Created snippets in: $SNIPPETS_DIR"
find "$SNIPPETS_DIR" -name "*.mdx" -type f | sort
Loading
Loading