-
Notifications
You must be signed in to change notification settings - Fork 80
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
Handle errors when sending tokens within Aurora to NEAR #269
Comments
That is rather unfortunate. We will look into this. |
Update on this: the tokens were manually refunded to the user on this tx |
Seems we can't do that. The main reason promises are async. Also, we can't analyze TX inside Obvious solutions:
@mfornet, @joshuajbouw let's choose the best solution for that. |
@mrLSD I think you should be able to attach a callback to the promise (using the I.e. you should be able to do was @mfornet suggested in the issue description using a callback (Sorry I did not intend to close this issue with my comment, so I reoopened it) |
I investigated that, and still have questions. So, the Anyway, we have aurora-engine/src/precompiles/native.rs Line 167 in 3eace8c
So I'll implement a dependent But do we really clear that the approach doesn't have pitfalls? |
No, this is not what you should do. The transfer that needs to be reverted in the the engine itself. You need to transfer the tokens back from the precompile address to the user's address in the engine. The NEP-141 balances do not need to be changed because this flow only triggers when the NEP-141 transaction was unsuccessful.
I'm not sure what you are worried about. Could you elaborate more about the danger here? |
@mfornet Could you take a look at #284 (comment) ? Have you thought about the case where the exit precompile was invoked as part of a larger transaction? |
@birchmd answered on this comment: #284 (comment) |
@mfornet , I've replied #284 (comment) |
Currently the way exit precompiles work, is that it:
Currently if step 3) fails for some reason, tokens are burnt within aurora, and not minted on NEAR, so basically they are lost. We need to handle failures on step 3. This is, we schedule yet another call after the exit call where we see if the tx succeeded or not, in case it didn't succeed funds should be refunded.
This was first detected on this tx. Where
ft_transfer
failed because receiver account was not registered in the NEP-141 tokens. Currently this tokens are being held byaurora
account, but they were not refunded to the user.The text was updated successfully, but these errors were encountered: