Commit d6068ac
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
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
500 | 500 | | |
501 | 501 | | |
502 | 502 | | |
503 | | - | |
| 503 | + | |
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
| |||
0 commit comments