zeta-chain / node

ZetaChain’s blockchain node and an observer validator client
https://zetachain.com
MIT License
167 stars 109 forks source link

Prevent creating an outbound tx if cctx outbound is reverted and sender is ZetaChain #1069

Closed lumtis closed 1 year ago

lumtis commented 1 year ago

When a cctx outbound tx fails, we create a new outbound for the revert independently if the sender chain is Zetachain or not (and pay gas): https://github.com/zeta-chain/node/blob/3046a78693971efafaffb19ffdb5710356f77649/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go#L145

While we don't create outbound when receiving an inbound and Zetachain is receiver: https://github.com/zeta-chain/node/blob/3046a78693971efafaffb19ffdb5710356f77649/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go#L162

I think we should add a condition in keeper_cross_chain_tx_vote_outbound_tx.go and prevent creating the outbound if the sender is Zetachain.

brewmaster012 commented 1 year ago

yeah, the cctx should probably go into aborted, because this suggests serious error (not only exceptions) as outbound request from zEVM are only transfer fungible tokens (including ZETA) which should not fail.

coming to think of it, we don't really distinguish CCTX exceptions (kind of expected, such as fees not enough) from errors (contract missing, inconsistent internal state, etc).

maybe we should add distinguish those two?

lumtis commented 1 year ago

because this suggests serious error (not only exceptions) as outbound request from zEVM are only transfer fungible tokens (including ZETA) which should not fail.

Don't we consider for the future more advanced uses where there could be an actual revert on the external chain?

maybe we should add distinguish those two?

Agree with this, maybe we should first identify all the places where the distinction could exist, then think about an additional status?