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

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

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

// 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
lumtis marked this conversation as resolved.
Show resolved Hide resolved
// 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,
)
}

Check warning on line 341 in x/crosschain/keeper/cctx_orchestrator_validate_outbound.go

View check run for this annotation

Codecov / codecov/patch

x/crosschain/keeper/cctx_orchestrator_validate_outbound.go#L330-L341

Added lines #L330 - L341 were not covered by tests

// get the chain ID of the connected chain
chainID := cctx.GetCurrentOutboundParam().ReceiverChainId
Expand Down
Loading