research: Poseidon2 vs current Poseidon — constraint/proving-time delta (PARK) - #53
Open
alexandre-mrt wants to merge 3 commits into
Open
research: Poseidon2 vs current Poseidon — constraint/proving-time delta (PARK)#53alexandre-mrt wants to merge 3 commits into
alexandre-mrt wants to merge 3 commits into
Conversation
…time bench (WIP) Isolated hash-only bench circuits replicating transfer/compliance/withdraw's exact Poseidon call patterns, compiled against both circomlib Poseidon (current) and TACEO's Poseidon2 (SAFE-style, domain tag folded into the sponge capacity). R1CS constraint counts are measured and real for all six circuits; proving-time and negative-test numbers are still being gathered (large-circuit Groth16 setup is slow in this sandbox's pure-JS snarkjs) — report has TBD placeholders to be filled in before this becomes a normal PR. Toolchain note: this session's GitHub/general-internet egress is blocked (verified, not just missing a package), so native circom and the hosted Powers of Tau ceremony file were unreachable. Used circom2 (WASM circom, npm) — validated against BASELINE.md's exact transfer.circom constraint counts first — and a locally generated dev-only Powers of Tau instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019NksxTdzTtq2TPiBUCpRaY
…report (WIP) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019NksxTdzTtq2TPiBUCpRaY
…ment — PARK Real, measured result: swapping circomlib Poseidon for Poseidon2 (SAFE-style domain tag) in Veil's exact hash shapes raises total R1CS constraints 11.5-16.4% (linear-constraint growth from the sponge's matrix-multiply decomposition, plus a forced width jump for the one hash shape needing 4 non-tag values) but drops Groth16 proving time 4.4-14.9% across all three shapes — non-linear constraints, which fell in every shape, tracked proving time far better than the total constraint count did. 11/11 malicious-witness rejection tests pass. PARK, not KEEP: no production circuit was touched (a real swap breaks already-issued testnet commitments — a migration, not a one-night change), and the domain-tag derivation used is a simplified research stand-in for the full SAFE spec. Re-confirmed on-chain gas (queue item #1) is hard-blocked by this session's egress policy, with harder evidence than the prior run. Re-ranked the queue: Poseidon2 production port promoted to #1, gas demoted to #11, removed the chained-npm-test-hang item (already fixed by a human commit outside this loop). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019NksxTdzTtq2TPiBUCpRaY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One night of the nightly research loop — see
docs/research/NIGHTLY_PROMPT.mdfor the standing brief.curlretry againstfullnode.testnet.sui.ioand a control domain (example.com) both hard-fail identically against this session's egress proxy — a confirmed organization-level allowlist (only npm/jsr/pypi/crates-index/golang-proxy/Anthropic-API hosts reachable), not a retryable denial. Demoted in the queue accordingly.@taceo/circom-lib/@taceo/poseidon2(no round constants hand-derived this session).circuits/bench/— one pair (circomlib Poseidon vs Poseidon2/SAFE) per production circuit shape (transfer,compliance,withdraw) — plus a reusable compile script and two bench scripts underscripts/bench/.pathIndices, mismatched public/private hash values — all rejected by witness calculation).EXPERIMENTS.mdand removed the "chained npm test hang" item — already fixed outside this loop by a human commit (f942fca, 2026-07-28).Full writeup with raw command output:
docs/research/2026-09-04-poseidon2-constraints.md.What changed
circuits/bench/— six new bench circuits + shared Poseidon2 wrapper templates (no production circuit touched)circuits/scripts/compile-poseidon2-bench.sh— reusable compile + dev Groth16 setupscripts/bench/poseidon2-{sponge,bench-witnesses,prove-latency,negative-tests}.mjs— reusable benchmark/test scriptsdocs/research/2026-09-04-poseidon2-constraints.md— full reportdocs/research/LEDGER.md,docs/research/EXPERIMENTS.md— ledger row + re-ranked queuecircuits/package.json,scripts/bench/package.json— new devDependencies (circom2,@taceo/circom-lib,@taceo/poseidon2) — none touch the productiondependencies/build scripts.gitignore— addedbuild-bench/Test plan
circom2validated againstBASELINE.mdbefore use: compiling the realtransfer.circomreproduces the exact documented constraint counts (6,470 non-linear / 7,141 linear)snarkjs.groth16.fullProvenode scripts/bench/poseidon2-negative-tests.mjs— 11/11 passcd scripts && bun run src/test-converter.ts— 109/109 pass (unaffected by this PR, run as a sanity check)cd scripts && bun run src/test-compliance-utils.ts— 67/67 pass (unaffected by this PR, run as a sanity check)circuits/test/*.test.mjs) andsui move test— not run this session: neither is touched by this PR's changes (all new code is additive, undercircuits/bench/and newscripts/bench/poseidon2-*files), the Move suite hits the same blockedsuiCLI as queue item feat: Veil privacy payment protocol — full stack MVP #1, and the circuit suite would need the same slow circom2+local-ptau setup this session already validated for the bench circuits, deprioritized for time. See the report's "Test suite" section for the reproduction command.🤖 Generated with Claude Code
https://claude.ai/code/session_019NksxTdzTtq2TPiBUCpRaY
Generated by Claude Code