Skip to content

Commit d6068ac

Browse files
niconiconiclaude
andcommitted
fix(ops): send net recipient amount as burn_amount in withdraw request
The withdraw proof's circuit Amount (c.Amount) equals the total UTXO deduction: net_recipient + relayerFee + protocolFee. The contract computes amountWithFee = inp.amount + contractProtocolFee + inp.relayerFee and uses it as ZKP public input[6]. For the proof to verify, inp.amount must be the net recipient amount so that: amountWithFee = net + protocolFee + relayerFee = burnAmount = c.Amount Previously, withdraw_amount (used as burn_amount / inp.amount in the relayer request) was set to burnAmount (total UTXO deduction including fees). The contract would then add fees on top again, making amountWithFee > c.Amount and failing ZKP verification with "Transaction validation failed. The note may have been spent or is invalid." Fix: use typedPlan.requestedAmount (the net amount the user asked to receive) as withdraw_amount in the proof context so the relayer sends the correct inp.amount to the contract. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0a98299 commit d6068ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ops/ops.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ export class Ops implements OpsApi {
500500
array_hash_index: arrayHashIndex,
501501
relayer: typedPlan.relayer,
502502
recipient: input.recipient,
503-
withdraw_amount: burnAmount,
503+
withdraw_amount: BigInt(typedPlan.requestedAmount),
504504
relayer_fee: relayerFee,
505505
gas_drop_value: gasDropValue,
506506
extra_data: extraData,

0 commit comments

Comments
 (0)