Repository navigation
feat: ZK-071 – split withdrawal circuit schema from contract verifier payload explicitly - #464
Open
rushikeshgarad2024-dev wants to merge 1 commit into
Conversation
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
Resolves #347 (Wave Issue Key: ZK-071).
Context & Implementation
This PR explicitly separates the full withdrawal circuit schema from the reduced contract verifier payload to eliminate schema confusion and prevent runtime layout mismatch between off-chain witness generation and on-chain verification.
Explicit Schema & Type Separation in SDK (
sdk/src/public_inputs.ts,sdk/src/proof.ts):CIRCUIT_PUBLIC_INPUT_SCHEMA/WITHDRAWAL_PUBLIC_INPUT_SCHEMA: Defined with all 8 fields:[pool_id, root, nullifier_hash, recipient, amount, relayer, fee, denomination], frozen against runtime mutation.CONTRACT_VERIFIER_INPUT_SCHEMA: Defined with the exact 6 reduced fields:[root, nullifier_hash, recipient, amount, relayer, fee], frozen.WithdrawalCircuitPublicInputs,FullWithdrawalCircuitPublicInputs,ContractVerifierPublicInputs.deriveContractVerifierInputs(full: WithdrawalCircuitPublicInputs): ContractVerifierPublicInputswith full input validation (rejects missing fields, no silent drops).serializeContractVerifierInputsemits 6 canonical field hexes (192 bytes).ProofGenerator.formatContractVerifierPayload.Soroban Contract Verifier Support (
contracts/privacy_pool/src/types/state.rs,contracts/privacy_pool/src/crypto/verifier.rs):CircuitPublicInputs(8 fields) andContractVerifierPublicInputs(6 fields) with explicit projectionCircuitPublicInputs::to_contract_verifier_inputs(&self).compute_vk_xaccepts 6 contract verifier inputs;compute_vk_x_circuitaccepts 8 circuit inputs.EXPECTED_IC_VECTOR_LENGTH = 7for 6 inputs, or 9 for 8 inputs) and validates structural field boundaries.Validation & Test Suite:
test/schema_parity.test.tsupdated to enforce distinct schemas, 6-input contract verifier schema, explicit exclusion ofpool_idanddenominationfrom contract verifier, and deterministic derivation.test_circuit_public_inputs_to_contract_verifier_inputs_projectionadded tostate_test.rs.npm run build) and schema parity tests pass 100%.Stellar Payout Address
Stellar Address:
GC5U46IS25KYFKNHDXEHR3KTQB3DVIBM4NW5BH4MVUE2G77STCJP4IHF