From 470ba7d8cbf373a998ecbf0d8d1212b59c872bff Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Fri, 15 Nov 2024 17:15:19 +0100 Subject: [PATCH] fix(crosschain): do not check zetachain sender for failed revert outbound (#3166) * fix(crosschain): do not check zetachain sender for failed revert outbound * fix fix newline * fix comment --- .../cctx_orchestrator_validate_outbound.go | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go index 52c8c1e10d..ffc8e9aa7d 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -320,26 +320,25 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro // processFailedOutboundV2 processes a failed outbound transaction for protocol version 2 // for revert, in V2 we have some assumption simplifying the logic -// - sender chain is always ZetaChain +// - sender chain is ZetaChain for regular outbound (not revert outbound) // - all coin type use the same workflow // TODO: consolidate logic with above function // https://github.com/zeta-chain/node/issues/2627 func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainTx) error { - // check the sender is ZetaChain - zetaChain, err := chains.ZetaChainFromCosmosChainID(ctx.ChainID()) - if err != nil { - return errors.Wrap(err, "failed to get ZetaChain chainID") - } - if cctx.InboundParams.SenderChainId != zetaChain.ChainId { - return fmt.Errorf( - "sender chain for withdraw cctx is not ZetaChain expected %d got %d", - zetaChain.ChainId, - cctx.InboundParams.SenderChainId, - ) - } - switch cctx.CctxStatus.Status { case types.CctxStatus_PendingOutbound: + // check the sender is ZetaChain + zetaChain, err := chains.ZetaChainFromCosmosChainID(ctx.ChainID()) + if err != nil { + return errors.Wrap(err, "failed to get ZetaChain chainID") + } + if cctx.InboundParams.SenderChainId != zetaChain.ChainId { + return fmt.Errorf( + "sender chain for withdraw cctx is not ZetaChain expected %d got %d", + zetaChain.ChainId, + cctx.InboundParams.SenderChainId, + ) + } // get the chain ID of the connected chain chainID := cctx.GetCurrentOutboundParam().ReceiverChainId