Skip to content

Commit

Permalink
fix(crosschain): do not check zetachain sender for failed revert outb…
Browse files Browse the repository at this point in the history
…ound (#3166)

* fix(crosschain): do not check zetachain sender for failed revert outbound

* fix fix newline

* fix comment
  • Loading branch information
lumtis authored Nov 15, 2024
1 parent 3c22fbb commit 470ba7d
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions x/crosschain/keeper/cctx_orchestrator_validate_outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 470ba7d

Please sign in to comment.