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

Refund user on ZetaChain when a CCTX is aborted #1192

Closed
Tracked by #1683
lumtis opened this issue Sep 26, 2023 · 7 comments · Fixed by #1728
Closed
Tracked by #1683

Refund user on ZetaChain when a CCTX is aborted #1192

lumtis opened this issue Sep 26, 2023 · 7 comments · Fixed by #1728
Assignees

Comments

@lumtis
Copy link
Member

lumtis commented Sep 26, 2023

We currently have this logic when ERC20 cctx can't be reverted (because of non-existing pool for getting gas):
https://github.com/zeta-chain/node/blob/develop/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go#L182

This logic could be generalized for all CCTX types (where the sender address can be compatible) in the idea where we consider that a aborted CCTX is "stuck" on ZetaChain with an amount that can't be recovered.

@brewmaster012
Copy link
Collaborator

one idea is to introduce a "stuck" terminal state of CCTX,
and deposit user fund into ZRC20 instead (credit context.origin). (this only works for EVM chains, need to think about BTC case)
They can claim refund by going to zetachain ZRC20 contract for withdraw.

@lumtis
Copy link
Member Author

lumtis commented Oct 5, 2023

one idea is to introduce a "stuck" terminal state of CCTX, and deposit user fund into ZRC20 instead (credit context.origin). (this only works for EVM chains, need to think about BTC case) They can claim refund by going to zetachain ZRC20 contract for withdraw.

What would be the difference between stuck and the aborted status we currently have?

@lukema95
Copy link
Contributor

lukema95 commented Nov 2, 2023

We currently have this logic when ERC20 cctx can't be reverted (because of non-existing pool for getting gas): https://github.com/zeta-chain/node/blob/develop/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go#L182

This logic could be generalized for all CCTX types (where the sender address can be compatible) in the idea where we consider that a aborted CCTX is "stuck" on ZetaChain with an amount that can't be recovered.

Is the link of codes changed? Do you mean the codes below?
https://github.com/zeta-chain/node/blob/6567637545769a01a8406fd8fc9ad4427b7cb725/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go#L193-#L200

@lukema95
Copy link
Contributor

lukema95 commented Nov 2, 2023

one idea is to introduce a "stuck" terminal state of CCTX, and deposit user fund into ZRC20 instead (credit context.origin). (this only works for EVM chains, need to think about BTC case) They can claim refund by going to zetachain ZRC20 contract for withdraw.

What would be the difference between stuck and the aborted status we currently have?

Can we think that abort means that the transaction handled the exception normally, for example, the transaction failed but the refund operation was performed correctly, while stuck means that the transaction failed to handle the exception correctly, for example, the refund failed to the user, resulting in The refund steps are not completed.

@lumtis lumtis mentioned this issue Feb 5, 2024
@lumtis
Copy link
Member Author

lumtis commented Feb 5, 2024

As discussed: let's work on a MsgRefundAbortedCCTX message @kingpinXD

@kingpinXD
Copy link
Contributor

@lumtis @brewmaster012
Decided to replace Aborted with two states Aborted_Refundable and Aborted_Non_Refundable . The MsgRefundAbortedCCTX can only refund the Aborted_Refundable states.

We now need to differentiate between which one we can refund and which we cant

Here is a draft list of refundable abort

  • InBoundTX EVM deposit and coin type ZETA
  • InBoundTX Crosschain Swap returns error in PayGasAndUpdateCctx or UpdateNonce ( Internal error )
  • OutBountTX Revert Failed
  • OutBoundTX Error during processing Internal error

Adding a list of scenarios in which the CCTX can get into a aborted state , so that it would be easier to review my statement above

  • AbortStuckCCTX Msg called by an admin.
  • Inbound TX
    • EVM deposit,
      • Internal error,
      • The contract call was reverted, and the sender chain was unable to be fetched.
      • Contract call reverted, unable to fetch senderChain gas limit.
      • Unable to set revert CCTX, ( tries to refund on zeta chain if coin type is ERC20 )
    • Crosschain swap returns error in PayGasAndUpdateCctx or UpdateNonce ( Internal error )
  • Outbound Tx
    • Coin type CMD
    • The sender chain is zeta chain
    • Revert Failed
    • Error during processing Internal error

@lumtis
Copy link
Member Author

lumtis commented Feb 6, 2024

Is there a single scenario where an aborted CCTX could not be refundable? I would prefer to keep it simple at first

@lumtis lumtis linked a pull request Feb 7, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants