Skip to content

ZK-073: Redesign relayer binding and zero-relayer semantics across SDK and contract code #349

@ANAVHEOBA

Description

@ANAVHEOBA

Wave: PrivacyLayer ZK Wave 2
Issue Key: ZK-073
Area: withdraw
Priority: High
Drips Complexity: High

Summary

Recipient binding is not the only mismatch. Relayer handling still mixes zero-field sentinels, decoded addresses, and fee rules in ways that are easy to misapply across stacks.

Relevant Code

  • sdk/src/encoding.ts
  • sdk/src/proof.ts
  • circuits/withdraw/src/spend.nr
  • contracts/privacy_pool/src/core/withdraw.rs
  • contracts/privacy_pool/src/utils/address_decoder.rs
  • contracts/privacy_pool/src/utils/validation.rs

Scope

  • Define one relayer binding contract for no-relayer, relayer-with-fee, and malformed-relayer cases.
  • Align SDK serialization, circuit validation, and Soroban withdraw handling around that contract.
  • Cover fee zero, relayer zero, and relayer mismatch cases in end-to-end tests.

Acceptance Criteria

  • Relayer handling no longer depends on ad hoc zero-address assumptions in multiple modules.
  • The contract accepts only relayer encodings that the SDK can produce canonically.
  • Regression tests distinguish absent relayer from malformed relayer cleanly.

Out of Scope

  • New wallet UX and non-ZK frontend polish
  • Unrelated Soroban business logic outside the withdrawal proof boundary

Dependencies

  • ZK-036
  • ZK-072

Validation

  • Inspect derived checks: node scripts/zk_ticket_check.mjs --issue-key ZK-073
  • Run derived checks: node scripts/zk_ticket_check.mjs --issue-key ZK-073 --run
  • Pull requests should include Wave Issue Key: ZK-073 in the title or body.

References

  • sdk/src/encoding.ts
  • sdk/src/proof.ts
  • circuits/withdraw/src/spend.nr
  • contracts/privacy_pool/src/core/withdraw.rs
  • contracts/privacy_pool/src/utils/address_decoder.rs
  • contracts/privacy_pool/src/utils/validation.rs

Metadata

Metadata

Assignees

Labels

area: withdrawWithdrawal circuit constraints and proof semanticsbountyEligible for Drips Wave bounty reviewcircuitsNoir circuit and proving workcomplexity: highDrips complexity: high / 200 pointspriority: highCritical path work for the current wavesecuritySecurity review, audit prep, and hardening worktestingCoverage, fixtures, fuzzing, and regression workwave: zk-2Wave 2: ZK parity, backend, and deployment hardening

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions