Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Jan 13, 2025
1 parent 2045d3d commit afe7be1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions docs/zetacore/status_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ A cctx can have a maximum of two outbound params. We can refer to the first outb
- `outbound failed` : The outbound failed, The protocol would try to create a revert either in the same block or schedule one to be picked up by zetaclient
- `outbound failed for non-ZETA cctx` : Special case of outbound failed where we do not try to revert the cctx
- `outbound failed for admin tx` : The outbound failed for an admin transaction, in this case we do not revert the cctx
- `outbound failed deposit to ZEVM failed but contract call did not revert` : Special case of outbound failed The outbound/deposit failed, but the contract did not revert,
- `outbound failed but the universal contract did not revert` : Special case of outbound failed The outbound/deposit failed, but the contract did not revert,
this is most likely caused by an internal error in the protocol.The CCTX is this case is aborted. Users can try connecting with the zetachain team to get a refund
- `outbound pre-processing failed` : The outbound failed during the pre-processing step. This means the outbound is never created. In this case the cctx is aborted
- `cctx aborted with admin cmd` : The cctx was aborted manually by an admin command
- `cctx aborted through MsgAbortStuckCCTX` : The cctx was aborted manually by an admin command


### Example values for ErrorMessage and ErrorMessageRevert fields and how to interpret them
Expand All @@ -65,6 +65,6 @@ A cctx can have a maximum of two outbound params. We can refer to the first outb
- revertReason: Revert reason from the smart contract
```

- `outbound failed to external chain ,start revert` : withdraw failed to an external chain, and the protocol is starting the revert process back to ZEVM.
- `outbound failed to connected chain ,start revert` : withdraw failed to an external chain, and the protocol is starting the revert process back to ZEVM.
- `coin type [CoinType] not supported for revert when source chain is Zetachain` : The coin type is not supported for revert when the source chain is Zetachain.
- `error from EVMDeposit: [Error_String]` : Error returned by the protocol when trying to deposit tokens( and optionally call a contract) on ZEVM. The error string should explain the cause
2 changes: 1 addition & 1 deletion x/crosschain/keeper/cctx_gateway_zevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound(
if err != nil && !isContractReverted {
// exceptional case; internal error; should abort CCTX
config.CCTX.SetAbort(types.StatusMessages{
StatusMessage: "outbound failed deposit to ZEVM failed but contract call did not revert",
StatusMessage: "outbound failed but the universal contract did not revert",
ErrorMessageOutbound: fmt.Sprintf("error from EVMDeposit: %s", err.Error()),
})
return types.CctxStatus_Aborted, err
Expand Down
12 changes: 6 additions & 6 deletions x/crosschain/keeper/cctx_orchestrator_validate_outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ func (k Keeper) ValidateOutboundZEVM(
if depositErr != nil && isContractReverted {
tmpCtxRevert, commitRevert := ctx.CacheContext()
// contract call reverted; should refund via a revert tx
reverErr := k.processFailedOutboundOnExternalChain(
revertErr := k.processFailedOutboundOnExternalChain(
tmpCtxRevert,
cctx,
types.CctxStatus_PendingOutbound,
depositErr.Error(),
cctx.InboundParams.Amount,
)
if reverErr != nil {
if revertErr != nil {
// Error here would mean the outbound tx failed and we also failed to create a revert tx.
// This is the only case where we set outbound and revert messages,
// as both the outbound and the revert failed in the same block
cctx.SetAbort(
types.StatusMessages{
StatusMessage: fmt.Sprintf("revert failed"),
ErrorMessageOutbound: depositErr.Error(),
ErrorMessageRevert: reverErr.Error(),
ErrorMessageRevert: revertErr.Error(),
})
return types.CctxStatus_Aborted
}
Expand Down Expand Up @@ -148,7 +148,7 @@ func (k Keeper) processFailedOutboundObservers(ctx sdk.Context, cctx *types.Cros
cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed
cctx.SetAbort(types.StatusMessages{
StatusMessage: "outbound failed for non-ZETA cctx",
ErrorMessageOutbound: fmt.Sprintf("coin type %s not supported for revert when source chain is Zetachain", cctx.InboundParams.CoinType),
ErrorMessageOutbound: fmt.Sprintf("revert on ZetaChain is not supported for cctx v1 with coin type %s", cctx.InboundParams.CoinType),
})
}
}
Expand Down Expand Up @@ -290,7 +290,7 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro
// The outbound failed due to majority of observer voting failure.We do not have the exact reason for the failure available on chain.
cctx.SetPendingRevert(types.StatusMessages{
StatusMessage: "outbound failed",
ErrorMessageOutbound: "outbound failed to external chain ,start revert",
ErrorMessageOutbound: "outbound failed to connected chain ,start revert",
})
data, err := base64.StdEncoding.DecodeString(cctx.RelayedMessage)
if err != nil {
Expand Down Expand Up @@ -375,7 +375,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT
// update status
cctx.SetPendingRevert(types.StatusMessages{
StatusMessage: "outbound failed",
ErrorMessageOutbound: "outbound failed to external chain ,start revert",
ErrorMessageOutbound: "outbound failed to connected chain ,start revert",
})

Check warning on line 379 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#L376-L379

Added lines #L376 - L379 were not covered by tests

// process the revert on ZEVM
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/keeper/msg_server_abort_stuck_cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

const (
// AbortMessage is the message to abort a stuck CCTX
AbortMessage = "cctx aborted with admin cmd"
AbortMessage = "cctx aborted through MsgAbortStuckCCTX"
)

// AbortStuckCCTX aborts a stuck CCTX
Expand Down
1 change: 1 addition & 0 deletions x/crosschain/types/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (m *CrossChainTx) AddRevertOutbound(gasLimit uint64) error {
TssPubkey: m.GetCurrentOutboundParam().TssPubkey,
}

// TODO : Refactor to move CoinType field to the CCTX object directly : https://github.com/zeta-chain/node/issues/1943
if m.InboundParams != nil {
revertTxParams.CoinType = m.InboundParams.CoinType
}
Expand Down

0 comments on commit afe7be1

Please sign in to comment.