Skip to content

research: Poseidon2 Merkle-node hash (constraints + proving-time delta) - #46

Open
alexandre-mrt wants to merge 1 commit into
mainfrom
claude/intelligent-cannon-epa2lo
Open

research: Poseidon2 Merkle-node hash (constraints + proving-time delta)#46
alexandre-mrt wants to merge 1 commit into
mainfrom
claude/intelligent-cannon-epa2lo

Conversation

@alexandre-mrt

Copy link
Copy Markdown
Owner

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.

  • Hypothesis tested: 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) reduces constraint count and
    Node proving time.
  • Measured: −660 R1CS constraints per circuit (−4.85% 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/poseidon2 JS reference, and confirmed 4 classes of
    malicious witness (tampered sibling, tampered leaf, non-boolean path-index
    bit, forged root) are rejected at witness-generation time.
  • Not wired into production: kept entirely under circuits/experiments/
    (plus one new template, templates/merkle_proof_poseidon2.circom) — the
    swap 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 new
    timelocked VK + ceremony contribution, and a path for already-deposited
    commitments. Verdict: PARK.
  • On-chain gas (queue item 1) is blocked a third night running — this time
    confirmed as an outbound network-policy 403 to both
    fullnode.testnet.sui.io and github.com (not a missing binary), so the
    loop 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.mjs 43/43, test/compliance.test.mjs
    30/30, test/withdraw.test.mjs 35/35 — all green, no production circuit
    touched.
  • circuits/experiments/poseidon2-merkle.test.mjs — 6/6 (2 correctness, 4
    negative/malicious-witness tests).
  • frontend: bun run lint clean, bun run test 19/19.
  • scripts: bun run test 109/109.
  • contracts (Move): not run — no sui CLI available this session (see
    above), no contract code changed.

Generated by Claude Code

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants