Skip to content

Commit

Permalink
e2e test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Jun 6, 2024
1 parent 8333985 commit b497cbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 7 additions & 2 deletions x/crosschain/keeper/cctx_gateway_zevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func NewCCTXGatewayZEVM(crosschainKeeper Keeper) CCTXGatewayZEVM {

// InitiateOutbound handles evm deposit and immediately validates pending outbound
func (c CCTXGatewayZEVM) InitiateOutbound(ctx sdk.Context, cctx *types.CrossChainTx) (newCCTXStatus types.CctxStatus) {
tmpCtx, _ := ctx.CacheContext()
tmpCtx, commit := ctx.CacheContext()
isContractReverted, err := c.crosschainKeeper.HandleEVMDeposit(tmpCtx, cctx)

if err != nil && !isContractReverted {
Expand All @@ -30,5 +30,10 @@ func (c CCTXGatewayZEVM) InitiateOutbound(ctx sdk.Context, cctx *types.CrossChai
}

cctx.SetPendingOutbound("")
return c.crosschainKeeper.ValidateOutboundZEVM(ctx, cctx, err, isContractReverted)
newCCTXStatus = c.crosschainKeeper.ValidateOutboundZEVM(ctx, cctx, err, isContractReverted)
if newCCTXStatus == types.CctxStatus_OutboundMined {
commit()
}

return newCCTXStatus
}
4 changes: 1 addition & 3 deletions x/crosschain/keeper/cctx_orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (k Keeper) ValidateOutboundZEVM(
depositErr error,
isContractReverted bool,
) (newCCTXStatus types.CctxStatus) {
tmpCtx, commit := ctx.CacheContext()
if depositErr != nil && isContractReverted {
tmpCtxRevert, commitRevert := ctx.CacheContext()
// contract call reverted; should refund via a revert tx
Expand All @@ -60,8 +59,7 @@ func (k Keeper) ValidateOutboundZEVM(
commitRevert()
return types.CctxStatus_PendingRevert
}
k.validateSuccessfulOutbound(tmpCtx, cctx, "", false)
commit()
k.validateSuccessfulOutbound(ctx, cctx, "", false)
return types.CctxStatus_OutboundMined
}

Expand Down

0 comments on commit b497cbc

Please sign in to comment.