Skip to content

fix(zk): enforce address binding, verifier hardening, and structural guards (#348) - #459

Draft
s6pa1rta3n-lab wants to merge 1 commit into
ANAVHEOBA:mainfrom
s6pa1rta3n-lab:fix-issue-348
Draft

fix(zk): enforce address binding, verifier hardening, and structural guards (#348)#459
s6pa1rta3n-lab wants to merge 1 commit into
ANAVHEOBA:mainfrom
s6pa1rta3n-lab:fix-issue-348

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

Resolves #348 by hardening the ZK verification pipeline, enforcing address binding, and implementing structural guards across circuits, contracts, and the SDK:

  1. Address-Binding & Verifier Hardening (ZK-072 / REPLAY matrix):

    • Implemented address-to-field canonical encoding via SHA256 reduction modulo $r$ for Stellar Address types (Account and Contract), matching circuit field expectations.
    • Enforced recipient address binding in Soroban contract withdraw entrypoint: contract verifies that recipient_field passed in public inputs strictly matches the hash of the caller's target address.
    • Updated circuit linear combination and contract verifier to validate all 8 public inputs (pool_id, root, nullifier_hash, recipient, amount, relayer, fee, denomination).
  2. Structural & VK Verification Guards:

    • Enforced structural validation on Groth16 proofs (G1/G2 point uncompressed lengths, canonical formatting) and Verifying Keys (gamma_abc element length matching public input count + 1).
    • Validated schema versions deterministically derived from public input schemas.
  3. SDK & Merkle Tree Alignments:

    • Updated ProofGenerator.prepareWitness and PublicInputs schemas to handle 8 inputs with canonical hex encoding.
    • Preserved zero-account semantics (fee == 0 implies zero relayer field) while validating address formatting.
    • Fixed manifest refresh script and schema parity test matrix.

Verification

  • Noir Circuits: 124/124 tests pass (nargo test --workspace).
  • Soroban Contracts: 96/96 tests pass (cargo test).
  • SDK & E2E Suites: 57/57 test suites pass, 862/862 tests pass (npm test).

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

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.

ZK-072: Replace lossy recipient decoding with a verifiable address-binding strategy

1 participant