research: Poseidon2 Merkle-node hash (constraints + proving-time delta) - #46
Open
alexandre-mrt wants to merge 1 commit into
Open
research: Poseidon2 Merkle-node hash (constraints + proving-time delta)#46alexandre-mrt wants to merge 1 commit into
alexandre-mrt wants to merge 1 commit into
Conversation
Measures swapping transfer.circom/compliance.circom's depth-20 Merkle-node hash from circomlib Poseidon to a Poseidon2 compression (@taceo/circom-lib, audited t=2 parameters): -660 R1CS constraints per circuit (-4.85%/-5.18%), -7.1% mean Node proving time on transfer.circom, cross-checked against an independent JS reference and confirmed to reject 4 classes of malicious witness. Kept as circuits/experiments/ only (not wired into contracts/, scripts/src/, or frontend/) — a production swap needs an off-chain tree-builder migration, a new timelocked VK, and a commitment-migration path. Verdict: PARK. On-chain gas (queue item 1) blocked a third night running: the proxy confirms a network-policy 403 to both fullnode.testnet.sui.io and github.com, not a missing binary. Full report: docs/research/2026-08-28-poseidon2-merkle-hash.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
One iteration of the nightly cryptography/scalability research loop
(
docs/research/NIGHTLY_PROMPT.md). Full report:docs/research/2026-08-28-poseidon2-merkle-hash.md.transfer.circom/compliance.circom's depth-20Merkle-node hash from circomlib Poseidon to a Poseidon2 compression
(
@taceo/circom-lib, audited t=2 parameters) reduces constraint count andNode proving time.
transfer.circom,−5.18%
compliance.circom, −6.35% in an isolated Merkle-20 comparison),−4.31% zkey size, ~−7.1% mean Node proving time (n=20,
transfer.circom).Cross-checked the compiled circuit's Poseidon2 output bit-exact against the
independent
@taceo/poseidon2JS reference, and confirmed 4 classes ofmalicious witness (tampered sibling, tampered leaf, non-boolean path-index
bit, forged root) are rejected at witness-generation time.
circuits/experiments/(plus one new template,
templates/merkle_proof_poseidon2.circom) — theswap changes what the Merkle root means, so a real migration needs
synchronized updates to the off-chain tree builders
(
frontend/src/lib/merkle-tree.ts,scripts/src/compliance-utils.ts), a newtimelocked VK + ceremony contribution, and a path for already-deposited
commitments. Verdict: PARK.
confirmed as an outbound network-policy 403 to both
fullnode.testnet.sui.ioandgithub.com(not a missing binary), so theloop moved to queue item 2 instead. See "Open questions" in the report and
the re-ranked
docs/research/EXPERIMENTS.md.Test plan
circuits:test/transfer.test.mjs43/43,test/compliance.test.mjs30/30,
test/withdraw.test.mjs35/35 — all green, no production circuittouched.
circuits/experiments/poseidon2-merkle.test.mjs— 6/6 (2 correctness, 4negative/malicious-witness tests).
frontend:bun run lintclean,bun run test19/19.scripts:bun run test109/109.contracts(Move): not run — nosuiCLI available this session (seeabove), no contract code changed.
Generated by Claude Code