research: Poseidon2 arity benchmark — no native params for Veil's dominant hash arities - #37
Open
alexandre-mrt wants to merge 1 commit into
Open
Conversation
…inant hash arities (REJECT) Queue item #2: measures constraint-count and proving-time deltas from swapping Veil's Poseidon calls for Poseidon2, using a vendored, correctness-cross-checked circom implementation (@taceo/circom-lib), at Veil's four actual hash arities. Result: Poseidon(4) and Poseidon(5) -- the commitment hash (2-3x per circuit) and compliance leaf hash, Veil's most-used gadgets -- have no native Poseidon2 parameter set in the library checked (only t in {2,3,4,8,12,16} exist); the practical t=8-padding fallback nearly doubles their R1CS constraint count. The two natively-supported arities are a wash on constraint count. No protocol circuit was touched -- this is a standalone research benchmark under circuits/research/poseidon2/, not wired into transfer/withdraw/compliance.circom. Also re-confirms on-chain gas measurement (queue item #1) as blocked by a standing organizational egress-policy denial (403 on the testnet fullnode, MystenLabs releases, and crates.io alike), not a transient failure -- reframed in the queue as needing a policy exception rather than another retry. Full writeup: docs/research/2026-08-19-poseidon2-arity-benchmark.md
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
Nightly research loop, queue item #2: measures the real constraint-count and proving-time delta
from swapping Veil's Poseidon calls for Poseidon2, at Veil's actual hash arities (2, 3, 4, 5
inputs), using a vendored, correctness-cross-checked circom implementation
(
@taceo/circom-lib0.6.0).Verdict: REJECT the tested hypothesis.
Poseidon(4)(Veil's commitment hash — called 2–3×per circuit, its single most-used gadget) and
Poseidon(5)(compliance leaf hash) have nonative Poseidon2 parameter set in the library checked — only t ∈ {2,3,4,8,12,16} exist. The
practical fallback (pad to t=8) nearly doubles R1CS constraint count for those two arities
(+99–126%). The two natively-supported arities are a wash on constraint count (fewer non-linear,
more linear, net worse), despite a measured proving-time speedup I don't trust at this circuit
scale (500–1700 constraints, two orders of magnitude below
transfer.circom's 13,611 — fixedper-call overhead likely dominates).
No protocol circuit was touched — this is a standalone benchmark under
circuits/research/poseidon2/, not wired intotransfer.circom/withdraw.circom/compliance.circom.BASELINE.mdis unaffected.Also re-attempted queue item #1 (on-chain gas) first: re-confirmed BLOCKED, now attributed to
a standing organizational egress-policy denial (403 on
fullnode.testnet.sui.io, MystenLabsreleases, and crates.io alike — see
/root/.ccr/README.md's guidance not to retry policydenials), not a transient/session-specific failure. Re-ranked in the queue as needing a policy
exception, not another retry.
Full writeup:
docs/research/2026-08-19-poseidon2-arity-benchmark.mdWhat's in this PR
circuits/research/poseidon2/— vendored Poseidon2 circuit (MIT, attributed), acircomlib-compatible hash wrapper, 8 standalone benchmark circuits at Veil's actual arities,
and correctness/negative-test verification scripts.
scripts/bench/poseidon2-bench-setup.sh+poseidon2-prove-latency.mjs— reusablecompile/setup and Groth16 timing scripts (local pot12 ptau, no network fetch needed).
docs/research/2026-08-19-poseidon2-arity-benchmark.md— full report (hypothesis, threatmodel, approach, results, verdict, where this could be used, open questions).
docs/research/LEDGER.md— new row.docs/research/EXPERIMENTS.md— re-ranked; item feat: Tier 3 — KYC compliance circuit + ElGamal auditor pattern #2 replaced by a narrower follow-up.Test plan
node --experimental-vm-modules test/{transfer,compliance,withdraw}.test.mjs— 108/108 pass (unchanged from 2026-07-22 baseline)cd scripts && bun run src/test-converter.ts— 109/109 passcd frontend && bun run test— 19/19 passnode circuits/research/poseidon2/verify/verify.mjs— both correctness cross-checks (t=3 vs. a from-scratch reimplementation of the primary HorizenLabs reference, t=4 vs.@zkpassport/poseidon2) passnode circuits/research/poseidon2/verify/negative_test.cjs— tampered-output and tampered-internal-wire witnesses both rejectedcd contracts && sui move test— NOT RUN,suiCLI unavailable in this session (same blocker as the 2026-07-22 baseline; no Move code changed in this PR)Generated by Claude Code