Skip to content

Noir circuits for confidential token wrapper (epic) #703

Closed
6 of 6 issues completed
Closed

Description

@brozorec

Context

The Confidential Token Wrapper requires six Noir/UltraHonk circuits — Register, Withdraw, Transfer, SetOperator, OperatorTransfer, RevokeOperator (internal design doc §10.1, link available in the tracking workspace). Each enforces the cryptographic invariants for one wrapper operation: key derivation, balance arithmetic, range validity, ECDH-derived blinding, and dual-auditor ciphertexts.

This is a tracking issue. The per-circuit work is split across six sub-issues. Cross-cutting work that doesn't belong to any one circuit (public-input ordering, VK extraction pipeline, prover benchmarks, anti-poisoning regression suite) is captured here so it doesn't fall between tickets.

The primitives library (#699) must land first — every circuit builds on it for Pedersen commitments, Poseidon2-with-domain-separators, ECDH, range checks, and key derivations.

Scope

Per-circuit work (sub-issues)

Each circuit lives in its own sub-issue, sized Small since the heavy crypto is in the primitives library:

  • Noir circuit: Register (design doc §7.2, constraints R1–R5)
  • Noir circuit: Withdraw (design doc §7.5, constraints W1–W8 + W_a1–W_a4)
  • Noir circuit: Transfer (design doc §7.6, constraints T1–T13 + T_a1–T_a8)
  • Noir circuit: SetOperator (design doc §7.7, constraints S1–S13 + S_a1–S_a5)
  • Noir circuit: OperatorTransfer (design doc §7.8, constraints O1–O13 + O_a1–O_a8)
  • Noir circuit: RevokeOperator (design doc §7.9, constraints V1–V10 + V_a1–V_a5)

Cross-cutting work tracked here

  • Public-input ordering — Lock the public-input layout for each circuit before per-circuit work starts. This is the integration contract with the verifier (Multi-VK UltraHonk verifier contract for confidential token wrapper #701), the wrapper, and the SDK. Renaming or reordering a field after the fact cascades through every consumer. Output: a single doc (e.g. circuits/PUBLIC_INPUTS.md) listing the canonical order per circuit type. Field counts per design doc §7: Register 3, Withdraw 15, Transfer 24, SetOperator 24, OperatorTransfer 24, RevokeOperator 19.
  • VK extraction pipeline — Compile each circuit with pinned nargo and bb versions (matching what the verifier Multi-VK UltraHonk verifier contract for confidential token wrapper #701 consumes), extract the verification key, and publish as a reproducible build artifact for embedding at deployment.
  • Prover benchmarks — Per-circuit prover time and constraint count on reference hardware. Target: single-digit seconds on a modern laptop (overview UX section). Flag any circuit that breaches and propose mitigations before merge.
  • Anti-poisoning regression suite — Construct invalid witnesses (mismatched ECDH blinding, range overflow, wrong viewing-key derivation, identity-point keys / ephemeral keys) per circuit and assert that the prover or verifier rejects them. Design doc §5.4 and the nonzero-r_e constraints (W8, T13, S13, O13, V10) call these out as soundness-critical — they need automated regression coverage independent of the per-circuit unit tests.

Acceptance Criteria

  • All six sub-issues completed
  • Public-input ordering documented and frozen for v0.8
  • VK artifacts published for each circuit, reproducible from pinned toolchain versions
  • Prover benchmarks captured in the PR description for each circuit
  • Anti-poisoning regression suite passes for every circuit

Sub-issues

Sub-issues

6 of 6 Issues completed
Loading 6 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Medium

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions