Skip to content
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

User recovery mechanism for non-refundable forwards #143

Merged
merged 5 commits into from
Nov 24, 2023

Conversation

agouin
Copy link
Member

@agouin agouin commented Nov 17, 2023

Currently, if non-refundable is set (swap-n-forward middleware is the only use case of this we know of), and a forward after a point of no return fails (due to max timeouts or ack error), the funds end up stuck in the escrow account. This does not give the user a way to recover their funds in that scenario.

This introduces a mechanism in that scenario to move the funds from the escrow account:

  • If the destination receiver of the original packet is a valid bech32 address for this chain, we use that address.
  • Otherwise, if the sender of the original packet is a valid bech32 address for another chain, we translate that address to this chain. Note that for this fallback, the coin type of the source chain sender account must be compatible with this chain. e.g. if the source chain is a coin-type 60 chain, then the intermediate chain must also support coin type 60 for the user to be able to recover their funds on the intermediate chain.

@agouin agouin requested review from Reecepbcups and jtieri November 17, 2023 20:48
* wip: add dummy middleware to modify packets

* rm unused

* force inFlightPacket.Nonrefundable = true

* dummyware.AppModuleBasic

* test: create non-refundable pfm test cases

* Get source originating tests passing

* remove parallel

* lint

* fix test, update comments

* fix final test

---------

Co-authored-by: Justin Tieri <[email protected]>
Co-authored-by: Andrew Gouin <[email protected]>
@agouin agouin merged commit b04e5c4 into main Nov 24, 2023
8 checks passed
@agouin agouin deleted the andrew/non-refundable-recovery branch November 24, 2023 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants