research: poseidon-constraint-decomposition - #54
Open
alexandre-mrt wants to merge 1 commit into
Open
Conversation
… path dominates Queue item #2's fallback framing: measure the exact non-linear-constraint contribution of each Poseidon arity and range-check component Veil's three circuits use, via isolated circom fixtures, and reconcile against BASELINE.md (95.6-99.0% of each circuit's total accounted for). Headline finding: the 20-level Merkle path (MerkleProof(20), real template) is 76-81% of transfer.circom's and compliance.circom's non-linear constraints - 4-5.7x the identity-binding Poseidon calls a same-arity Poseidon2 swap would target. Re-ranks EXPERIMENTS.md toward a wider-arity Merkle accumulator as the higher-leverage next experiment. Also: no native circom binary was installable this session (GitHub and static.crates.io both network-policy-denied). Found and verified circom2 (npm, WASM build) as an exact-output substitute, and generated powers-of-tau fully offline instead of downloading - unblocks the whole circuit toolchain for future nights, not just this experiment. Documented in BASELINE.md and added as circuits' devDependency. Full existing suites re-run unmodified as a sanity check: circuits 108/108, proof-converter 109/109, frontend 19/19 all pass. Move contracts NOT RUN (sui CLI still unavailable - reconfirmed, not this experiment's scope). No circuit, Move, or frontend source changed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pm9sks5VQ2kPoytPxeR1Ev
5 tasks
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, one experiment: decompose the R1CS non-linear-constraint cost of every
Poseidon arity and range-check component Veil's three circuits use, via isolated single-component
circom fixtures, and reconcile against the existing
BASELINE.mdtotals — the fallback framingEXPERIMENTS.mditem #2 explicitly offered ("re-deriving the exact non-linear-constraintcontribution per Poseidon instance from the current baseline") in place of a full Poseidon2 swap.
Headline finding: the 20-level Merkle path (
MerkleProof(20)) is 76.0% oftransfer.circom's and 81.2% ofcompliance.circom's non-linear constraints — 4–5.7x theidentity-binding Poseidon calls a same-arity Poseidon2 swap would target. This re-prioritizes the
queue toward a wider-arity Merkle accumulator over a same-arity hash swap.
components — no estimates.
scripts/bench/poseidon-constraint-cost.mjs+ fixtures underscripts/bench/fixtures/poseidon-cost/.circombinary was installable this session (GitHub andstatic.crates.ioboth network-policy-denied); found and verifiedcircom2(npm, WASM build) asan exact-output substitute, and generated powers-of-tau fully offline instead of downloading.
Documented in
BASELINE.mdand added as acircuitsdevDependency, so this doesn't have to berediscovered on a future night.
EXPERIMENTS.mditem feat: Veil privacy payment protocol — full stack MVP #1) reconfirmed BLOCKED early in the session (GitHub,static.crates.io, and a directfullnode.testnet.sui.ioJSON-RPC read all return policy403)before pivoting to this experiment.
Full writeup:
docs/research/2026-09-05-poseidon-constraint-decomposition.md. Ledger, queue, andBASELINE.mdupdated accordingly.Test plan
node scripts/bench/poseidon-constraint-cost.mjs— reproduces the decomposition table inthe report (95.6–99.0% reconciliation across all three circuits)
node --experimental-vm-modules test/{transfer,compliance,withdraw}.test.mjs—108/108 pass (re-run unmodified, using the
circom2substitute, as a sanity check that it'sa safe drop-in — byte-identical constraint counts to the existing baseline)
cd scripts && bun run src/test-converter.ts— 109/109 passcd frontend && bun run test— 19/19 passsui move test) — NOT RUN,suiCLI unavailable this session (unrelatedpre-existing gap, same as 2026-07-22; no contract code touched)
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pm9sks5VQ2kPoytPxeR1Ev
Generated by Claude Code