research: poseidon-constraint-breakdown - #58
Open
alexandre-mrt wants to merge 1 commit into
Open
Conversation
Measures the isolated R1CS constraint cost of every circomlib gadget Veil's circuits instantiate and reconciles it exactly (non-linear and linear counts, all three circuits) against the measured baseline totals, accounting for circom's default --O1 signal-elimination behavior. Finding: the 20-deep Merkle authentication path (Poseidon(2) x20), not the domain-tagged commitment/nullifier/context hashes the README highlights, is the dominant non-linear-constraint cost in transfer.circom (76.0%) and compliance.circom (81.2%). Re-scopes the queued Poseidon2 experiment toward that call specifically and re-ranks EXPERIMENTS.md accordingly; the original Poseidon2 swap stays PARKed on a missing dependency (no audited Poseidon2 circom implementation to vendor). Also re-attempts queue item #1 (on-chain gas): still BLOCKED, now for a confirmed, precise reason (this session's GitHub access is scoped to alexandre-mrt/veil only; Sui testnet RPC blocked by egress policy) — see the report's addendum. No circuit, Move, or frontend code changed. Full writeup: docs/research/2026-09-10-poseidon-constraint-breakdown.md Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019t4x7PtYcPbk9z5MEZiN8v
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, 2026-09-10. Measures the isolated R1CS constraint cost of every circomlib
gadget Veil's three circuits instantiate (
Poseidon(2..5),Num2Bits(8/64), three comparatortemplates,
MultiMux1(2), and the compositeMerkleProof(20)) and reconciles those numbersexactly against each circuit's measured total constraint count (both non-linear and linear),
accounting for circom's default
--O1signal-elimination behavior.Finding: the 20-deep Merkle authentication path (
Poseidon(2)called 20 times per proof), notthe "four Poseidon instances" the README and 2026-07-22 baseline call out, is the dominant
non-linear-constraint cost — 76.0% of
transfer.circomand 81.2% ofcompliance.circom.The domain-tagged commitment/nullifier/context hashes are only 14-18%. This re-scopes the queued
"Poseidon2" experiment toward the Merkle-path hash specifically, and re-ranks
EXPERIMENTS.mdtoput a Merkle-depth measurement (no new dependency needed) ahead of it.
Also re-attempted queue item #1 (on-chain gas per entry point) first, per the queue's own note.
Still BLOCKED, but for a confirmed, precise reason this time (see the report's addendum): this
session's GitHub access is scoped to
alexandre-mrt/veilonly (blockinggithub.com/api.github.com/codeload.github.comforMystenLabs/sui), and the Sui testnet fullnode RPC isblocked by egress policy — both verified directly with
curl, not inferred from a denied tool call.No circuit, Move, or frontend code was changed — this is measurement infrastructure
(
scripts/bench/circuit-gadget-cost/) and documentation (a new report, plus updates toLEDGER.md,EXPERIMENTS.md, and a new "Constraint cost by gadget" section inBASELINE.md).Full report: https://github.com/alexandre-mrt/veil/blob/research/2026-09-10-poseidon-constraint-breakdown/docs/research/2026-09-10-poseidon-constraint-breakdown.md
Test plan
Nothing runnable was skipped or loosened. Everything that could run tonight is green; the two
NOT-RUN rows are pre-existing toolchain blockers unrelated to this change (no circuit/Move code
touched — same posture the 2026-07-22 baseline PR merged under).
bash scripts/bench/circuit-gadget-cost/run.sh— new gadget-isolation benchmark, outputmatches the report's tables exactly
node --experimental-vm-modules test/{transfer,compliance,withdraw}.test.mjs)cd scripts && bun run src/test-converter.ts)cd scripts && bun run src/test-compliance-utils.ts)cd scripts && bun run src/fuzz-tests.ts)cd frontend && bunx vitest run)pot15_final.ptaufromstorage.googleapis.com, blocked by egress policy this session (403, confirmed viacurl)sui move test) — NOT RUN:suiCLI unavailable this session (seeaddendum in the report for exactly why)
🤖 Generated with Claude Code
https://claude.ai/code/session_019t4x7PtYcPbk9z5MEZiN8v