diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 65f305da0f..39c60864ae 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -58504,6 +58504,11 @@ definitions: type: string format: int64 description: when the CCTX was created. only populated on new transactions. + error_message_revert: + type: string + title: |- + error_message_revert carries information about the revert outbound tx , + which is created if the first outbound tx fails zetacoreemissionsParams: type: object properties: diff --git a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go index 9e3606759b..b223ebcc78 100644 --- a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go +++ b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go @@ -52,5 +52,8 @@ func TestBitcoinDepositAndCallRevertWithDust(r *runner.E2ERunner, args []string) cctx := utils.WaitCctxAbortedByInboundHash(r.Ctx, r, txHash.String(), r.CctxClient) require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.BTCWithdrawalDustAmount) - require.True(r, strings.Contains(cctx.CctxStatus.ErrorMessage, crosschaintypes.ErrInvalidWithdrawalAmount.Error())) + require.True( + r, + strings.Contains(cctx.CctxStatus.ErrorMessageRevert, crosschaintypes.ErrInvalidWithdrawalAmount.Error()), + ) } diff --git a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto index 8feb44d382..a9a60da102 100644 --- a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto +++ b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto @@ -108,6 +108,18 @@ message Status { bool isAbortRefunded = 4; // when the CCTX was created. only populated on new transactions. int64 created_timestamp = 5; + // error_message_revert carries information about the revert outbound tx , + // which is created if the first outbound tx fails + string error_message_revert = 7; +} + +// StatusMessages is a message that carries status and error messages for a +// cctx Currently this is only used internally to pass messages when updating +// the status +message StatusMessages { + string status_message = 1; + string error_message_outbound = 2; + string error_message_revert = 3; } // ProtocolContractVersion represents the version of the protocol contract used diff --git a/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts b/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts index 4ac84ac5e7..b0c6cf34fd 100644 --- a/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts +++ b/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts @@ -395,6 +395,14 @@ export declare class Status extends Message { */ createdTimestamp: bigint; + /** + * error_message_revert carries information about the revert outbound tx , + * which is created if the first outbound tx fails + * + * @generated from field: string error_message_revert = 7; + */ + errorMessageRevert: string; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; @@ -410,6 +418,44 @@ export declare class Status extends Message { static equals(a: Status | PlainMessage | undefined, b: Status | PlainMessage | undefined): boolean; } +/** + * StatusMessages is a message that carries status and error messages for a + * cctx Currently this is only used internally to pass messages when updating + * the status + * + * @generated from message zetachain.zetacore.crosschain.StatusMessages + */ +export declare class StatusMessages extends Message { + /** + * @generated from field: string status_message = 1; + */ + statusMessage: string; + + /** + * @generated from field: string error_message_outbound = 2; + */ + errorMessageOutbound: string; + + /** + * @generated from field: string error_message_revert = 3; + */ + errorMessageRevert: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.StatusMessages"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): StatusMessages; + + static fromJson(jsonValue: JsonValue, options?: Partial): StatusMessages; + + static fromJsonString(jsonString: string, options?: Partial): StatusMessages; + + static equals(a: StatusMessages | PlainMessage | undefined, b: StatusMessages | PlainMessage | undefined): boolean; +} + /** * RevertOptions represents the options for reverting a cctx * diff --git a/x/crosschain/keeper/cctx_gateway_observers.go b/x/crosschain/keeper/cctx_gateway_observers.go index 9576bcfe32..8224b8c3a8 100644 --- a/x/crosschain/keeper/cctx_gateway_observers.go +++ b/x/crosschain/keeper/cctx_gateway_observers.go @@ -75,7 +75,10 @@ func (c CCTXGatewayObservers) InitiateOutbound( }() if err != nil { // do not commit anything here as the CCTX should be aborted - config.CCTX.SetAbort("internal error", err.Error()) + config.CCTX.SetAbort(types.StatusMessages{ + StatusMessage: "Outbound preprocessing failed for cctx when initiating outbound", + ErrorMessageOutbound: err.Error(), + }) return types.CctxStatus_Aborted, err } commit() diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index fc247ad7a4..2949355e3a 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -28,9 +28,10 @@ func (c CCTXGatewayZEVM) InitiateOutbound( if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX - config.CCTX.SetAbort( - "error during deposit that is not smart contract revert", - err.Error()) + config.CCTX.SetAbort(types.StatusMessages{ + StatusMessage: "Error processing outbound to ZEVM , but contract call did not revert", + ErrorMessageOutbound: err.Error(), + }) return types.CctxStatus_Aborted, err } diff --git a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go index 173093c771..4d10dfb355 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -52,13 +52,17 @@ func (k Keeper) ValidateOutboundZEVM( depositErr.Error(), cctx.InboundParams.Amount, ) + if err != nil { + // Error here would mean the outbound tx failed and we also failed to create a revert tx. + // In this case the cctx can be aborted directly cctx.SetAbort( - "revert failed", - fmt.Sprintf("deposit error: %s, processing error: %s", depositErr.Error(), err.Error())) + types.StatusMessages{ + StatusMessage: fmt.Sprintf("Revert failed , Error : %s", depositErr.Error()), + ErrorMessageRevert: fmt.Sprintf("Processing error: %s", err.Error()), + }) return types.CctxStatus_Aborted } - commitRevert() return types.CctxStatus_PendingRevert } @@ -124,7 +128,9 @@ func (k Keeper) processFailedOutboundObservers(ctx sdk.Context, cctx *types.Cros if cctx.InboundParams.CoinType == coin.CoinType_Cmd { // if the cctx is of coin type cmd or the sender chain is zeta chain, then we do not revert, the cctx is aborted cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort("", "outbound failed for admin tx") + cctx.SetAbort(types.StatusMessages{ + StatusMessage: "outbound failed for admin tx", + }) } else if chains.IsZetaChain(cctx.InboundParams.SenderChainId, k.GetAuthorityKeeper().GetAdditionalChainList(ctx)) { switch cctx.InboundParams.CoinType { // Try revert if the coin-type is ZETA @@ -139,7 +145,10 @@ func (k Keeper) processFailedOutboundObservers(ctx sdk.Context, cctx *types.Cros default: { cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort("", "outbound failed for non-ZETA cctx") + 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), + }) } } } else { @@ -210,10 +219,16 @@ func (k Keeper) processFailedOutboundOnExternalChain( return err } // Not setting the finalization status here, the required changes have been made while creating the revert tx - cctx.SetPendingRevert("", revertMsg) + cctx.SetPendingRevert(types.StatusMessages{ + StatusMessage: "Outbound failed", + ErrorMessageOutbound: revertMsg, + }) case types.CctxStatus_PendingRevert: cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort("aborted while processing failed outbound", "outbound and revert failed") + cctx.SetAbort(types.StatusMessages{ + StatusMessage: "Revert failed", + ErrorMessageRevert: revertMsg, + }) } return nil } @@ -240,9 +255,9 @@ func (k Keeper) processSuccessfulOutbound( oldStatus := cctx.CctxStatus.Status switch oldStatus { case types.CctxStatus_PendingRevert: - cctx.SetReverted("", "") + cctx.SetReverted(types.StatusMessages{StatusMessage: "Revert successful"}) case types.CctxStatus_PendingOutbound: - cctx.SetOutboundMined("") + cctx.SetOutboundMined(types.StatusMessages{StatusMessage: "Outbound mined successfully"}) default: return } @@ -271,7 +286,10 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro } // Trying to revert the transaction this would get set to a finalized status in the same block as this does not need a TSS singing - cctx.SetPendingRevert("", "outbound failed") + cctx.SetPendingRevert(types.StatusMessages{ + StatusMessage: "Outbound failed", + ErrorMessageOutbound: "outbound failed to external chain ,start revert", + }) data, err := base64.StdEncoding.DecodeString(cctx.RelayedMessage) if err != nil { return fmt.Errorf("failed decoding relayed message: %s", err.Error()) @@ -305,7 +323,10 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro return fmt.Errorf("failed ZETARevertAndCallContract: %s", err.Error()) } - cctx.SetReverted("", "outbound failed") + cctx.SetReverted(types.StatusMessages{ + StatusMessage: "Reverted to ZEVM", + }) + if len(ctx.TxBytes()) > 0 { // add event for tendermint transaction hash format hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()) @@ -350,7 +371,10 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // update status - cctx.SetPendingRevert("", "outbound failed") + cctx.SetPendingRevert(types.StatusMessages{ + StatusMessage: "Outbound failed", + ErrorMessageOutbound: "outbound failed to external chain", + }) // process the revert on ZEVM if err := k.fungibleKeeper.ProcessV2RevertDeposit( @@ -368,7 +392,9 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // tx is reverted - cctx.SetReverted("", "outbound failed") + cctx.SetReverted(types.StatusMessages{ + StatusMessage: "Reverted to ZEVM", + }) // add event for tendermint transaction hash format if len(ctx.TxBytes()) > 0 { @@ -381,7 +407,10 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed case types.CctxStatus_PendingRevert: cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort("aborted while processing failed outbound", "outbound and revert failed") + cctx.SetAbort(types.StatusMessages{ + StatusMessage: "Revert failed", + ErrorMessageRevert: "outbound and revert failed", + }) } return nil } diff --git a/x/crosschain/keeper/initiate_outbound.go b/x/crosschain/keeper/initiate_outbound.go index 5339cd4150..d1cd7ea064 100644 --- a/x/crosschain/keeper/initiate_outbound.go +++ b/x/crosschain/keeper/initiate_outbound.go @@ -38,6 +38,6 @@ func (k Keeper) InitiateOutbound(ctx sdk.Context, config InitiateOutboundConfig) ) } - config.CCTX.SetPendingOutbound("") + config.CCTX.SetPendingOutbound(types.StatusMessages{StatusMessage: "Initiating outbound"}) return cctxGateway.InitiateOutbound(ctx, config) } diff --git a/x/crosschain/keeper/initiate_outbound_test.go b/x/crosschain/keeper/initiate_outbound_test.go index 204179bea5..5466b902c7 100644 --- a/x/crosschain/keeper/initiate_outbound_test.go +++ b/x/crosschain/keeper/initiate_outbound_test.go @@ -111,7 +111,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Contains( t, - cctx.CctxStatus.ErrorMessage, + cctx.CctxStatus.ErrorMessageRevert, "chain not supported", ) }, @@ -151,7 +151,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Contains( t, - cctx.CctxStatus.ErrorMessage, + cctx.CctxStatus.ErrorMessageRevert, "GetRevertGasLimit: foreign coin not found for sender chain", ) }) @@ -194,7 +194,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Contains( t, - cctx.CctxStatus.ErrorMessage, + cctx.CctxStatus.ErrorMessageRevert, "chain not supported", ) }, @@ -239,7 +239,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Contains( t, - cctx.CctxStatus.ErrorMessage, + cctx.CctxStatus.ErrorMessageRevert, "chain not supported", ) }, @@ -284,7 +284,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.NoError(t, err) require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) require.Equal(t, types.CctxStatus_Aborted, newStatus) - require.Contains(t, cctx.CctxStatus.ErrorMessage, "cannot find receiver chain nonce") + require.Contains(t, cctx.CctxStatus.ErrorMessageRevert, "cannot find receiver chain nonce") }) t.Run("unable to process zevm deposit HandleEVMDeposit revert successfully", func(t *testing.T) { @@ -361,7 +361,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Contains( t, - cctx.CctxStatus.ErrorMessage, + cctx.CctxStatus.ErrorMessageRevert, "cannot revert a revert tx", ) }, diff --git a/x/crosschain/keeper/msg_server_abort_stuck_cctx.go b/x/crosschain/keeper/msg_server_abort_stuck_cctx.go index 7e2505b01e..f97b85dd8a 100644 --- a/x/crosschain/keeper/msg_server_abort_stuck_cctx.go +++ b/x/crosschain/keeper/msg_server_abort_stuck_cctx.go @@ -41,7 +41,10 @@ func (k msgServer) AbortStuckCCTX( } // update the status - cctx.CctxStatus.UpdateStatusAndErrorMessages(types.CctxStatus_Aborted, AbortMessage, "") + + cctx.SetAbort(types.StatusMessages{ + StatusMessage: AbortMessage, + }) // Save out outbound, // We do not need to provide the tss-pubkey as NonceToCctx is not updated / New outbound is not added diff --git a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go index 7fc5c9be99..8607bcf0f0 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -304,7 +304,7 @@ func TestStatus_UpdateCctxStatus(t *testing.T) { for _, test := range tt { test := test t.Run(test.Name, func(t *testing.T) { - test.Status.UpdateStatusAndErrorMessages(test.NonErrStatus, test.Msg, "") + test.Status.UpdateStatusAndErrorMessages(test.NonErrStatus, types.StatusMessages{StatusMessage: test.Msg}) if test.IsErr { require.Equal(t, test.ErrStatus, test.Status.Status) } else { diff --git a/x/crosschain/keeper/msg_server_vote_outbound_tx.go b/x/crosschain/keeper/msg_server_vote_outbound_tx.go index a940c9c7db..d187eb4e57 100644 --- a/x/crosschain/keeper/msg_server_vote_outbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx.go @@ -193,7 +193,10 @@ SaveFailedOutbound saves a failed outbound transaction.It does the following thi */ func (k Keeper) SaveFailedOutbound(ctx sdk.Context, cctx *types.CrossChainTx, errMessage string, tssPubkey string) { - cctx.SetAbort("", errMessage) + cctx.SetAbort(types.StatusMessages{ + StatusMessage: "Outbound Failed", + ErrorMessageOutbound: errMessage, + }) ctx.Logger().Error(errMessage) k.SaveOutbound(ctx, cctx, tssPubkey) } diff --git a/x/crosschain/types/cctx.go b/x/crosschain/types/cctx.go index b2354a79e1..222615c172 100644 --- a/x/crosschain/types/cctx.go +++ b/x/crosschain/types/cctx.go @@ -183,28 +183,28 @@ func (m *CrossChainTx) AddOutbound( } // SetAbort sets the CCTX status to Aborted with the given error message. -func (m CrossChainTx) SetAbort(statusMsg, errorMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Aborted, statusMsg, errorMsg) +func (m CrossChainTx) SetAbort(messages StatusMessages) { + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Aborted, messages) } // SetPendingRevert sets the CCTX status to PendingRevert with the given error message. -func (m CrossChainTx) SetPendingRevert(statusMsg, errorMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingRevert, statusMsg, errorMsg) +func (m CrossChainTx) SetPendingRevert(messages StatusMessages) { + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingRevert, messages) } // SetPendingOutbound sets the CCTX status to PendingOutbound with the given error message. -func (m CrossChainTx) SetPendingOutbound(statusMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingOutbound, statusMsg, "") +func (m CrossChainTx) SetPendingOutbound(messages StatusMessages) { + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingOutbound, messages) } // SetOutboundMined sets the CCTX status to OutboundMined with the given error message. -func (m CrossChainTx) SetOutboundMined(statusMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_OutboundMined, statusMsg, "") +func (m CrossChainTx) SetOutboundMined(messages StatusMessages) { + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_OutboundMined, messages) } // SetReverted sets the CCTX status to Reverted with the given error message. -func (m CrossChainTx) SetReverted(statusMsg, errorMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Reverted, statusMsg, errorMsg) +func (m CrossChainTx) SetReverted(messages StatusMessages) { + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Reverted, messages) } func (m CrossChainTx) GetCCTXIndexBytes() ([32]byte, error) { diff --git a/x/crosschain/types/cctx_test.go b/x/crosschain/types/cctx_test.go index 1369e2dee0..12ec17c48b 100644 --- a/x/crosschain/types/cctx_test.go +++ b/x/crosschain/types/cctx_test.go @@ -184,46 +184,71 @@ func Test_SetRevertOutboundValues(t *testing.T) { } func TestCrossChainTx_SetAbort(t *testing.T) { - cctx := sample.CrossChainTx(t, "test") - cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetAbort("test", "test") - require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) - require.Contains(t, cctx.CctxStatus.StatusMessage, "test") - require.Contains(t, cctx.CctxStatus.ErrorMessage, "test") + t.Run("set abort from pending revert", func(t *testing.T) { + cctx := sample.CrossChainTx(t, "test") + cctx.CctxStatus.Status = types.CctxStatus_PendingRevert + cctx.SetAbort(types.StatusMessages{ + StatusMessage: "status message", + ErrorMessageRevert: "error revert", + }) + require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) + require.Equal(t, cctx.CctxStatus.StatusMessage, "status message") + require.Equal(t, cctx.CctxStatus.ErrorMessageRevert, "error revert") + }) + + t.Run("set abort from pending outbound", func(t *testing.T) { + cctx := sample.CrossChainTx(t, "test") + cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound + cctx.SetAbort(types.StatusMessages{ + StatusMessage: "status message", + ErrorMessageOutbound: "error outbound", + }) + require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) + require.Equal(t, cctx.CctxStatus.StatusMessage, "status message") + require.Equal(t, cctx.CctxStatus.ErrorMessage, "error outbound") + }) } func TestCrossChainTx_SetPendingRevert(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetPendingRevert("test", "test") + cctx.SetPendingRevert(types.StatusMessages{ + StatusMessage: "status message", + ErrorMessageOutbound: "error outbound", + }) require.Equal(t, types.CctxStatus_PendingRevert, cctx.CctxStatus.Status) - require.Contains(t, cctx.CctxStatus.StatusMessage, "test") - require.Contains(t, cctx.CctxStatus.ErrorMessage, "test") + require.Equal(t, cctx.CctxStatus.StatusMessage, "status message") + require.Equal(t, cctx.CctxStatus.ErrorMessage, "error outbound") } func TestCrossChainTx_SetPendingOutbound(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingInbound - cctx.SetPendingOutbound("test") + cctx.SetPendingOutbound(types.StatusMessages{ + StatusMessage: "status message", + }) require.Equal(t, types.CctxStatus_PendingOutbound, cctx.CctxStatus.Status) - require.Contains(t, cctx.CctxStatus.StatusMessage, "test") - require.NotContains(t, cctx.CctxStatus.ErrorMessage, "test") + require.Equal(t, cctx.CctxStatus.StatusMessage, "status message") } func TestCrossChainTx_SetOutboundMined(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetOutboundMined("test") + cctx.SetOutboundMined(types.StatusMessages{ + StatusMessage: "status message", + }) require.Equal(t, types.CctxStatus_OutboundMined, cctx.CctxStatus.Status) - require.Contains(t, cctx.CctxStatus.StatusMessage, "test") - require.NotContains(t, cctx.CctxStatus.ErrorMessage, "test") + require.Equal(t, cctx.CctxStatus.StatusMessage, "status message") } func TestCrossChainTx_SetReverted(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingRevert - cctx.SetReverted("test", "test") + cctx.SetReverted(types.StatusMessages{ + StatusMessage: "status message", + ErrorMessageRevert: "error revert", + }) require.Equal(t, types.CctxStatus_Reverted, cctx.CctxStatus.Status) - require.Contains(t, cctx.CctxStatus.StatusMessage, "test") - require.Contains(t, cctx.CctxStatus.ErrorMessage, "test") + require.Equal(t, cctx.CctxStatus.StatusMessage, "status message") + require.Equal(t, cctx.CctxStatus.ErrorMessageRevert, "error revert") } diff --git a/x/crosschain/types/cross_chain_tx.pb.go b/x/crosschain/types/cross_chain_tx.pb.go index 11ebc77bb3..71954e9201 100644 --- a/x/crosschain/types/cross_chain_tx.pb.go +++ b/x/crosschain/types/cross_chain_tx.pb.go @@ -509,6 +509,9 @@ type Status struct { IsAbortRefunded bool `protobuf:"varint,4,opt,name=isAbortRefunded,proto3" json:"isAbortRefunded,omitempty"` // when the CCTX was created. only populated on new transactions. CreatedTimestamp int64 `protobuf:"varint,5,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp,omitempty"` + // error_message_revert carries information about the revert outbound tx , + // which is created if the first outbound tx fails + ErrorMessageRevert string `protobuf:"bytes,7,opt,name=error_message_revert,json=errorMessageRevert,proto3" json:"error_message_revert,omitempty"` } func (m *Status) Reset() { *m = Status{} } @@ -586,6 +589,76 @@ func (m *Status) GetCreatedTimestamp() int64 { return 0 } +func (m *Status) GetErrorMessageRevert() string { + if m != nil { + return m.ErrorMessageRevert + } + return "" +} + +// StatusMessages is a message that carries status and error messages for a +// cctx Currently this is only used internally to pass messages when updating +// the status +type StatusMessages struct { + StatusMessage string `protobuf:"bytes,1,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"` + ErrorMessageOutbound string `protobuf:"bytes,2,opt,name=error_message_outbound,json=errorMessageOutbound,proto3" json:"error_message_outbound,omitempty"` + ErrorMessageRevert string `protobuf:"bytes,3,opt,name=error_message_revert,json=errorMessageRevert,proto3" json:"error_message_revert,omitempty"` +} + +func (m *StatusMessages) Reset() { *m = StatusMessages{} } +func (m *StatusMessages) String() string { return proto.CompactTextString(m) } +func (*StatusMessages) ProtoMessage() {} +func (*StatusMessages) Descriptor() ([]byte, []int) { + return fileDescriptor_d4c1966807fb5cb2, []int{5} +} +func (m *StatusMessages) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StatusMessages) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StatusMessages.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StatusMessages) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusMessages.Merge(m, src) +} +func (m *StatusMessages) XXX_Size() int { + return m.Size() +} +func (m *StatusMessages) XXX_DiscardUnknown() { + xxx_messageInfo_StatusMessages.DiscardUnknown(m) +} + +var xxx_messageInfo_StatusMessages proto.InternalMessageInfo + +func (m *StatusMessages) GetStatusMessage() string { + if m != nil { + return m.StatusMessage + } + return "" +} + +func (m *StatusMessages) GetErrorMessageOutbound() string { + if m != nil { + return m.ErrorMessageOutbound + } + return "" +} + +func (m *StatusMessages) GetErrorMessageRevert() string { + if m != nil { + return m.ErrorMessageRevert + } + return "" +} + // RevertOptions represents the options for reverting a cctx type RevertOptions struct { RevertAddress string `protobuf:"bytes,1,opt,name=revert_address,json=revertAddress,proto3" json:"revert_address,omitempty"` @@ -599,7 +672,7 @@ func (m *RevertOptions) Reset() { *m = RevertOptions{} } func (m *RevertOptions) String() string { return proto.CompactTextString(m) } func (*RevertOptions) ProtoMessage() {} func (*RevertOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_d4c1966807fb5cb2, []int{5} + return fileDescriptor_d4c1966807fb5cb2, []int{6} } func (m *RevertOptions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -672,7 +745,7 @@ func (m *CrossChainTx) Reset() { *m = CrossChainTx{} } func (m *CrossChainTx) String() string { return proto.CompactTextString(m) } func (*CrossChainTx) ProtoMessage() {} func (*CrossChainTx) Descriptor() ([]byte, []int) { - return fileDescriptor_d4c1966807fb5cb2, []int{6} + return fileDescriptor_d4c1966807fb5cb2, []int{7} } func (m *CrossChainTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -766,6 +839,7 @@ func init() { proto.RegisterType((*CallOptions)(nil), "zetachain.zetacore.crosschain.CallOptions") proto.RegisterType((*OutboundParams)(nil), "zetachain.zetacore.crosschain.OutboundParams") proto.RegisterType((*Status)(nil), "zetachain.zetacore.crosschain.Status") + proto.RegisterType((*StatusMessages)(nil), "zetachain.zetacore.crosschain.StatusMessages") proto.RegisterType((*RevertOptions)(nil), "zetachain.zetacore.crosschain.RevertOptions") proto.RegisterType((*CrossChainTx)(nil), "zetachain.zetacore.crosschain.CrossChainTx") } @@ -775,94 +849,97 @@ func init() { } var fileDescriptor_d4c1966807fb5cb2 = []byte{ - // 1378 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6f, 0x1b, 0x37, - 0x13, 0xf6, 0xda, 0xb2, 0x2c, 0x8d, 0x3e, 0xbc, 0xa6, 0x15, 0x67, 0xe3, 0x17, 0x51, 0xf4, 0xaa, - 0x75, 0xa2, 0xb8, 0xb5, 0x84, 0x28, 0x40, 0x51, 0xf4, 0x66, 0x1b, 0x71, 0xe2, 0xb6, 0x89, 0x8d, - 0x8d, 0x63, 0x20, 0x39, 0x74, 0x4b, 0xed, 0xd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0xa3, 0x8b, 0x85, 0x0f, 0xd3, 0xc5, 0x44, - 0x01, 0xa9, 0x7f, 0xa7, 0x00, 0xa9, 0x60, 0xce, 0x83, 0x98, 0xc5, 0x21, 0x51, 0x22, 0x4b, 0xf9, - 0x19, 0xc1, 0xf9, 0x23, 0x39, 0x9f, 0x4d, 0x66, 0xfa, 0x9d, 0x64, 0x1a, 0x63, 0x3f, 0xa1, 0x21, - 0x31, 0xba, 0x91, 0xc6, 0x43, 0x39, 0x47, 0x35, 0x70, 0x8d, 0x91, 0x25, 0x54, 0x8c, 0x82, 0x13, - 0x42, 0xbc, 0xab, 0x6a, 0x4d, 0x51, 0xaf, 0x51, 0xf0, 0x1e, 0x21, 0x08, 0x41, 0x4a, 0x29, 0x2f, - 0xa3, 0xac, 0x6a, 0xfc, 0x3e, 0xba, 0xb9, 0x48, 0x94, 0x70, 0xa1, 0x28, 0xaf, 0x81, 0x0c, 0x33, - 0x18, 0x70, 0x12, 0x79, 0x25, 0xb5, 0x72, 0xa9, 0x8d, 0xf9, 0x13, 0x4e, 0x22, 0xf4, 0x0d, 0xac, - 0x92, 0x93, 0x13, 0x12, 0x0a, 0x7a, 0x46, 0x82, 0xc9, 0xc7, 0x5d, 0x51, 0x29, 0xae, 0x9b, 0x14, - 0xdf, 0x7c, 0x8f, 0x14, 0xef, 0xcb, 0x5a, 0x1d, 0x53, 0xdd, 0xb7, 0x59, 0xa9, 0xbf, 0xcb, 0xaf, - 0x33, 0xbb, 0xa6, 0xa2, 0x98, 0x59, 0xaf, 0x53, 0x7c, 0x1d, 0x40, 0x1e, 0x4e, 0x7f, 0xd0, 0x3a, - 0x25, 0x23, 0x25, 0xee, 0xac, 0x2f, 0x8f, 0xeb, 0x50, 0x01, 0x17, 0xf4, 0x81, 0xfc, 0x7f, 0xdd, - 0x07, 0x1e, 0x42, 0x5e, 0x8a, 0x25, 0x60, 0x5a, 0x66, 0x9e, 0x57, 0x71, 0x6a, 0xb9, 0xe6, 0xe6, - 0x25, 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 0x97, 0x6f, 0xcb, 0x73, 0xbf, 0xbd, 0x2d, 0xcf, 0x3d, 0xdb, 0x9a, 0x52, 0x92, - 0x4c, 0xec, 0x96, 0xfe, 0x4f, 0x12, 0xb3, 0x88, 0x34, 0x86, 0xd3, 0x7f, 0x7d, 0x94, 0xa8, 0x5a, - 0x69, 0x75, 0x70, 0x77, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xa1, 0xdc, 0x72, 0x48, 0x28, 0x0d, - 0x00, 0x00, + // 1425 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6e, 0x5b, 0xc5, + 0x17, 0xcf, 0x4d, 0x1c, 0xc7, 0x3e, 0xfe, 0xc8, 0xcd, 0xc4, 0x4d, 0x6f, 0xf3, 0x57, 0xd3, 0xfc, + 0x0d, 0x69, 0xdd, 0x40, 0x6c, 0xea, 0x22, 0x84, 0xd8, 0x25, 0x51, 0xd3, 0x06, 0x68, 0x13, 0xdd, + 0xa6, 0x91, 0xda, 0x05, 0x97, 0xf1, 0xbd, 0x13, 0x7b, 0x14, 0xfb, 0x8e, 0xb9, 0x33, 0x8e, 0xec, + 0x8a, 0x1d, 0x6b, 0x24, 0xde, 0x80, 0x0d, 0x0b, 0x1e, 0xa5, 0xcb, 0x4a, 0x6c, 0x10, 0x8b, 0x52, + 0xb5, 0x6f, 0xc0, 0x13, 0xa0, 0xf9, 0xf2, 0x47, 0xe5, 0x26, 0xa5, 0xb0, 0xf2, 0xf9, 0x98, 0xf3, + 0x3b, 0xe7, 0x9e, 0x99, 0xdf, 0x99, 0x31, 0xd4, 0x9f, 0x12, 0x81, 0xc3, 0x16, 0xa6, 0x71, 0x4d, + 0x49, 0x2c, 0x21, 0xb5, 0x30, 0x61, 0x9c, 0x6b, 0x9b, 0x12, 0x03, 0x25, 0x07, 0xa2, 0x5f, 0xed, + 0x26, 0x4c, 0x30, 0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69, + 0xdc, 0x44, 0x01, 0x2c, 0xe3, 0x06, 0x4b, 0x84, 0xfd, 0x3a, 0xb3, 0x6f, 0xce, 0xfb, 0xed, 0xdb, + 0x92, 0xc1, 0x52, 0x49, 0x14, 0x52, 0xf9, 0x18, 0x72, 0x32, 0xf5, 0x41, 0x57, 0x56, 0xcd, 0xe5, + 0x89, 0x6c, 0x62, 0x1e, 0xb4, 0x69, 0x87, 0xea, 0x2c, 0x29, 0x3f, 0xd3, 0xc4, 0xfc, 0x6b, 0xa9, + 0xa3, 0x4d, 0x58, 0xa2, 0x3c, 0xc0, 0x49, 0x83, 0x8a, 0x04, 0x27, 0x03, 0xfd, 0x2d, 0xb3, 0xea, + 0x5b, 0x16, 0x29, 0xdf, 0xb6, 0x76, 0xf5, 0x29, 0x2f, 0xd3, 0x50, 0x3c, 0xe8, 0x89, 0x71, 0xb6, + 0xac, 0x42, 0x26, 0x21, 0x21, 0xa1, 0x67, 0x43, 0xbe, 0x0c, 0x75, 0x74, 0x13, 0x5c, 0x2b, 0xeb, + 0x46, 0xed, 0x5b, 0xca, 0x2c, 0x5a, 0xbb, 0x25, 0xcd, 0x04, 0x2f, 0xe6, 0xde, 0x8f, 0x17, 0x23, + 0x06, 0xa4, 0xfe, 0x1d, 0x03, 0x24, 0x83, 0x39, 0x0f, 0x62, 0x16, 0x87, 0x44, 0x91, 0x2c, 0xe5, + 0x67, 0x04, 0xe7, 0x0f, 0xa4, 0x3e, 0xd9, 0xcc, 0xf4, 0x1b, 0xcd, 0x34, 0xce, 0x6e, 0x42, 0x43, + 0x62, 0x78, 0x23, 0x9d, 0x87, 0x52, 0x47, 0x15, 0x70, 0x8d, 0x93, 0x25, 0x54, 0x0c, 0x82, 0x13, + 0x42, 0xbc, 0xcb, 0x6a, 0x4d, 0x51, 0xaf, 0x51, 0xe6, 0x3d, 0x42, 0x10, 0x82, 0x94, 0x62, 0x5e, + 0x46, 0x79, 0x95, 0xfc, 0x2e, 0xbc, 0x39, 0x8f, 0x94, 0x70, 0x2e, 0x29, 0xaf, 0x80, 0x2c, 0x33, + 0xe8, 0x71, 0x12, 0x79, 0x25, 0xb5, 0x72, 0xa1, 0x89, 0xf9, 0x23, 0x4e, 0x22, 0xf4, 0x0d, 0x2c, + 0x93, 0x93, 0x13, 0x12, 0x0a, 0x7a, 0x46, 0x82, 0xd1, 0xc7, 0x5d, 0x52, 0x2d, 0xae, 0x9a, 0x16, + 0x5f, 0x7f, 0x87, 0x16, 0xef, 0xcb, 0xb3, 0x3a, 0x84, 0xba, 0x6b, 0xbb, 0x52, 0x7d, 0x13, 0x5f, + 0x77, 0x76, 0x45, 0x55, 0x31, 0xb1, 0x5e, 0xb7, 0xf8, 0x2a, 0x80, 0xdc, 0x9c, 0x6e, 0xaf, 0x71, + 0x4a, 0x06, 0x8a, 0xdc, 0x59, 0x5f, 0x6e, 0xd7, 0xa1, 0x32, 0x9c, 0x33, 0x07, 0xf2, 0xff, 0xf5, + 0x1c, 0xb8, 0x0f, 0x79, 0x49, 0x96, 0x80, 0x69, 0x9a, 0x79, 0xde, 0xba, 0x53, 0xc9, 0xd5, 0x37, + 0x2f, 0x48, 0x30, 0x46, 0x4c, 0x3f, 0x17, 0x8e, 0x94, 0x2f, 0x53, 0x99, 0x82, 0x5b, 0x2a, 0xff, + 0x36, 0x0b, 0x69, 0x83, 0xbf, 0x0d, 0x69, 0x53, 0xba, 0xa3, 0x4a, 0xbf, 0x79, 0x11, 0x72, 0x28, + 0xfa, 0xa6, 0x60, 0x13, 0x88, 0x36, 0xa0, 0xa8, 0xa5, 0xa0, 0x43, 0x38, 0xc7, 0x4d, 0xa2, 0xf8, + 0x97, 0xf5, 0x0b, 0xda, 0x7a, 0x5f, 0x1b, 0xe5, 0xc8, 0x27, 0x49, 0xc2, 0x92, 0xe1, 0xaa, 0xb4, + 0x1e, 0xf9, 0xca, 0x68, 0x17, 0xdd, 0x82, 0x52, 0x1b, 0x73, 0xf1, 0xa8, 0x1b, 0x61, 0x41, 0x02, + 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0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x71, 0x5e, 0xf4, 0xef, 0xfc, 0x0d, 0x00, + 0x00, } func (m *InboundParams) Marshal() (dAtA []byte, err error) { @@ -1206,6 +1283,13 @@ func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ErrorMessageRevert) > 0 { + i -= len(m.ErrorMessageRevert) + copy(dAtA[i:], m.ErrorMessageRevert) + i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.ErrorMessageRevert))) + i-- + dAtA[i] = 0x3a + } if len(m.ErrorMessage) > 0 { i -= len(m.ErrorMessage) copy(dAtA[i:], m.ErrorMessage) @@ -1248,6 +1332,50 @@ func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *StatusMessages) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatusMessages) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StatusMessages) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ErrorMessageRevert) > 0 { + i -= len(m.ErrorMessageRevert) + copy(dAtA[i:], m.ErrorMessageRevert) + i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.ErrorMessageRevert))) + i-- + dAtA[i] = 0x1a + } + if len(m.ErrorMessageOutbound) > 0 { + i -= len(m.ErrorMessageOutbound) + copy(dAtA[i:], m.ErrorMessageOutbound) + i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.ErrorMessageOutbound))) + i-- + dAtA[i] = 0x12 + } + if len(m.StatusMessage) > 0 { + i -= len(m.StatusMessage) + copy(dAtA[i:], m.StatusMessage) + i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.StatusMessage))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *RevertOptions) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1596,6 +1724,31 @@ func (m *Status) Size() (n int) { if l > 0 { n += 1 + l + sovCrossChainTx(uint64(l)) } + l = len(m.ErrorMessageRevert) + if l > 0 { + n += 1 + l + sovCrossChainTx(uint64(l)) + } + return n +} + +func (m *StatusMessages) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StatusMessage) + if l > 0 { + n += 1 + l + sovCrossChainTx(uint64(l)) + } + l = len(m.ErrorMessageOutbound) + if l > 0 { + n += 1 + l + sovCrossChainTx(uint64(l)) + } + l = len(m.ErrorMessageRevert) + if l > 0 { + n += 1 + l + sovCrossChainTx(uint64(l)) + } return n } @@ -2873,6 +3026,184 @@ func (m *Status) Unmarshal(dAtA []byte) error { } m.ErrorMessage = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessageRevert", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrossChainTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCrossChainTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCrossChainTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMessageRevert = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCrossChainTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCrossChainTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatusMessages) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrossChainTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatusMessages: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatusMessages: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusMessage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrossChainTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCrossChainTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCrossChainTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatusMessage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessageOutbound", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrossChainTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCrossChainTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCrossChainTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMessageOutbound = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessageRevert", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrossChainTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCrossChainTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCrossChainTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMessageRevert = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCrossChainTx(dAtA[iNdEx:]) diff --git a/x/crosschain/types/status.go b/x/crosschain/types/status.go index 5ebdf5391c..ff1c14920e 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -9,19 +9,14 @@ func (m *Status) AbortRefunded() { m.StatusMessage = "CCTX aborted and Refunded" } -// UpdateStatusAndErrorMessages transitions the Status and Error messages. -func (m *Status) UpdateStatusAndErrorMessages(newStatus CctxStatus, statusMsg, errorMsg string) { - m.UpdateStatus(newStatus, statusMsg) - - if errorMsg != "" { - m.UpdateErrorMessage(errorMsg) - } +func (m *Status) UpdateStatusAndErrorMessages(newStatus CctxStatus, messages StatusMessages) { + m.UpdateStatus(newStatus) + m.UpdateErrorMessages(messages) } -// UpdateStatus updates the cctx status and cctx.status.status_message. -func (m *Status) UpdateStatus(newStatus CctxStatus, statusMsg string) { +// UpdateStatus updates the cctx status +func (m *Status) UpdateStatus(newStatus CctxStatus) { if m.ValidateTransition(newStatus) { - m.StatusMessage = fmt.Sprintf("Status changed from %s to %s", m.Status.String(), newStatus.String()) m.Status = newStatus } else { m.StatusMessage = fmt.Sprintf( @@ -29,24 +24,23 @@ func (m *Status) UpdateStatus(newStatus CctxStatus, statusMsg string) { m.Status.String(), newStatus.String(), ) - m.Status = CctxStatus_Aborted } - - if statusMsg != "" { - m.StatusMessage += fmt.Sprintf(": %s", statusMsg) - } } -// UpdateErrorMessage updates cctx.status.error_message. -func (m *Status) UpdateErrorMessage(errorMsg string) { - errMsg := errorMsg - - if errMsg == "" { - errMsg = "unknown error" +// UpdateErrorMessages updates cctx.status.error_message and cctx.status.error_message_revert. +func (m *Status) UpdateErrorMessages(messages StatusMessages) { + // Always update the status message , status should contain only the most recent update + m.StatusMessage = messages.StatusMessage + // We should be updating only one of these two messages at a time + if messages.ErrorMessageOutbound != "" { + m.ErrorMessage = messages.ErrorMessageOutbound + return + } + if messages.ErrorMessageRevert != "" { + m.ErrorMessageRevert = messages.ErrorMessageRevert + return } - - m.ErrorMessage = errMsg } func (m *Status) ValidateTransition(newStatus CctxStatus) bool { diff --git a/x/crosschain/types/status_test.go b/x/crosschain/types/status_test.go index f808f6e296..a73a1b5cb7 100644 --- a/x/crosschain/types/status_test.go +++ b/x/crosschain/types/status_test.go @@ -1,7 +1,6 @@ package types_test import ( - "fmt" "testing" "github.com/stretchr/testify/assert" @@ -140,38 +139,21 @@ func TestStatus_ChangeStatus(t *testing.T) { t.Run("should change status and msg if transition is valid", func(t *testing.T) { s := types.Status{Status: types.CctxStatus_PendingInbound} - s.UpdateStatus(types.CctxStatus_PendingOutbound, "msg") + s.UpdateStatus(types.CctxStatus_PendingOutbound) assert.Equal(t, s.Status, types.CctxStatus_PendingOutbound) - assert.Equal(t, s.StatusMessage, "Status changed from PendingInbound to PendingOutbound: msg") }) t.Run("should change status if transition is valid", func(t *testing.T) { s := types.Status{Status: types.CctxStatus_PendingInbound} - s.UpdateStatus(types.CctxStatus_PendingOutbound, "") - fmt.Printf("%+v\n", s) + s.UpdateStatus(types.CctxStatus_PendingOutbound) assert.Equal(t, s.Status, types.CctxStatus_PendingOutbound) - assert.Equal(t, s.StatusMessage, fmt.Sprintf( - "Status changed from %s to %s", - types.CctxStatus_PendingInbound.String(), - types.CctxStatus_PendingOutbound.String()), - ) }) t.Run("should change status to aborted and msg if transition is invalid", func(t *testing.T) { s := types.Status{Status: types.CctxStatus_PendingOutbound} - - s.UpdateStatus(types.CctxStatus_PendingInbound, "msg") + s.UpdateStatus(types.CctxStatus_PendingInbound) assert.Equal(t, s.Status, types.CctxStatus_Aborted) - assert.Equal( - t, - fmt.Sprintf( - "Failed to transition status from %s to %s: msg", - types.CctxStatus_PendingOutbound.String(), - types.CctxStatus_PendingInbound.String(), - ), - s.StatusMessage, - ) }) } @@ -216,3 +198,74 @@ func TestCctxStatus_IsPendingStatus(t *testing.T) { }) } } + +func TestStatus_UpdateErrorMessages(t *testing.T) { + t.Run("should update only status message if error message outbound is empty", func(t *testing.T) { + m := types.Status{ + StatusMessage: "old status message", + ErrorMessage: "old error message", + ErrorMessageRevert: "old error message revert", + } + messages := types.StatusMessages{ + StatusMessage: "status message", + } + m.UpdateErrorMessages(messages) + require.Equal(t, messages.StatusMessage, m.StatusMessage) + require.Equal(t, "old error message", m.ErrorMessage) + require.Equal(t, "old error message revert", m.ErrorMessageRevert) + }) + + t.Run("should update only status message and revert message if outbound message is empty", func(t *testing.T) { + m := types.Status{ + StatusMessage: "old status message", + ErrorMessage: "old error message", + ErrorMessageRevert: "old error message revert", + } + messages := types.StatusMessages{ + StatusMessage: "status message", + ErrorMessageRevert: "error message revert", + } + m.UpdateErrorMessages(messages) + require.Equal(t, messages.StatusMessage, m.StatusMessage) + require.Equal(t, "old error message", m.ErrorMessage) + require.Equal(t, messages.ErrorMessageRevert, m.ErrorMessageRevert) + }) + + t.Run("should update only status message and outbound message if revert message is empty", func(t *testing.T) { + m := types.Status{ + StatusMessage: "old status message", + ErrorMessage: "old error message", + ErrorMessageRevert: "old error message revert", + } + messages := types.StatusMessages{ + StatusMessage: "status message", + ErrorMessageOutbound: "error message outbound", + } + m.UpdateErrorMessages(messages) + require.Equal(t, messages.StatusMessage, m.StatusMessage) + require.Equal(t, messages.ErrorMessageOutbound, m.ErrorMessage) + require.Equal(t, "old error message revert", m.ErrorMessageRevert) + }) + + t.Run("multiple updates to status message should only keep the most recent one", func(t *testing.T) { + m := types.Status{ + StatusMessage: "old status message", + } + messages := types.StatusMessages{ + StatusMessage: "new status message 1", + ErrorMessageOutbound: "new error message outbound", + } + m.UpdateErrorMessages(messages) + require.Equal(t, messages.StatusMessage, m.StatusMessage) + require.Equal(t, messages.ErrorMessageOutbound, m.ErrorMessage) + require.Equal(t, "", m.ErrorMessageRevert) + messages2 := types.StatusMessages{ + StatusMessage: "new status message 2", + ErrorMessageRevert: "new error message revert", + } + m.UpdateErrorMessages(messages2) + require.Equal(t, messages2.StatusMessage, m.StatusMessage) + require.Equal(t, messages.ErrorMessageOutbound, m.ErrorMessage) + require.Equal(t, messages2.ErrorMessageRevert, m.ErrorMessageRevert) + }) +} diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index bd4c1845ac..00fd7dd6bd 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -1001,9 +1001,9 @@ type MsgVoteInbound struct { SenderChainId int64 `protobuf:"varint,3,opt,name=sender_chain_id,json=senderChainId,proto3" json:"sender_chain_id,omitempty"` Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"` ReceiverChain int64 `protobuf:"varint,5,opt,name=receiver_chain,json=receiverChain,proto3" json:"receiver_chain,omitempty"` - // string zeta_burnt = 6; + // string zeta_burnt = 6; Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"` - // string mMint = 7; + // string mMint = 7; Message string `protobuf:"bytes,8,opt,name=message,proto3" json:"message,omitempty"` InboundHash string `protobuf:"bytes,9,opt,name=inbound_hash,json=inboundHash,proto3" json:"inbound_hash,omitempty"` InboundBlockHeight uint64 `protobuf:"varint,10,opt,name=inbound_block_height,json=inboundBlockHeight,proto3" json:"inbound_block_height,omitempty"` diff --git a/x/fungible/types/evm_error_message.go b/x/fungible/types/evm_error_message.go new file mode 100644 index 0000000000..37eaea537f --- /dev/null +++ b/x/fungible/types/evm_error_message.go @@ -0,0 +1,24 @@ +package types + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/common" +) + +func EvmErrorMessage(method string, contract common.Address, args interface{}) string { + return fmt.Sprintf( + "contract call failed: method '%s', contract '%s', args: %v", + method, + contract.Hex(), + args, + ) +} + +func EvmErrorMessageWithRevertError(errorMessage string, reason interface{}) string { + return fmt.Sprintf( + "%s, reason: %v", + errorMessage, + reason, + ) +} diff --git a/x/fungible/types/evm_error_message_test.go b/x/fungible/types/evm_error_message_test.go new file mode 100644 index 0000000000..f0cacf458f --- /dev/null +++ b/x/fungible/types/evm_error_message_test.go @@ -0,0 +1,30 @@ +package types_test + +import ( + "fmt" + strings2 "strings" + "testing" +) + +func TestEvmErrorMessage(t *testing.T) { + msg := "'deposit error: contract call failed: method ''depositAndCall''," + + "contract ''0xEdf1c3275d13489aCdC6cD6eD246E72458B8795B'', " + + "args: [{[116 98 49 113 97 106 120 113 100 97 118 103 55 113 101 48 115 54 99 48 117 113 53 120" + + "106 119 109 114 99 110 109 102 108 122 113 107 118 54 119 114 120 106] " + + "0x0000000000000000000000000000000000000000 18332} 0x65a45c57636f9BcCeD4fe193A602008578BcA90b 63200 0xE869b85987D86d8fBb8913f97A705B4741edE86E" + + " [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" + + " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64 0 0 0 0 0 0 0 0 0 0 0 0" + + " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 31 8 114 173 89 103 28 32 216 199 223" + + "23 218 144 178 97 227 198 29 206 71 31 177 222 58 199 57 100 26 67 128 175 0" + + "0 0 0 0 0 0 0 0 0 0 0 218 36 85 178 188 153 144 104 42 30 240 191 138 190 201" + + "21 130 93 66 147 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 54 53 201 173" + + "197 222 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" + + "0 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 65 46 162" + + " 174 30 134 233 247 163 75 144 111 131 184 223 203 158 35 65 101 101 0 0 145" + + "201 152 4 164 227 47 62 58 31 93 187 156 163 80 241 90 43 228 232 154 218 235 128 16 101 154 240 57 245 109 126 166 4 110 64 228 217 198 230 231 192 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]]" + + ": execution reverted:ret 0x2cdcef78000000000000000000000000e869b85987d86d8fbb8913f97a705b4741ede86e000000000000000000000000da2455b2bc9990682a1ef0bf8abec915825d42930000000000000000000000000000000000000000000000000000000000001b59:evm transaction execution failed, processing error: outTxGasFee(127200) more than available gas for tx (63200) | Identifiers : tb1qajxqdavg7qe0s6c0uq5xjwmrcnmflzqkv6wrxj-18332-18332-0: not enough gas'" + strings := strings2.Split(msg, ",") + for i, s := range strings { + fmt.Println(i, s) + } +}