-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: retry mint for a failed payment card order #357
Conversation
removes the possibility of wrong card minting
In issue specs, I suggested retrieving the transaction hash of the partially failed mint by reading the events of permit2. I tried that. Even though permit2 has events, but none of those events are for the claim. With this, the events of permit2 are of no use to us here. In the current solution, we store the tx hash in local storage and use it in retry if the mint failed previously. This is good enough for us. |
|
@EresDev, this task has been idle for a while. Please provide an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems fine. What's the best way to test it?
@0x4007 Steps
It will give you a permit url that you can use to mint a payment card. If you want to test using local anvil fork, make sure you fill the correct anvil info in .env and you can start anvil using
Test casesYou can perform the following test cases:
|
|
Unit tests are for backend. Retrying mint is not a backend feature, but a frontend feature. You probably see signed message validation in backend and we have unit tests for it included with this PR. For, retry mint, we can have an e2e test, but before we add that our e2e tests are false positives at the moment and should be fixed here. Overall, I think it is not very important to have an e2e test for retry mint. (more unit test but less e2e tests, plus retry mint isn't that critical op)
This is a good catch. Yes, it seems possible to with same order id to order again after a year. I have added a fix for this. The reloadly api endpoint requires both the start and end date to check transactions for duplicates. I am now using start of epoch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine
@EresDev, this task has been idle for a while. Please provide an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fine
Resolves #291
In issue specs, I suggested retrieving the transaction hash of the partially failed mint by reading the events of permit2. I tried that. Even though permit2 has events, but none of those events are for the claim. Because of this, the events of permit2 are of no use to us here.
In the current solution, we store the permit nonce and tx hash in local storage and use it in retry if the mint failed previously. This is good enough for us.
However, there is one drawback of this solution. When minting, the user has to provide two confirmations using their web3 wallet. One for the permit transaction, and the second to sign a message. Moreover, the signing of message also provides an additional benefit.
/post-order
is open to public and anyone can call it if the transaction has partially failed but transferred the permit amount to card treasury. It was very useful if the best card for user was fixed. But the best card for user can change based on its location and availability. This adds risk as public can mint a wrong card. Signing of message removes this risk. Only actual user can retry mint after looking at currently available card for them.QA
QA-partially-failed-minting-3.mp4