chore(zk): update TON verifier export commands#2102
Conversation
|
Skipping AI review because this PR is from a fork. A maintainer can start the review by commenting /review in this PR. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpdates zero-knowledge docs to change verifier export commands: add an explicit Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 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)
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.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@contract-dev/zero-knowledge.mdx`:
- Around line 136-145: The code block with the three npx export-ton-verifier
commands runs from the project root but the docs don’t say that; update the
zero-knowledge.mdx snippet containing the npx export-ton-verifier examples to
prepend a brief note like “Run these commands from the project root” and/or add
a single command to change directory to the project root (e.g., cd ../..) so the
relative paths used by the npx export-ton-verifier commands work when followed
sequentially.
- Around line 147-155: The docs currently show running import-wrapper twice into
the same ./wrappers/ directory which will cause the second call to overwrite the
first and break tests that import the Verifier module; update the text to state
that users should run only one import-wrapper command matching their contract
target (use --groth16 for Groth16 or --func for FunC) or direct each command to
a different output directory (e.g., ./wrappers/groth16 and ./wrappers/func) so
both Verifier wrappers can coexist and the test import of Verifier remains
unambiguous.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9f9b5c3f-8a92-4006-b63e-a17c87f203b3
📒 Files selected for processing (1)
contract-dev/zero-knowledge.mdx
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
contract-dev/zero-knowledge.mdx (1)
162-182:⚠️ Potential issue | 🟡 MinorSide‑by‑side wrapper paths won't match the test import.
When readers follow the "keep both wrappers side by side" variant (Lines 163–164), the wrapper ends up at
./wrappers/groth16/Verifier.tsor./wrappers/func/Verifier.ts, but the test snippet at Line 182 still imports from'../wrappers/Verifier'. Users copying both sections verbatim will hit a module-not-found error. Consider either noting that the import path must be adjusted to match the chosen subdirectory (e.g.,'../wrappers/groth16/Verifier'or'../wrappers/func/Verifier'), or dropping the side‑by‑side example to keep the single canonical./wrappers/Verifier.tspath consistent with the test import.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contract-dev/zero-knowledge.mdx` around lines 162 - 182, The test import in tests/ZkSimple.spec.ts (import { Verifier } from '../wrappers/Verifier') will fail if users follow the "keep both wrappers side by side" export commands (npx export-ton-verifier import-wrapper ./wrappers/groth16/ --groth16 and ./wrappers/func/ --groth16 --func) because those create ./wrappers/groth16/Verifier.ts or ./wrappers/func/Verifier.ts; either update the test import to reference the correct subfolder (e.g., import { Verifier } from '../wrappers/groth16/Verifier' or '../wrappers/func/Verifier') or change the export commands to target the canonical path (./wrappers/Verifier.ts) so the existing import works unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@contract-dev/zero-knowledge.mdx`:
- Around line 162-182: The test import in tests/ZkSimple.spec.ts (import {
Verifier } from '../wrappers/Verifier') will fail if users follow the "keep both
wrappers side by side" export commands (npx export-ton-verifier import-wrapper
./wrappers/groth16/ --groth16 and ./wrappers/func/ --groth16 --func) because
those create ./wrappers/groth16/Verifier.ts or ./wrappers/func/Verifier.ts;
either update the test import to reference the correct subfolder (e.g., import {
Verifier } from '../wrappers/groth16/Verifier' or '../wrappers/func/Verifier')
or change the export commands to target the canonical path
(./wrappers/Verifier.ts) so the existing import works unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 366a68e1-02c0-40ed-a7c1-74f137f1f139
📒 Files selected for processing (1)
contract-dev/zero-knowledge.mdx
There was a problem hiding this comment.
🧹 Nitpick comments (1)
contract-dev/techniques/zero-knowledge.mdx (1)
153-167: Use target-language directory names for side-by-side wrappers.
./wrappers/groth16/is ambiguous here because both Tolk and FunC wrappers are Groth16 wrappers. Naming the default target directorytolkmakes the import guidance match the chosen contract target.📝 Suggested documentation tweak
# or keep both wrappers side by side -npx export-ton-verifier import-wrapper ./wrappers/groth16/ --groth16 --force +npx export-ton-verifier import-wrapper ./wrappers/tolk/ --groth16 --force npx export-ton-verifier import-wrapper ./wrappers/func/ --groth16 --func --force-These commands copy a TypeScript wrapper file that provides type-safe methods to interact with the verifier contract. If you keep the default `./wrappers/Verifier.ts` path, the test import below works unchanged. If you keep both wrappers side by side, update the import to match the subdirectory you exported to, such as `../wrappers/groth16/Verifier` for Tolk or `../wrappers/func/Verifier` for FunC. +These commands copy a TypeScript wrapper file that provides type-safe methods to interact with the verifier contract. If you keep the default `./wrappers/Verifier.ts` path, the test import below works unchanged. If you keep both wrappers side by side, update the import to match the subdirectory you exported to, such as `../wrappers/tolk/Verifier` for Tolk or `../wrappers/func/Verifier` for FunC.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contract-dev/techniques/zero-knowledge.mdx` around lines 153 - 167, The directory example is ambiguous because both Tolk and FunC produce Groth16 wrappers; update the side-by-side export examples and import guidance to use explicit target-language directories (e.g., ./wrappers/tolk/ and ./wrappers/func/) so readers can distinguish the Tolk wrapper from the FunC wrapper; modify the example commands (npx export-ton-verifier import-wrapper ./wrappers/tolk/ --groth16 --force and ./wrappers/func/ --groth16 --func --force) and the explanatory import paths (../wrappers/tolk/Verifier and ../wrappers/func/Verifier) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@contract-dev/techniques/zero-knowledge.mdx`:
- Around line 153-167: The directory example is ambiguous because both Tolk and
FunC produce Groth16 wrappers; update the side-by-side export examples and
import guidance to use explicit target-language directories (e.g.,
./wrappers/tolk/ and ./wrappers/func/) so readers can distinguish the Tolk
wrapper from the FunC wrapper; modify the example commands (npx
export-ton-verifier import-wrapper ./wrappers/tolk/ --groth16 --force and
./wrappers/func/ --groth16 --func --force) and the explanatory import paths
(../wrappers/tolk/Verifier and ../wrappers/func/Verifier) accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 902366ad-a07d-42ce-8801-e0f400a4ef32
📒 Files selected for processing (1)
contract-dev/techniques/zero-knowledge.mdx
novusnota
left a comment
There was a problem hiding this comment.
@mysteryon88 Thanks for the update!
@kay-is, I'll merge this one first so your PR (#2128) can adjust accordingly. Otherwise, merging yours first would cause too many conflicts here. Sorry for the slight inconvenience on your end :)
Closes #2124
Summary
Updated the zero-knowledge verifier export documentation to match the latest
export-ton-verifierinterface.The utility now uses Tolk as the default target, so the examples were adjusted to export Tolk contracts without an extra flag and to use
--funcexplicitly when generating FunC contracts.Since Tolk has continued to evolve and the generated verifier now uses newer language features that were not available before, the wrapper flow also had to be updated. The docs now distinguish the wrapper import commands for Tolk and FunC versions so users copy the correct TypeScript wrapper for the contract target they generate.
Changes
--funcusage for FunC verifier generation.Summary by CodeRabbit