feat(Groth16): add working examples of Groth16 verification#1964
feat(Groth16): add working examples of Groth16 verification#1964delovoyhomie wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Thanks for expanding the ZK docs; I’ve left several suggestions in contract-dev/privacy-zk/groth16-examples.mdx plus a couple of small navigation and cross-link tweaks—please apply the inline suggestions to align with the content and safety guidelines.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds comprehensive Groth16 verification example documentation with four proving-stack tutorials (Circom, Noname, Gnark, Arkworks), restructures zero-knowledge navigation into a dedicated ZK proofs section, and extends the spell-check dictionary to recognize new technical terms. ChangesGroth16 Verification Examples & ZK Documentation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
♻️ Duplicate comments (2)
contract-dev/privacy-zk/groth16-examples.mdx (2)
53-65:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd a safety warning about the test-only entropy in the trusted setup commands.
Lines 57 and 60 use hard-coded
"some random text"for entropy contributions. Readers who copy-paste these commands for production use will create an insecure trusted setup that allows proof forgery.Add a caution block before the commands
+<Aside type="caution" title="Test-only setup"> + The commands below use weak entropy (`"some random text"`) suitable only for local testing. + For production, use high-entropy sources and participate in a multi-party ceremony. +</Aside> + ```bash cd circuits/Multiplier🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contract-dev/privacy-zk/groth16-examples.mdx` around lines 53 - 65, Add a clear caution block before the setup commands warning that the hard-coded entropy string "some random text" in the npx snarkjs powersoftau contribute and npx snarkjs zkey contribute commands is for tests only and must not be used in production; instruct readers to supply secure, high-entropy randomness (e.g., use a secure RNG, OS-provided entropy, or explicit interactive/random-file contribution) and never reuse weak or copy-pasted entropy for trusted-setup contributions, and mention that using test-only entropy makes the ceremony insecure and enables proof forgery.
44-46:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse
type="caution"for environment warnings when examples involve fund transfers.Line 174 shows a
sendVerifycall withvalue: toNano('0.15'), which transfers TON. Environment separation is a safety concern, not a tip, when fund movement is involved.Suggested fix
-<Aside type="tip"> +<Aside type="caution" title="Run in sandbox or testnet"> This page follows the upstream Tolk verifier tests and runs locally in the Blueprint sandbox, not on TON mainnet. </Aside>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contract-dev/privacy-zk/groth16-examples.mdx` around lines 44 - 46, The Aside currently uses type="tip" but the example includes a sendVerify call that transfers funds (sendVerify with value: toNano('0.15')), so change the Aside component's type from "tip" to "caution" and update its text to clearly flag the environment and fund-transfer risk; locate the Aside instance surrounding the verifier example and the sendVerify usage to make this change (search for Aside and the sendVerify / toNano('0.15') symbols).
🧹 Nitpick comments (1)
contract-dev/privacy-zk/groth16-examples.mdx (1)
82-83: ⚡ Quick winMove placeholder definitions before their first use.
Line 83 uses
<SOLUTION_JSON>and<GRID_JSON>, but their definitions don't appear until lines 96-99. Readers encounter undefined placeholders and must scroll down to understand what they mean.Reorder the content
Move lines 96-99 to appear immediately before line 82, or integrate them into an Aside above the command block:
<Aside> Before running `noname run`, prepare two JSON files: - `<SOLUTION_JSON>` — the private solved grid in the format expected by `circuits/Sudoku/src/main.no` - `<GRID_JSON>` — the public partially filled grid in the format expected by `circuits/Sudoku/src/main.no` </Aside> ```bash cd circuits/Sudoku noname check noname run --backend r1cs-bls12-381 --private-inputs '<SOLUTION_JSON>' --public-inputs '<GRID_JSON>'Also applies to: 96-99
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contract-dev/privacy-zk/groth16-examples.mdx` around lines 82 - 83, Place the placeholder definitions for <SOLUTION_JSON> and <GRID_JSON> before they are used in the `noname run` example: move the existing descriptive lines about those placeholders (the definitions currently at lines 96-99) to immediately above the `noname check` / `noname run` block or wrap them as an Aside right above that command so readers see what `<SOLUTION_JSON>` and `<GRID_JSON>` mean before encountering `noname run --backend r1cs-bls12-381 --private-inputs '<SOLUTION_JSON>' --public-inputs '<GRID_JSON>'`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@contract-dev/privacy-zk/groth16-examples.mdx`:
- Around line 53-65: Add a clear caution block before the setup commands warning
that the hard-coded entropy string "some random text" in the npx snarkjs
powersoftau contribute and npx snarkjs zkey contribute commands is for tests
only and must not be used in production; instruct readers to supply secure,
high-entropy randomness (e.g., use a secure RNG, OS-provided entropy, or
explicit interactive/random-file contribution) and never reuse weak or
copy-pasted entropy for trusted-setup contributions, and mention that using
test-only entropy makes the ceremony insecure and enables proof forgery.
- Around line 44-46: The Aside currently uses type="tip" but the example
includes a sendVerify call that transfers funds (sendVerify with value:
toNano('0.15')), so change the Aside component's type from "tip" to "caution"
and update its text to clearly flag the environment and fund-transfer risk;
locate the Aside instance surrounding the verifier example and the sendVerify
usage to make this change (search for Aside and the sendVerify / toNano('0.15')
symbols).
---
Nitpick comments:
In `@contract-dev/privacy-zk/groth16-examples.mdx`:
- Around line 82-83: Place the placeholder definitions for <SOLUTION_JSON> and
<GRID_JSON> before they are used in the `noname run` example: move the existing
descriptive lines about those placeholders (the definitions currently at lines
96-99) to immediately above the `noname check` / `noname run` block or wrap them
as an Aside right above that command so readers see what `<SOLUTION_JSON>` and
`<GRID_JSON>` mean before encountering `noname run --backend r1cs-bls12-381
--private-inputs '<SOLUTION_JSON>' --public-inputs '<GRID_JSON>'`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 185007b0-9d2d-4299-8e53-497f68e588eb
📒 Files selected for processing (4)
contract-dev/privacy-zk/groth16-examples.mdxcontract-dev/zero-knowledge.mdxdocs.jsonresources/dictionaries/custom.txt
Closes #1840
Summary by CodeRabbit