-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Problem
The payment proxy smart contracts will process an accidental "double payment" in which the user submits the same transaction twice.
Proposed Solution
- Sequential nonce
- Smart contract registry of nonces for each payment reference
- New payment proxy smart contracts that check the registry before processing payments.
- When creating a request, register the payment reference with nonce 0 on the registry on the payment chain.
- When paying a request, caller includes the next nonce. Smart contract checks that the nonce is correct.
Details: Brainstorm in the double payment prevention feature
Considerations
-
How to handle "In-Memory Requests" (Pay-before-persist)?
- Proposed: If paymentReference not in registry, skip nonce check. In other words, "In-memory Requests" don't get double payment prevention.
-
This solution would not prevent "overpayment" where the user submits a correct nonce, but the amount exceeds the expected amount of the request. This is intentional because overpayment prevention is more complicated to implement. It would require storing the expected amount onchain and crosschain messaging to make it available on the payment chain.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🎫 Backlog