-
Notifications
You must be signed in to change notification settings - Fork 0
Add ZK documentation: nullifiers, compressed accounts, and Groth16 guides #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,5 @@ mintlify-docs/ | |
|
|
||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| stash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 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 -20Repository: 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 -100Repository: 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 -50Repository: Lightprotocol/docs-v2 Length of output: 2695 Move or rename the client guide to match the Compressed PDAs path pattern. The file 🤖 Prompt for AI Agents |
||
| { | ||
| "group": "Compressed Tokens", | ||
| "pages": [ | ||
|
|
@@ -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": [ | ||
|
|
@@ -240,6 +247,7 @@ | |
| "references/whitepaper", | ||
| "references/node-operators", | ||
| "references/terminology", | ||
| "references/migration-v1-to-v2", | ||
| "support", | ||
| "references/security" | ||
| ] | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
ananas-block marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| mkdir -p "$SNIPPETS_DIR" | ||
|
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard-coded absolute paths make this script effectively non-portable. Use repo-relative paths (based on the script’s directory) and/or accept 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 |
||
|
|
||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer 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
fiAlso applies to: 22-34, 36-38 🤖 Prompt for AI Agents |
||
|
|
||
| # 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 | ||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace hardcoded absolute paths with portable alternatives. The script uses hardcoded absolute paths specific to a local development environment ( 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 |
||
|
|
||
| mkdir -p "$SNIPPETS_DIR" | ||
|
Comment on lines
+5
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
|
|
||
| # 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 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's odd