From 2580332ebeaf3956a17ea2d6cd3c12bf4a25f40b Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Tue, 1 Oct 2024 23:05:19 +0200 Subject: [PATCH 01/10] feat: add error field in cctx --- .../zetacore/crosschain/cross_chain_tx.proto | 3 +- testutil/sample/crosschain.go | 1 + x/crosschain/keeper/cctx_gateway_observers.go | 2 +- x/crosschain/keeper/cctx_gateway_zevm.go | 2 +- .../cctx_orchestrator_validate_outbound.go | 24 +- x/crosschain/keeper/initiate_outbound.go | 2 +- .../keeper/msg_server_migrate_tss_funds.go | 3 +- .../keeper/msg_server_vote_outbound_tx.go | 2 +- x/crosschain/migrations/v5/migrate.go | 1 + x/crosschain/types/cctx.go | 34 ++- x/crosschain/types/cctx_test.go | 56 ++++- x/crosschain/types/cross_chain_tx.pb.go | 221 +++++++++++------- x/crosschain/types/keys.go | 6 +- x/crosschain/types/rate_limiter_flags_test.go | 3 +- 14 files changed, 235 insertions(+), 125 deletions(-) diff --git a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto index 0ca1f56f7d..4baa375c65 100644 --- a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto +++ b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto @@ -17,7 +17,7 @@ enum CctxStatus { Reverted = 5; // inbound reverted. Aborted = 6; // inbound tx error or invalid paramters and cannot revert; just abort. - // But the amount can be refunded to zetachain using and admin proposal + // But the amount can be refunded to zetachain using and admin proposal } enum TxFinalizationStatus { @@ -135,4 +135,5 @@ message CrossChainTx { repeated OutboundParams outbound_params = 10; ProtocolContractVersion protocol_contract_version = 11; RevertOptions revert_options = 12 [ (gogoproto.nullable) = false ]; + string error = 13; } diff --git a/testutil/sample/crosschain.go b/testutil/sample/crosschain.go index 8f09271e23..059fd2bf9c 100644 --- a/testutil/sample/crosschain.go +++ b/testutil/sample/crosschain.go @@ -213,6 +213,7 @@ func CrossChainTx(t *testing.T, index string) *types.CrossChainTx { OutboundParams: []*types.OutboundParams{OutboundParams(r), OutboundParams(r)}, ProtocolContractVersion: types.ProtocolContractVersion_V1, RevertOptions: types.NewEmptyRevertOptions(), + Error: "", } } diff --git a/x/crosschain/keeper/cctx_gateway_observers.go b/x/crosschain/keeper/cctx_gateway_observers.go index 39a33f4edc..e4f92b3293 100644 --- a/x/crosschain/keeper/cctx_gateway_observers.go +++ b/x/crosschain/keeper/cctx_gateway_observers.go @@ -75,7 +75,7 @@ func (c CCTXGatewayObservers) InitiateOutbound( }() if err != nil { // do not commit anything here as the CCTX should be aborted - config.CCTX.SetAbort(err.Error()) + config.CCTX.SetAbort(true, 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 81366d6af3..d977b0bcb9 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -28,7 +28,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound( if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX - config.CCTX.SetAbort(err.Error()) + config.CCTX.SetAbort(true, 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 17c848613a..53ccc35ef1 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -53,7 +53,7 @@ func (k Keeper) ValidateOutboundZEVM( cctx.InboundParams.Amount, ) if err != nil { - cctx.SetAbort(fmt.Sprintf("%s : %s", depositErr, err.Error())) + cctx.SetAbort(true, fmt.Sprintf("%s : %s", depositErr, err.Error())) return types.CctxStatus_Aborted } @@ -122,7 +122,7 @@ 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, cmd cctx reverted") + cctx.SetAbort(true, "Outbound failed: cmd cctx reverted") } else if chains.IsZetaChain(cctx.InboundParams.SenderChainId, k.GetAuthorityKeeper().GetAdditionalChainList(ctx)) { switch cctx.InboundParams.CoinType { // Try revert if the coin-type is ZETA @@ -137,7 +137,7 @@ 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(true, "Outbound failed for non-ZETA cctx") } } } else { @@ -195,10 +195,10 @@ 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(true, revertMsg) case types.CctxStatus_PendingRevert: cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort("Outbound failed: revert failed; abort TX") + cctx.SetAbort(true, "Outbound failed: revert failed; abort TX") } return nil } @@ -225,9 +225,9 @@ func (k Keeper) processSuccessfulOutbound( oldStatus := cctx.CctxStatus.Status switch oldStatus { case types.CctxStatus_PendingRevert: - cctx.SetReverted("Outbound succeeded, revert executed") + cctx.SetReverted(false, "Outbound succeeded: revert executed") case types.CctxStatus_PendingOutbound: - cctx.SetOutboundMined("Outbound succeeded, mined") + cctx.SetOutboundMined(false, "Outbound succeeded: mined") default: return } @@ -256,7 +256,7 @@ 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, trying revert") + cctx.SetPendingRevert(true, "Outbound failed: trying to revert") data, err := base64.StdEncoding.DecodeString(cctx.RelayedMessage) if err != nil { return fmt.Errorf("failed decoding relayed message: %s", err.Error()) @@ -290,7 +290,7 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro return fmt.Errorf("failed ZETARevertAndCallContract: %s", err.Error()) } - cctx.SetReverted("Outbound failed, revert executed") + cctx.SetReverted(true, "Outbound failed: revert executed") if len(ctx.TxBytes()) > 0 { // add event for tendermint transaction hash format hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()) @@ -336,7 +336,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // update status - cctx.SetPendingRevert("Outbound failed, trying revert") + cctx.SetPendingRevert(true, "Outbound failed: trying revert") // process the revert on ZEVM if err := k.fungibleKeeper.ProcessV2RevertDeposit( @@ -354,7 +354,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // tx is reverted - cctx.SetReverted("Outbound failed, revert executed") + cctx.SetReverted(true, "Outbound failed: revert executed") // add event for tendermint transaction hash format if len(ctx.TxBytes()) > 0 { @@ -367,7 +367,7 @@ 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("Outbound failed: revert failed; abort TX") + cctx.SetAbort(true, "Outbound failed: revert failed; abort TX") } return nil } diff --git a/x/crosschain/keeper/initiate_outbound.go b/x/crosschain/keeper/initiate_outbound.go index 5339cd4150..9de817ff75 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(false, "") return cctxGateway.InitiateOutbound(ctx, config) } diff --git a/x/crosschain/keeper/msg_server_migrate_tss_funds.go b/x/crosschain/keeper/msg_server_migrate_tss_funds.go index c285033f02..8ecc4c47ff 100644 --- a/x/crosschain/keeper/msg_server_migrate_tss_funds.go +++ b/x/crosschain/keeper/msg_server_migrate_tss_funds.go @@ -9,7 +9,6 @@ import ( tmbytes "github.com/cometbft/cometbft/libs/bytes" tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/errors" authoritytypes "github.com/zeta-chain/node/x/authority/types" "github.com/zeta-chain/node/x/crosschain/types" @@ -26,7 +25,7 @@ func (k msgServer) MigrateTssFunds( // check if authorized err := k.GetAuthorityKeeper().CheckAuthorization(ctx, msg) if err != nil { - return nil, errors.Wrap(authoritytypes.ErrUnauthorized, err.Error()) + return nil, errorsmod.Wrap(authoritytypes.ErrUnauthorized, err.Error()) } if k.zetaObserverKeeper.IsInboundEnabled(ctx) { diff --git a/x/crosschain/keeper/msg_server_vote_outbound_tx.go b/x/crosschain/keeper/msg_server_vote_outbound_tx.go index 6682c2c705..c114fd5404 100644 --- a/x/crosschain/keeper/msg_server_vote_outbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx.go @@ -185,7 +185,7 @@ 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(true, errMessage) ctx.Logger().Error(errMessage) k.SaveOutbound(ctx, cctx, tssPubkey) } diff --git a/x/crosschain/migrations/v5/migrate.go b/x/crosschain/migrations/v5/migrate.go index aeeb22451f..0f21d8646b 100644 --- a/x/crosschain/migrations/v5/migrate.go +++ b/x/crosschain/migrations/v5/migrate.go @@ -137,6 +137,7 @@ func SetZetaAccounting( return nil } + func GetAbortedAmount(cctx types.CrossChainTx) sdkmath.Uint { if cctx.OutboundParams != nil && !cctx.GetCurrentOutboundParam().Amount.IsZero() { return cctx.GetCurrentOutboundParam().Amount diff --git a/x/crosschain/types/cctx.go b/x/crosschain/types/cctx.go index 0a235dffae..fc64000121 100644 --- a/x/crosschain/types/cctx.go +++ b/x/crosschain/types/cctx.go @@ -170,29 +170,42 @@ func (m *CrossChainTx) AddOutbound( return nil } +func (m *CrossChainTx) ChangeStatus(newStatus CctxStatus, isError bool, msg string) { + switch { + case isError && msg == "": + m.CctxStatus.ChangeStatus(newStatus, "") + m.Error = "unexpected error" + case isError && msg != "": + m.CctxStatus.ChangeStatus(newStatus, "") + m.Error = msg + case !isError: + m.CctxStatus.ChangeStatus(newStatus, msg) + } +} + // SetAbort sets the CCTX status to Aborted with the given error message. -func (m CrossChainTx) SetAbort(message string) { - m.CctxStatus.ChangeStatus(CctxStatus_Aborted, message) +func (m *CrossChainTx) SetAbort(isError bool, msg string) { + m.ChangeStatus(CctxStatus_Aborted, isError, msg) } // SetPendingRevert sets the CCTX status to PendingRevert with the given error message. -func (m CrossChainTx) SetPendingRevert(message string) { - m.CctxStatus.ChangeStatus(CctxStatus_PendingRevert, message) +func (m *CrossChainTx) SetPendingRevert(isError bool, msg string) { + m.ChangeStatus(CctxStatus_PendingRevert, isError, msg) } // SetPendingOutbound sets the CCTX status to PendingOutbound with the given error message. -func (m CrossChainTx) SetPendingOutbound(message string) { - m.CctxStatus.ChangeStatus(CctxStatus_PendingOutbound, message) +func (m *CrossChainTx) SetPendingOutbound(isError bool, msg string) { + m.ChangeStatus(CctxStatus_PendingOutbound, isError, msg) } // SetOutboundMined sets the CCTX status to OutboundMined with the given error message. -func (m CrossChainTx) SetOutboundMined(message string) { - m.CctxStatus.ChangeStatus(CctxStatus_OutboundMined, message) +func (m *CrossChainTx) SetOutboundMined(isError bool, msg string) { + m.ChangeStatus(CctxStatus_OutboundMined, isError, msg) } // SetReverted sets the CCTX status to Reverted with the given error message. -func (m CrossChainTx) SetReverted(message string) { - m.CctxStatus.ChangeStatus(CctxStatus_Reverted, message) +func (m *CrossChainTx) SetReverted(isError bool, msg string) { + m.ChangeStatus(CctxStatus_Reverted, isError, msg) } func (m CrossChainTx) GetCCTXIndexBytes() ([32]byte, error) { @@ -273,6 +286,7 @@ func NewCCTX(ctx sdk.Context, msg MsgVoteInbound, tssPubkey string) (CrossChainT OutboundParams: []*OutboundParams{outboundParams}, ProtocolContractVersion: msg.ProtocolContractVersion, RevertOptions: msg.RevertOptions, + Error: "", } // TODO: remove this validate call diff --git a/x/crosschain/types/cctx_test.go b/x/crosschain/types/cctx_test.go index 00fbe2ac66..d3c5745d29 100644 --- a/x/crosschain/types/cctx_test.go +++ b/x/crosschain/types/cctx_test.go @@ -150,39 +150,83 @@ func Test_SetRevertOutboundValues(t *testing.T) { func TestCrossChainTx_SetAbort(t *testing.T) { cctx := sample.CrossChainTx(t, "test") - cctx.SetAbort("test") + cctx.SetAbort(false, "test") require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) - require.Equal(t, "test", "test") + require.Contains(t, cctx.CctxStatus.StatusMessage, "test") +} + +func TestCrossChainTx_SetAbortWithError(t *testing.T) { + cctx := sample.CrossChainTx(t, "test") + cctx.SetAbort(true, "test") + require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) + require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") + require.Equal(t, "test", cctx.Error) } func TestCrossChainTx_SetPendingRevert(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetPendingRevert("test") + cctx.SetPendingRevert(false, "test") require.Equal(t, types.CctxStatus_PendingRevert, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") } +func TestCrossChainTx_SetPendingWithError(t *testing.T) { + cctx := sample.CrossChainTx(t, "test") + cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound + cctx.SetPendingRevert(true, "test") + require.Equal(t, types.CctxStatus_PendingRevert, cctx.CctxStatus.Status) + require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") + require.Equal(t, "test", cctx.Error) +} + func TestCrossChainTx_SetPendingOutbound(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingInbound - cctx.SetPendingOutbound("test") + cctx.SetPendingOutbound(false, "test") require.Equal(t, types.CctxStatus_PendingOutbound, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") } +func TestCrossChainTx_SetPendingOutboundWithError(t *testing.T) { + cctx := sample.CrossChainTx(t, "test") + cctx.CctxStatus.Status = types.CctxStatus_PendingInbound + cctx.SetPendingOutbound(true, "test") + require.Equal(t, types.CctxStatus_PendingOutbound, cctx.CctxStatus.Status) + require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") + require.Equal(t, "test", cctx.Error) +} + func TestCrossChainTx_SetOutboundMined(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetOutboundMined("test") + cctx.SetOutboundMined(false, "test") require.Equal(t, types.CctxStatus_OutboundMined, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") } +func TestCrossChainTx_SetOutboundMinedWithError(t *testing.T) { + cctx := sample.CrossChainTx(t, "test") + cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound + cctx.SetOutboundMined(true, "test") + require.Equal(t, types.CctxStatus_OutboundMined, cctx.CctxStatus.Status) + require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") + require.Contains(t, cctx.Error, "test") +} + func TestCrossChainTx_SetReverted(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingRevert - cctx.SetReverted("test") + cctx.SetReverted(false, "test") require.Equal(t, types.CctxStatus_Reverted, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") } + +func TestCrossChainTx_SetRevertedWithError(t *testing.T) { + cctx := sample.CrossChainTx(t, "test") + cctx.CctxStatus.Status = types.CctxStatus_PendingRevert + cctx.SetReverted(true, "test") + require.Equal(t, types.CctxStatus_Reverted, cctx.CctxStatus.Status) + require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") + require.Contains(t, cctx.Error, "test") +} diff --git a/x/crosschain/types/cross_chain_tx.pb.go b/x/crosschain/types/cross_chain_tx.pb.go index 842ba310ba..76f9e9ed53 100644 --- a/x/crosschain/types/cross_chain_tx.pb.go +++ b/x/crosschain/types/cross_chain_tx.pb.go @@ -644,6 +644,7 @@ type CrossChainTx struct { OutboundParams []*OutboundParams `protobuf:"bytes,10,rep,name=outbound_params,json=outboundParams,proto3" json:"outbound_params,omitempty"` ProtocolContractVersion ProtocolContractVersion `protobuf:"varint,11,opt,name=protocol_contract_version,json=protocolContractVersion,proto3,enum=zetachain.zetacore.crosschain.ProtocolContractVersion" json:"protocol_contract_version,omitempty"` RevertOptions RevertOptions `protobuf:"bytes,12,opt,name=revert_options,json=revertOptions,proto3" json:"revert_options"` + Error string `protobuf:"bytes,13,opt,name=error,proto3" json:"error,omitempty"` } func (m *CrossChainTx) Reset() { *m = CrossChainTx{} } @@ -735,6 +736,13 @@ func (m *CrossChainTx) GetRevertOptions() RevertOptions { return RevertOptions{} } +func (m *CrossChainTx) GetError() string { + if m != nil { + return m.Error + } + return "" +} + func init() { proto.RegisterEnum("zetachain.zetacore.crosschain.CctxStatus", CctxStatus_name, CctxStatus_value) proto.RegisterEnum("zetachain.zetacore.crosschain.TxFinalizationStatus", TxFinalizationStatus_name, TxFinalizationStatus_value) @@ -753,92 +761,92 @@ func init() { } var fileDescriptor_d4c1966807fb5cb2 = []byte{ - // 1348 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,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c, 0x92, 0x56, 0xef, 0x48, 0xed, 0x5e, 0x84, 0xfe, 0x07, 0x79, 0x31, 0x0c, 0x58, 0x4a, 0x3b, - 0x34, 0xf1, 0xe6, 0x14, 0x44, 0x4e, 0x0c, 0xf7, 0x95, 0x8c, 0xb6, 0x21, 0x2f, 0x83, 0x07, 0x62, - 0xd4, 0x27, 0x5e, 0x66, 0xcd, 0xa9, 0x97, 0x5b, 0xeb, 0x8d, 0x73, 0xbe, 0xaf, 0x7f, 0xd2, 0x69, - 0xa8, 0x2c, 0x77, 0x18, 0x4d, 0x0e, 0x47, 0x7d, 0xe2, 0xe7, 0x42, 0xb3, 0x42, 0x15, 0x98, 0xc7, - 0x9c, 0x13, 0xe1, 0xcd, 0x2b, 0x70, 0x2d, 0xa0, 0xfb, 0x90, 0xc5, 0x3d, 0x36, 0x48, 0x84, 0x97, - 0x95, 0xea, 0xed, 0xe6, 0x8b, 0x57, 0x37, 0x66, 0x7e, 0x7f, 0x75, 0xe3, 0x56, 0x87, 0x8a, 0xee, - 0xa0, 0xdd, 0x08, 0x59, 0xaf, 0x19, 0x32, 0xde, 0x63, 0xdc, 0xfc, 0x6c, 0xf2, 0xe8, 0xa4, 0x29, - 0xf3, 0xe0, 0x8d, 0x27, 0x34, 0x11, 0xbe, 0x71, 0x47, 0x1f, 0x41, 0x89, 0xb5, 0x39, 0x49, 0x4f, - 0x49, 0x14, 0x74, 0x31, 0xef, 0x7a, 0x0b, 0x2a, 0x4c, 0xd1, 0x2a, 0x1f, 0x60, 0xde, 0x45, 0x9f, - 0x83, 0x37, 0xde, 0x44, 0x86, 0x82, 0xa4, 0x09, 0x8e, 0x83, 0x2e, 0xa1, 0x9d, 0xae, 0xf0, 0x72, - 0x6b, 0x4e, 0x3d, 0xe3, 0xaf, 0x58, 0xfb, 0x3d, 0x63, 0x7e, 0xa0, 0xac, 0xe8, 0xff, 0x50, 0x6c, - 0xe3, 0x38, 0x66, 0x22, 0xa0, 0x49, 0x44, 0x86, 0x5e, 0x5e, 0xa1, 0x17, 0xb4, 0x6e, 0x4f, 0xaa, - 0x50, 0x0b, 0xae, 0x1c, 0xd3, 0x04, 0xc7, 0xf4, 0x39, 0x89, 0x02, 0x59, 0x12, 0x8b, 0x0c, 0x0a, - 0x79, 0x79, 0x6c, 0x7c, 0x46, 0x04, 0x36, 0xb0, 0x14, 0x56, 0xc4, 0x30, 0x30, 0x16, 0x2c, 0x28, - 0x4b, 0x02, 0x2e, 0xb0, 0x18, 0x70, 0xaf, 0xa0, 0xaa, 0x7c, 0xb7, 0x71, 0x61, 0x17, 0x35, 0x0e, - 0x87, 0xbb, 0x67, 0x7c, 0x1f, 0x2b, 0x57, 0xbf, 0x22, 0xce, 0xd1, 0xd6, 0xbe, 0x83, 0xb2, 0x0c, - 0xbc, 0x15, 0x86, 0xb2, 0x5e, 0x34, 0xe9, 0xa0, 0x00, 0x96, 0x71, 0x9b, 0xa5, 0xc2, 0xa6, 0x6b, + // 1360 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6e, 0x1b, 0xb7, + 0x13, 0xd7, 0xda, 0x92, 0x2c, 0x8d, 0x3e, 0xbc, 0xa6, 0x15, 0x67, 0xe3, 0x3f, 0xa2, 0xf8, 0xaf, + 0xd6, 0x89, 0xe2, 0xd6, 0x12, 0xa2, 0x00, 0x45, 0xd1, 0x9b, 0x6d, 0xc4, 0x89, 0xdb, 0x26, 0x36, + 0x36, 0x8e, 0x81, 0xe4, 0xd0, 0x2d, 0xb5, 0x4b, 0x4b, 0x84, 0xa5, 0xa5, 0xba, 0xa4, 0x0c, 0x29, + 0xe8, 0xad, 0x2f, 0xd0, 0x77, 0x68, 0x0f, 0x3d, 0xf6, 0x31, 0x72, 0xcc, 0xb1, 0xe8, 0x21, 0x08, + 0x92, 0x37, 0xe8, 0xb9, 0x87, 0x82, 0x5f, 0x92, 0x15, 0xb8, 0x76,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, 0x46, 0x1b, 0xb0, 0x44, 0x79, 0x80, 0x93, 0x36, 0x15, + 0x09, 0x4e, 0xc6, 0x41, 0x88, 0x7b, 0x3d, 0xd5, 0xa9, 0x39, 0x7f, 0x91, 0xf2, 0x2d, 0xab, 0x97, + 0x78, 0xb5, 0xd7, 0x59, 0x28, 0xef, 0x0f, 0xc5, 0xd9, 0xf6, 0x5f, 0x85, 0x5c, 0x42, 0x42, 0x42, + 0x4f, 0x27, 0x04, 0x98, 0xc8, 0xe8, 0x36, 0xb8, 0x76, 0xad, 0x49, 0xb0, 0x67, 0x39, 0xb0, 0x68, + 0xf5, 0x96, 0x05, 0x33, 0x8d, 0x3e, 0xff, 0x61, 0x8d, 0x3e, 0x6d, 0xe9, 0xf4, 0xbf, 0x6b, 0x69, + 0x49, 0x49, 0xce, 0x83, 0x98, 0xc5, 0x21, 0x51, 0xac, 0x49, 0xfb, 0x39, 0xc1, 0xf9, 0x23, 0x29, + 0xcf, 0x16, 0x33, 0xfb, 0x4e, 0x31, 0x8d, 0x71, 0x90, 0xd0, 0x90, 0x18, 0x22, 0x48, 0xe3, 0x81, + 0x94, 0x51, 0x1d, 0x5c, 0x63, 0x64, 0x09, 0x15, 0xe3, 0xe0, 0x98, 0x10, 0xef, 0xaa, 0xda, 0x53, + 0xd6, 0x7b, 0x94, 0x7a, 0x97, 0x10, 0x84, 0x20, 0xad, 0xa8, 0x94, 0x53, 0x56, 0xb5, 0x7e, 0x1f, + 0x22, 0x5c, 0xc4, 0x32, 0xb8, 0x90, 0x65, 0xd7, 0x40, 0xa6, 0x19, 0x0c, 0x39, 0x89, 0xbc, 0x8a, + 0xda, 0xb9, 0xd0, 0xc1, 0xfc, 0x09, 0x27, 0x11, 0xfa, 0x06, 0x96, 0xc9, 0xf1, 0x31, 0x09, 0x05, + 0x3d, 0x25, 0xc1, 0xf4, 0xe3, 0xae, 0xa8, 0x12, 0x37, 0x4c, 0x89, 0x6f, 0xbe, 0x47, 0x89, 0xf7, + 0x64,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, 0x4c, 0xec, 0xda, 0x37, 0x9f, 0x9b, 0x42, 0x25, 0xc8, + 0x4f, 0x45, 0x47, 0x22, 0xdf, 0x1b, 0x91, 0x70, 0x28, 0xc1, 0xe6, 0x0c, 0x58, 0x13, 0xae, 0xfe, + 0x4d, 0xbd, 0x51, 0x16, 0xe6, 0x8e, 0xee, 0xb8, 0x29, 0xf5, 0xdb, 0x72, 0x1d, 0xed, 0xb0, 0x7d, + 0xff, 0xc5, 0x9b, 0xaa, 0xf3, 0xf2, 0x4d, 0xd5, 0x79, 0xfd, 0xa6, 0xea, 0xfc, 0xf8, 0xb6, 0x9a, + 0x7a, 0xf9, 0xb6, 0x9a, 0xfa, 0xed, 0x6d, 0x35, 0xf5, 0x6c, 0xf3, 0x0c, 0xbf, 0x64, 0xb9, 0x37, + 0xf5, 0xbf, 0x8a, 0x98, 0x45, 0xa4, 0x39, 0x3a, 0xfb, 0xe7, 0x45, 0x51, 0xad, 0x9d, 0x55, 0xc7, + 0x79, 0xf7, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x69, 0x53, 0x70, 0x6b, 0xea, 0x0c, 0x00, 0x00, } func (m *InboundParams) Marshal() (dAtA []byte, err error) { @@ -1291,6 +1299,13 @@ func (m *CrossChainTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x6a + } { size, err := m.RevertOptions.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1616,6 +1631,10 @@ func (m *CrossChainTx) Size() (n int) { } l = m.RevertOptions.Size() n += 1 + l + sovCrossChainTx(uint64(l)) + l = len(m.Error) + if l > 0 { + n += 1 + l + sovCrossChainTx(uint64(l)) + } return n } @@ -3313,6 +3332,38 @@ func (m *CrossChainTx) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", 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.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCrossChainTx(dAtA[iNdEx:]) diff --git a/x/crosschain/types/keys.go b/x/crosschain/types/keys.go index d9fea4a77d..76d343dd3e 100644 --- a/x/crosschain/types/keys.go +++ b/x/crosschain/types/keys.go @@ -3,7 +3,7 @@ package types import ( "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/math" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" ) @@ -29,8 +29,8 @@ const ( CCTXIndexLength = 66 ) -func GetProtocolFee() sdk.Uint { - return sdk.NewUint(ProtocolFee) +func GetProtocolFee() math.Uint { + return math.NewUint(ProtocolFee) } func KeyPrefix(p string) []byte { diff --git a/x/crosschain/types/rate_limiter_flags_test.go b/x/crosschain/types/rate_limiter_flags_test.go index 8531a34105..545ef708a7 100644 --- a/x/crosschain/types/rate_limiter_flags_test.go +++ b/x/crosschain/types/rate_limiter_flags_test.go @@ -6,7 +6,6 @@ import ( "testing" "cosmossdk.io/math" - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -263,7 +262,7 @@ func TestConvertCctxValue(t *testing.T) { erc20AssetRates map[int64]map[string]types.AssetRate // output - expectedValue sdkmath.Int + expectedValue math.Int }{ { name: "should convert cctx ZETA value correctly", From 823c5c936a5ce0e9943d740359bb7c9bfe0ff466 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 2 Oct 2024 14:24:54 +0200 Subject: [PATCH 02/10] feat: divide messages into status and error --- docs/cli/zetacored/cli.md | 2 +- docs/openapi/openapi.swagger.yaml | 2 + go.mod | 1 + .../zetacore/crosschain/cross_chain_tx.proto | 2 +- testutil/sample/crosschain.go | 1 - .../crosschain/cross_chain_tx_pb.d.ts | 5 + x/crosschain/keeper/cctx_gateway_observers.go | 2 +- x/crosschain/keeper/cctx_gateway_zevm.go | 2 +- .../cctx_orchestrator_validate_outbound.go | 24 +- x/crosschain/keeper/initiate_outbound.go | 2 +- .../keeper/msg_server_vote_inbound_tx_test.go | 4 +- .../keeper/msg_server_vote_outbound_tx.go | 2 +- x/crosschain/types/cctx.go | 34 +-- x/crosschain/types/cctx_test.go | 60 +--- x/crosschain/types/cross_chain_tx.pb.go | 275 +++++++++--------- x/crosschain/types/status.go | 36 ++- x/crosschain/types/status_test.go | 12 +- 17 files changed, 219 insertions(+), 247 deletions(-) diff --git a/docs/cli/zetacored/cli.md b/docs/cli/zetacored/cli.md index 36440f2704..a8719cf83f 100644 --- a/docs/cli/zetacored/cli.md +++ b/docs/cli/zetacored/cli.md @@ -9441,7 +9441,7 @@ zetacored tx crosschain vote-gas-price [chain] [price] [priorityFee] [blockNumbe Broadcast message to vote an inbound ``` -zetacored tx crosschain vote-inbound [sender] [senderChainID] [txOrigin] [receiver] [receiverChainID] [amount] [message] [inboundHash] [inBlockHeight] [coinType] [asset] [eventIndex] [protocolContractVersion] [isArbitraryCall] [flags] +zetacored tx crosschain vote-inbound [sender] [senderChainID] [txOrigin] [receiver] [receiverChainID] [amount] [message] [inboundHash] [inBlockHeight] [coinType] [asset] [eventIndex] [protocolContractVersion] [flags] ``` ### Options diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index a8c0a2516e..8af21304be 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -58446,6 +58446,8 @@ definitions: $ref: '#/definitions/crosschainCctxStatus' status_message: type: string + error_message: + type: string lastUpdate_timestamp: type: string format: int64 diff --git a/go.mod b/go.mod index 7625fc2047..8842e1f2d7 100644 --- a/go.mod +++ b/go.mod @@ -337,6 +337,7 @@ require ( github.com/bnb-chain/tss-lib v1.5.0 github.com/showa-93/go-mask v0.6.2 github.com/tonkeeper/tongo v1.9.3 + gotest.tools v2.2.0+incompatible ) require ( diff --git a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto index 4baa375c65..dd59a44c04 100644 --- a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto +++ b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto @@ -95,6 +95,7 @@ message OutboundParams { message Status { CctxStatus status = 1; string status_message = 2; + string error_message = 6; int64 lastUpdate_timestamp = 3; bool isAbortRefunded = 4; // when the CCTX was created. only populated on new transactions. @@ -135,5 +136,4 @@ message CrossChainTx { repeated OutboundParams outbound_params = 10; ProtocolContractVersion protocol_contract_version = 11; RevertOptions revert_options = 12 [ (gogoproto.nullable) = false ]; - string error = 13; } diff --git a/testutil/sample/crosschain.go b/testutil/sample/crosschain.go index 059fd2bf9c..8f09271e23 100644 --- a/testutil/sample/crosschain.go +++ b/testutil/sample/crosschain.go @@ -213,7 +213,6 @@ func CrossChainTx(t *testing.T, index string) *types.CrossChainTx { OutboundParams: []*types.OutboundParams{OutboundParams(r), OutboundParams(r)}, ProtocolContractVersion: types.ProtocolContractVersion_V1, RevertOptions: types.NewEmptyRevertOptions(), - Error: "", } } 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 1ffa04eaca..0b0f67c762 100644 --- a/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts +++ b/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts @@ -359,6 +359,11 @@ export declare class Status extends Message { */ statusMessage: string; + /** + * @generated from field: string error_message = 6; + */ + errorMessage: string; + /** * @generated from field: int64 lastUpdate_timestamp = 3; */ diff --git a/x/crosschain/keeper/cctx_gateway_observers.go b/x/crosschain/keeper/cctx_gateway_observers.go index e4f92b3293..30e414f504 100644 --- a/x/crosschain/keeper/cctx_gateway_observers.go +++ b/x/crosschain/keeper/cctx_gateway_observers.go @@ -75,7 +75,7 @@ func (c CCTXGatewayObservers) InitiateOutbound( }() if err != nil { // do not commit anything here as the CCTX should be aborted - config.CCTX.SetAbort(true, err.Error()) + config.CCTX.SetAbort("", 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 d977b0bcb9..4afa112fc6 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -28,7 +28,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound( if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX - config.CCTX.SetAbort(true, err.Error()) + config.CCTX.SetAbort("", 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 53ccc35ef1..8737cd06e8 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -53,7 +53,7 @@ func (k Keeper) ValidateOutboundZEVM( cctx.InboundParams.Amount, ) if err != nil { - cctx.SetAbort(true, fmt.Sprintf("%s : %s", depositErr, err.Error())) + cctx.SetAbort("", fmt.Sprintf("deposit error %s, got error: %s", depositErr, err.Error())) return types.CctxStatus_Aborted } @@ -122,7 +122,7 @@ 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(true, "Outbound failed: cmd cctx reverted") + cctx.SetAbort("", "outbound failed, cmd cctx reverted") } else if chains.IsZetaChain(cctx.InboundParams.SenderChainId, k.GetAuthorityKeeper().GetAdditionalChainList(ctx)) { switch cctx.InboundParams.CoinType { // Try revert if the coin-type is ZETA @@ -137,7 +137,7 @@ func (k Keeper) processFailedOutboundObservers(ctx sdk.Context, cctx *types.Cros default: { cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort(true, "Outbound failed for non-ZETA cctx") + cctx.SetAbort("", "outbound failed for non-ZETA cctx") } } } else { @@ -195,10 +195,10 @@ 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(true, revertMsg) + cctx.SetPendingRevert("", revertMsg) case types.CctxStatus_PendingRevert: cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort(true, "Outbound failed: revert failed; abort TX") + cctx.SetAbort("", "outbound and revert failed") } return nil } @@ -225,9 +225,9 @@ func (k Keeper) processSuccessfulOutbound( oldStatus := cctx.CctxStatus.Status switch oldStatus { case types.CctxStatus_PendingRevert: - cctx.SetReverted(false, "Outbound succeeded: revert executed") + cctx.SetReverted("", "revert executed") case types.CctxStatus_PendingOutbound: - cctx.SetOutboundMined(false, "Outbound succeeded: mined") + cctx.SetOutboundMined("") default: return } @@ -256,7 +256,7 @@ 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(true, "Outbound failed: trying to revert") + cctx.SetPendingRevert("", "outbound failed") data, err := base64.StdEncoding.DecodeString(cctx.RelayedMessage) if err != nil { return fmt.Errorf("failed decoding relayed message: %s", err.Error()) @@ -290,7 +290,7 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro return fmt.Errorf("failed ZETARevertAndCallContract: %s", err.Error()) } - cctx.SetReverted(true, "Outbound failed: revert executed") + cctx.SetReverted("", "outbound failed") if len(ctx.TxBytes()) > 0 { // add event for tendermint transaction hash format hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()) @@ -336,7 +336,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // update status - cctx.SetPendingRevert(true, "Outbound failed: trying revert") + cctx.SetPendingRevert("", "outbound failed") // process the revert on ZEVM if err := k.fungibleKeeper.ProcessV2RevertDeposit( @@ -354,7 +354,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // tx is reverted - cctx.SetReverted(true, "Outbound failed: revert executed") + cctx.SetReverted("", "outbound failed") // add event for tendermint transaction hash format if len(ctx.TxBytes()) > 0 { @@ -367,7 +367,7 @@ 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(true, "Outbound failed: revert failed; abort TX") + cctx.SetAbort("", "outbound and revert failed") } return nil } diff --git a/x/crosschain/keeper/initiate_outbound.go b/x/crosschain/keeper/initiate_outbound.go index 9de817ff75..5339cd4150 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(false, "") + config.CCTX.SetPendingOutbound("") return cctxGateway.InitiateOutbound(ctx, config) } 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 e824a01707..66031760ee 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -265,7 +265,7 @@ func TestKeeper_VoteInbound(t *testing.T) { }) } -func TestStatus_ChangeStatus(t *testing.T) { +func TestStatus_UpdateCctxStatus(t *testing.T) { tt := []struct { Name string Status types.Status @@ -302,7 +302,7 @@ func TestStatus_ChangeStatus(t *testing.T) { for _, test := range tt { test := test t.Run(test.Name, func(t *testing.T) { - test.Status.ChangeStatus(test.NonErrStatus, test.Msg) + test.Status.UpdateCctxStatus(test.NonErrStatus, false, 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 c114fd5404..4bb65a3c8f 100644 --- a/x/crosschain/keeper/msg_server_vote_outbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx.go @@ -185,7 +185,7 @@ 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(true, errMessage) + cctx.SetAbort("", 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 fc64000121..4e3822dfff 100644 --- a/x/crosschain/types/cctx.go +++ b/x/crosschain/types/cctx.go @@ -170,42 +170,29 @@ func (m *CrossChainTx) AddOutbound( return nil } -func (m *CrossChainTx) ChangeStatus(newStatus CctxStatus, isError bool, msg string) { - switch { - case isError && msg == "": - m.CctxStatus.ChangeStatus(newStatus, "") - m.Error = "unexpected error" - case isError && msg != "": - m.CctxStatus.ChangeStatus(newStatus, "") - m.Error = msg - case !isError: - m.CctxStatus.ChangeStatus(newStatus, msg) - } -} - // SetAbort sets the CCTX status to Aborted with the given error message. -func (m *CrossChainTx) SetAbort(isError bool, msg string) { - m.ChangeStatus(CctxStatus_Aborted, isError, msg) +func (m CrossChainTx) SetAbort(statusMsg, errorMsg string) { + m.CctxStatus.UpdateCctxStatus(CctxStatus_Aborted, true, statusMsg, errorMsg) } // SetPendingRevert sets the CCTX status to PendingRevert with the given error message. -func (m *CrossChainTx) SetPendingRevert(isError bool, msg string) { - m.ChangeStatus(CctxStatus_PendingRevert, isError, msg) +func (m CrossChainTx) SetPendingRevert(statusMsg, errorMsg string) { + m.CctxStatus.UpdateCctxStatus(CctxStatus_PendingRevert, true, statusMsg, errorMsg) } // SetPendingOutbound sets the CCTX status to PendingOutbound with the given error message. -func (m *CrossChainTx) SetPendingOutbound(isError bool, msg string) { - m.ChangeStatus(CctxStatus_PendingOutbound, isError, msg) +func (m CrossChainTx) SetPendingOutbound(statusMsg string) { + m.CctxStatus.UpdateCctxStatus(CctxStatus_PendingOutbound, false, statusMsg, "") } // SetOutboundMined sets the CCTX status to OutboundMined with the given error message. -func (m *CrossChainTx) SetOutboundMined(isError bool, msg string) { - m.ChangeStatus(CctxStatus_OutboundMined, isError, msg) +func (m CrossChainTx) SetOutboundMined(statusMsg string) { + m.CctxStatus.UpdateCctxStatus(CctxStatus_OutboundMined, false, statusMsg, "") } // SetReverted sets the CCTX status to Reverted with the given error message. -func (m *CrossChainTx) SetReverted(isError bool, msg string) { - m.ChangeStatus(CctxStatus_Reverted, isError, msg) +func (m CrossChainTx) SetReverted(statusMsg, errorMsg string) { + m.CctxStatus.UpdateCctxStatus(CctxStatus_Reverted, true, statusMsg, errorMsg) } func (m CrossChainTx) GetCCTXIndexBytes() ([32]byte, error) { @@ -286,7 +273,6 @@ func NewCCTX(ctx sdk.Context, msg MsgVoteInbound, tssPubkey string) (CrossChainT OutboundParams: []*OutboundParams{outboundParams}, ProtocolContractVersion: msg.ProtocolContractVersion, RevertOptions: msg.RevertOptions, - Error: "", } // TODO: remove this validate call diff --git a/x/crosschain/types/cctx_test.go b/x/crosschain/types/cctx_test.go index d3c5745d29..f49768f8a0 100644 --- a/x/crosschain/types/cctx_test.go +++ b/x/crosschain/types/cctx_test.go @@ -150,83 +150,45 @@ func Test_SetRevertOutboundValues(t *testing.T) { func TestCrossChainTx_SetAbort(t *testing.T) { cctx := sample.CrossChainTx(t, "test") - cctx.SetAbort(false, "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") -} - -func TestCrossChainTx_SetAbortWithError(t *testing.T) { - cctx := sample.CrossChainTx(t, "test") - cctx.SetAbort(true, "test") - require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) - require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") - require.Equal(t, "test", cctx.Error) + require.Contains(t, cctx.CctxStatus.ErrorMessage, "test") } func TestCrossChainTx_SetPendingRevert(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetPendingRevert(false, "test") + cctx.SetPendingRevert("test", "test") require.Equal(t, types.CctxStatus_PendingRevert, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") -} - -func TestCrossChainTx_SetPendingWithError(t *testing.T) { - cctx := sample.CrossChainTx(t, "test") - cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetPendingRevert(true, "test") - require.Equal(t, types.CctxStatus_PendingRevert, cctx.CctxStatus.Status) - require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") - require.Equal(t, "test", cctx.Error) + require.Contains(t, cctx.CctxStatus.ErrorMessage, "test") } func TestCrossChainTx_SetPendingOutbound(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingInbound - cctx.SetPendingOutbound(false, "test") + cctx.SetPendingOutbound("test") require.Equal(t, types.CctxStatus_PendingOutbound, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") -} - -func TestCrossChainTx_SetPendingOutboundWithError(t *testing.T) { - cctx := sample.CrossChainTx(t, "test") - cctx.CctxStatus.Status = types.CctxStatus_PendingInbound - cctx.SetPendingOutbound(true, "test") - require.Equal(t, types.CctxStatus_PendingOutbound, cctx.CctxStatus.Status) - require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") - require.Equal(t, "test", cctx.Error) + require.NotContains(t, cctx.CctxStatus.ErrorMessage, "test") } func TestCrossChainTx_SetOutboundMined(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetOutboundMined(false, "test") + cctx.SetOutboundMined("test") require.Equal(t, types.CctxStatus_OutboundMined, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") -} - -func TestCrossChainTx_SetOutboundMinedWithError(t *testing.T) { - cctx := sample.CrossChainTx(t, "test") - cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound - cctx.SetOutboundMined(true, "test") - require.Equal(t, types.CctxStatus_OutboundMined, cctx.CctxStatus.Status) - require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") - require.Contains(t, cctx.Error, "test") + require.NotContains(t, cctx.CctxStatus.ErrorMessage, "test") } func TestCrossChainTx_SetReverted(t *testing.T) { cctx := sample.CrossChainTx(t, "test") cctx.CctxStatus.Status = types.CctxStatus_PendingRevert - cctx.SetReverted(false, "test") + cctx.SetReverted("test", "test") require.Equal(t, types.CctxStatus_Reverted, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") -} - -func TestCrossChainTx_SetRevertedWithError(t *testing.T) { - cctx := sample.CrossChainTx(t, "test") - cctx.CctxStatus.Status = types.CctxStatus_PendingRevert - cctx.SetReverted(true, "test") - require.Equal(t, types.CctxStatus_Reverted, cctx.CctxStatus.Status) - require.NotContains(t, cctx.CctxStatus.StatusMessage, "test") - require.Contains(t, cctx.Error, "test") + require.Contains(t, cctx.CctxStatus.ErrorMessage, "test") } diff --git a/x/crosschain/types/cross_chain_tx.pb.go b/x/crosschain/types/cross_chain_tx.pb.go index 76f9e9ed53..ade3cf51e9 100644 --- a/x/crosschain/types/cross_chain_tx.pb.go +++ b/x/crosschain/types/cross_chain_tx.pb.go @@ -490,6 +490,7 @@ func (m *OutboundParams) GetCallOptions() *CallOptions { type Status struct { Status CctxStatus `protobuf:"varint,1,opt,name=status,proto3,enum=zetachain.zetacore.crosschain.CctxStatus" json:"status,omitempty"` StatusMessage string `protobuf:"bytes,2,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"` + ErrorMessage string `protobuf:"bytes,6,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` LastUpdateTimestamp int64 `protobuf:"varint,3,opt,name=lastUpdate_timestamp,json=lastUpdateTimestamp,proto3" json:"lastUpdate_timestamp,omitempty"` IsAbortRefunded bool `protobuf:"varint,4,opt,name=isAbortRefunded,proto3" json:"isAbortRefunded,omitempty"` // when the CCTX was created. only populated on new transactions. @@ -543,6 +544,13 @@ func (m *Status) GetStatusMessage() string { return "" } +func (m *Status) GetErrorMessage() string { + if m != nil { + return m.ErrorMessage + } + return "" +} + func (m *Status) GetLastUpdateTimestamp() int64 { if m != nil { return m.LastUpdateTimestamp @@ -644,7 +652,6 @@ type CrossChainTx struct { OutboundParams []*OutboundParams `protobuf:"bytes,10,rep,name=outbound_params,json=outboundParams,proto3" json:"outbound_params,omitempty"` ProtocolContractVersion ProtocolContractVersion `protobuf:"varint,11,opt,name=protocol_contract_version,json=protocolContractVersion,proto3,enum=zetachain.zetacore.crosschain.ProtocolContractVersion" json:"protocol_contract_version,omitempty"` RevertOptions RevertOptions `protobuf:"bytes,12,opt,name=revert_options,json=revertOptions,proto3" json:"revert_options"` - Error string `protobuf:"bytes,13,opt,name=error,proto3" json:"error,omitempty"` } func (m *CrossChainTx) Reset() { *m = CrossChainTx{} } @@ -736,13 +743,6 @@ func (m *CrossChainTx) GetRevertOptions() RevertOptions { return RevertOptions{} } -func (m *CrossChainTx) GetError() string { - if m != nil { - return m.Error - } - return "" -} - func init() { proto.RegisterEnum("zetachain.zetacore.crosschain.CctxStatus", CctxStatus_name, CctxStatus_value) proto.RegisterEnum("zetachain.zetacore.crosschain.TxFinalizationStatus", TxFinalizationStatus_name, TxFinalizationStatus_value) @@ -761,92 +761,93 @@ func init() { } var fileDescriptor_d4c1966807fb5cb2 = []byte{ - // 1360 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6e, 0x1b, 0xb7, - 0x13, 0xd7, 0xda, 0x92, 0x2c, 0x8d, 0x3e, 0xbc, 0xa6, 0x15, 0x67, 0xe3, 0x3f, 0xa2, 0xf8, 0xaf, - 0xd6, 0x89, 0xe2, 0xd6, 0x12, 0xa2, 0x00, 0x45, 0xd1, 0x9b, 0x6d, 0xc4, 0x89, 0xdb, 0x26, 0x36, - 0x36, 0x8e, 0x81, 0xe4, 0xd0, 0x2d, 0xb5, 0x4b, 0x4b, 0x84, 0xa5, 0xa5, 0xba, 0xa4, 0x0c, 0x29, - 0xe8, 0xad, 0x2f, 0xd0, 0x77, 0x68, 0x0f, 0x3d, 0xf6, 0x31, 0x72, 0xcc, 0xb1, 0xe8, 0x21, 0x08, - 0x92, 0x37, 0xe8, 0xb9, 0x87, 0x82, 0x5f, 0x92, 0x15, 0xb8, 0x76, 0x9a, 0xf6, 0x24, 0xce, 0x0c, - 0xe7, 0x37, 0xb3, 0xc3, 0xf9, 0x0d, 0x29, 0x68, 0x3d, 0x27, 0x02, 0x87, 0x5d, 0x4c, 0xe3, 0xa6, - 0x5a, 0xb1, 0x84, 0x34, 0xc3, 0x84, 0x71, 0xae, 0x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0x32, 0x58, 0x2a, 0x88, 0x42, 0xaa, 0x1d, 0x41, 0x61, 0x07, - 0xf7, 0x7a, 0xfb, 0x03, 0x99, 0x06, 0x97, 0x2d, 0xd6, 0xc1, 0x3c, 0xe8, 0xd1, 0x3e, 0xd5, 0x51, - 0xd2, 0x7e, 0xae, 0x83, 0xf9, 0xd7, 0x52, 0x46, 0x1b, 0xb0, 0x44, 0x79, 0x80, 0x93, 0x36, 0x15, - 0x09, 0x4e, 0xc6, 0x41, 0x88, 0x7b, 0x3d, 0xd5, 0xa9, 0x39, 0x7f, 0x91, 0xf2, 0x2d, 0xab, 0x97, - 0x78, 0xb5, 0xd7, 0x59, 0x28, 0xef, 0x0f, 0xc5, 0xd9, 0xf6, 0x5f, 0x85, 0x5c, 0x42, 0x42, 0x42, - 0x4f, 0x27, 0x04, 0x98, 0xc8, 0xe8, 0x36, 0xb8, 0x76, 0xad, 0x49, 0xb0, 0x67, 0x39, 0xb0, 0x68, - 0xf5, 0x96, 0x05, 0x33, 0x8d, 0x3e, 0xff, 0x61, 0x8d, 0x3e, 0x6d, 0xe9, 0xf4, 0xbf, 0x6b, 0x69, - 0x49, 0x49, 0xce, 0x83, 0x98, 0xc5, 0x21, 0x51, 0xac, 0x49, 0xfb, 0x39, 0xc1, 0xf9, 0x23, 0x29, - 0xcf, 0x16, 0x33, 0xfb, 0x4e, 0x31, 0x8d, 0x71, 0x90, 0xd0, 0x90, 0x18, 0x22, 0x48, 0xe3, 0x81, - 0x94, 0x51, 0x1d, 0x5c, 0x63, 0x64, 0x09, 0x15, 0xe3, 0xe0, 0x98, 0x10, 0xef, 0xaa, 0xda, 0x53, - 0xd6, 0x7b, 0x94, 0x7a, 0x97, 0x10, 0x84, 0x20, 0xad, 0xa8, 0x94, 0x53, 0x56, 0xb5, 0x7e, 0x1f, - 0x22, 0x5c, 0xc4, 0x32, 0xb8, 0x90, 0x65, 0xd7, 0x40, 0xa6, 0x19, 0x0c, 0x39, 0x89, 0xbc, 0x8a, -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0xa6, 0x51, 0x11, 0x72, 0x7a, 0x4d, 0x22, 0x37, 0x83, 0x0a, - 0xb0, 0xb0, 0xa5, 0x5f, 0x39, 0x6e, 0x76, 0x35, 0xfd, 0xcb, 0xcf, 0x55, 0x67, 0xe3, 0x2b, 0xa8, - 0x9c, 0x37, 0xab, 0x91, 0x0b, 0xc5, 0x47, 0x4c, 0xec, 0xda, 0x37, 0x9f, 0x9b, 0x42, 0x25, 0xc8, - 0x4f, 0x45, 0x47, 0x22, 0xdf, 0x1b, 0x91, 0x70, 0x28, 0xc1, 0xe6, 0x0c, 0x58, 0x13, 0xae, 0xfe, - 0x4d, 0xbd, 0x51, 0x16, 0xe6, 0x8e, 0xee, 0xb8, 0x29, 0xf5, 0xdb, 0x72, 0x1d, 0xed, 0xb0, 0x7d, - 0xff, 0xc5, 0x9b, 0xaa, 0xf3, 0xf2, 0x4d, 0xd5, 0x79, 0xfd, 0xa6, 0xea, 0xfc, 0xf8, 0xb6, 0x9a, - 0x7a, 0xf9, 0xb6, 0x9a, 0xfa, 0xed, 0x6d, 0x35, 0xf5, 0x6c, 0xf3, 0x0c, 0xbf, 0x64, 0xb9, 0x37, - 0xf5, 0xbf, 0x8a, 0x98, 0x45, 0xa4, 0x39, 0x3a, 0xfb, 0xe7, 0x45, 0x51, 0xad, 0x9d, 0x55, 0xc7, - 0x79, 0xf7, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x69, 0x53, 0x70, 0x6b, 0xea, 0x0c, 0x00, 0x00, + // 1361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6e, 0x1b, 0xb7, + 0x13, 0xf6, 0xda, 0xb2, 0x2c, 0x8d, 0xfe, 0x78, 0x4d, 0x2b, 0xce, 0xc6, 0x3f, 0x44, 0xf1, 0x4f, + 0xad, 0x13, 0xc5, 0xad, 0x25, 0x44, 0x01, 0x8a, 0xa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67, 0x7e, 0x7f, 0x5b, 0x9d, 0x79, 0xb6, 0x79, 0x46, 0x49, 0x32, 0xb1, + 0x9b, 0xfa, 0x4f, 0x46, 0xc2, 0x22, 0xd2, 0x1c, 0x9e, 0xfd, 0x2f, 0xa3, 0x44, 0xd5, 0xce, 0xaa, + 0x83, 0xbb, 0xfb, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x84, 0x70, 0x56, 0x74, 0xf9, 0x0c, 0x00, + 0x00, } func (m *InboundParams) Marshal() (dAtA []byte, err error) { @@ -1180,6 +1181,13 @@ func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ErrorMessage) > 0 { + i -= len(m.ErrorMessage) + copy(dAtA[i:], m.ErrorMessage) + i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.ErrorMessage))) + i-- + dAtA[i] = 0x32 + } if m.CreatedTimestamp != 0 { i = encodeVarintCrossChainTx(dAtA, i, uint64(m.CreatedTimestamp)) i-- @@ -1299,13 +1307,6 @@ func (m *CrossChainTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Error) > 0 { - i -= len(m.Error) - copy(dAtA[i:], m.Error) - i = encodeVarintCrossChainTx(dAtA, i, uint64(len(m.Error))) - i-- - dAtA[i] = 0x6a - } { size, err := m.RevertOptions.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1563,6 +1564,10 @@ func (m *Status) Size() (n int) { if m.CreatedTimestamp != 0 { n += 1 + sovCrossChainTx(uint64(m.CreatedTimestamp)) } + l = len(m.ErrorMessage) + if l > 0 { + n += 1 + l + sovCrossChainTx(uint64(l)) + } return n } @@ -1631,10 +1636,6 @@ func (m *CrossChainTx) Size() (n int) { } l = m.RevertOptions.Size() n += 1 + l + sovCrossChainTx(uint64(l)) - l = len(m.Error) - if l > 0 { - n += 1 + l + sovCrossChainTx(uint64(l)) - } return n } @@ -2792,6 +2793,38 @@ func (m *Status) Unmarshal(dAtA []byte) error { break } } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessage", 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.ErrorMessage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCrossChainTx(dAtA[iNdEx:]) @@ -3332,38 +3365,6 @@ func (m *CrossChainTx) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", 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.Error = 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 cdaf5b0aae..0e54c847d0 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -9,28 +9,40 @@ func (m *Status) AbortRefunded() { m.StatusMessage = "CCTX aborted and Refunded" } -// ChangeStatus changes the status of the cross chain transaction -// empty msg does not overwrite old status message -func (m *Status) ChangeStatus(newStatus CctxStatus, msg string) { - if len(msg) > 0 { - if m.StatusMessage != "" { - m.StatusMessage = fmt.Sprintf("%s : %s", m.StatusMessage, msg) - } else { - m.StatusMessage = msg - } +// UpdateCctxStatus transitions the Status. +// In case of an error, ErrorMessage is updated. +// In case of no error, StatusMessage is updated. +func (m *Status) UpdateCctxStatus(newStatus CctxStatus, isError bool, statusMsg, errorMsg string) { + m.ChangeStatus(newStatus, statusMsg) + + if isError && errorMsg != "" { + m.ErrorMessage = errorMsg + } else if isError && errorMsg == "" { + m.ErrorMessage = "unknown error" } +} + +// ChangeStatus changes the status of the cross chain transaction. +func (m *Status) ChangeStatus(newStatus CctxStatus, statusMsg string) { if !m.ValidateTransition(newStatus) { m.StatusMessage = fmt.Sprintf( - "Failed to transition : OldStatus %s , NewStatus %s , MSG : %s :", + "Failed to transition status from %s to %s", m.Status.String(), newStatus.String(), - msg, ) + m.Status = CctxStatus_Aborted return } + + if statusMsg == "" { + m.StatusMessage = fmt.Sprintf("Status changed from %s to %s", m.Status.String(), newStatus.String()) + } else { + m.StatusMessage = statusMsg + } + m.Status = newStatus -} //nolint:typecheck +} func (m *Status) ValidateTransition(newStatus CctxStatus) bool { stateTransitionMap := stateTransitionMap() diff --git a/x/crosschain/types/status_test.go b/x/crosschain/types/status_test.go index 88013a41a9..97f2bcef4c 100644 --- a/x/crosschain/types/status_test.go +++ b/x/crosschain/types/status_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "gotest.tools/assert" "github.com/zeta-chain/node/x/crosschain/types" ) @@ -149,8 +149,13 @@ func TestStatus_ChangeStatus(t *testing.T) { s := types.Status{Status: types.CctxStatus_PendingInbound} s.ChangeStatus(types.CctxStatus_PendingOutbound, "") + fmt.Printf("%+v\n", s) assert.Equal(t, s.Status, types.CctxStatus_PendingOutbound) - assert.Equal(t, s.StatusMessage, "") + 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) { @@ -161,10 +166,9 @@ func TestStatus_ChangeStatus(t *testing.T) { assert.Equal( t, fmt.Sprintf( - "Failed to transition : OldStatus %s , NewStatus %s , MSG : %s :", + "Failed to transition status from %s to %s", types.CctxStatus_PendingOutbound.String(), types.CctxStatus_PendingInbound.String(), - "msg", ), s.StatusMessage, ) From 445c85d34a087523b5e7350019f3d111c1d739c9 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 2 Oct 2024 16:11:27 +0200 Subject: [PATCH 03/10] fix unit tests --- e2e/e2etests/test_eth_deposit_call.go | 2 +- x/crosschain/keeper/initiate_outbound_test.go | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/e2e/e2etests/test_eth_deposit_call.go b/e2e/e2etests/test_eth_deposit_call.go index 570e7b05eb..272d4b3e13 100644 --- a/e2e/e2etests/test_eth_deposit_call.go +++ b/e2e/e2etests/test_eth_deposit_call.go @@ -88,5 +88,5 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { r.Logger.Info("Cross-chain call to reverter reverted") // check the status message contains revert error hash in case of revert - require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo) + require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo) } diff --git a/x/crosschain/keeper/initiate_outbound_test.go b/x/crosschain/keeper/initiate_outbound_test.go index 55ca3e36f8..204179bea5 100644 --- a/x/crosschain/keeper/initiate_outbound_test.go +++ b/x/crosschain/keeper/initiate_outbound_test.go @@ -76,7 +76,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.ErrorContains(t, err, "deposit error") require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) require.Equal(t, types.CctxStatus_Aborted, newStatus) - require.Equal(t, "deposit error", cctx.CctxStatus.StatusMessage) + require.Equal(t, "deposit error", cctx.CctxStatus.ErrorMessage) }) t.Run( @@ -111,7 +111,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Contains( t, - cctx.CctxStatus.StatusMessage, + cctx.CctxStatus.ErrorMessage, "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.StatusMessage, + cctx.CctxStatus.ErrorMessage, "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.StatusMessage, + cctx.CctxStatus.ErrorMessage, "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.StatusMessage, + cctx.CctxStatus.ErrorMessage, "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.StatusMessage, "cannot find receiver chain nonce") + require.Contains(t, cctx.CctxStatus.ErrorMessage, "cannot find receiver chain nonce") }) t.Run("unable to process zevm deposit HandleEVMDeposit revert successfully", func(t *testing.T) { @@ -321,7 +321,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.NoError(t, err) require.Equal(t, types.CctxStatus_PendingRevert, cctx.CctxStatus.Status) require.Equal(t, types.CctxStatus_PendingRevert, newStatus) - require.Equal(t, errDeposit.Error(), cctx.CctxStatus.StatusMessage) + require.Equal(t, errDeposit.Error(), cctx.CctxStatus.ErrorMessage) require.Equal(t, updatedNonce, cctx.GetCurrentOutboundParam().TssNonce) }) @@ -361,7 +361,7 @@ func TestKeeper_InitiateOutboundZEVMDeposit(t *testing.T) { require.Equal(t, types.CctxStatus_Aborted, newStatus) require.Contains( t, - cctx.CctxStatus.StatusMessage, + cctx.CctxStatus.ErrorMessage, "cannot revert a revert tx", ) }, @@ -427,7 +427,7 @@ func TestKeeper_InitiateOutboundProcessCrosschainMsgPassing(t *testing.T) { require.ErrorIs(t, err, observertypes.ErrSupportedChains) require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) require.Equal(t, types.CctxStatus_Aborted, newStatus) - require.Equal(t, observertypes.ErrSupportedChains.Error(), cctx.CctxStatus.StatusMessage) + require.Equal(t, observertypes.ErrSupportedChains.Error(), cctx.CctxStatus.ErrorMessage) }) t.Run("unable to process crosschain msg passing UpdateNonce fails", func(t *testing.T) { @@ -456,7 +456,7 @@ func TestKeeper_InitiateOutboundProcessCrosschainMsgPassing(t *testing.T) { require.ErrorContains(t, err, "cannot find receiver chain nonce") require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) require.Equal(t, types.CctxStatus_Aborted, newStatus) - require.Contains(t, cctx.CctxStatus.StatusMessage, "cannot find receiver chain nonce") + require.Contains(t, cctx.CctxStatus.ErrorMessage, "cannot find receiver chain nonce") }) } From 48f9052a468ce027453ccd8cf25a3d28dd83e65e Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Wed, 2 Oct 2024 19:04:51 +0200 Subject: [PATCH 04/10] add function to update error messages --- changelog.md | 1 + e2e/e2etests/test_eth_deposit_call.go | 4 +- e2e/e2etests/test_solana_deposit_refund.go | 4 +- testutil/sample/crosschain.go | 1 + .../keeper/msg_server_vote_inbound_tx_test.go | 2 +- x/crosschain/types/cctx.go | 11 ++--- x/crosschain/types/cctx_test.go | 4 +- x/crosschain/types/status.go | 41 +++++++++++-------- x/crosschain/types/status_test.go | 6 +-- 9 files changed, 43 insertions(+), 31 deletions(-) diff --git a/changelog.md b/changelog.md index dc83cb839b..4ca51d5db9 100644 --- a/changelog.md +++ b/changelog.md @@ -25,6 +25,7 @@ * [2826](https://github.com/zeta-chain/node/pull/2826) - remove unused code from emissions module and add new parameter for fixed block reward amount * [2890](https://github.com/zeta-chain/node/pull/2890) - refactor `MsgUpdateChainInfo` to accept a single chain, and add `MsgRemoveChainInfo` to remove a chain * [2899](https://github.com/zeta-chain/node/pull/2899) - remove btc deposit fee v1 and improve unit tests +* [2952](https://github.com/zeta-chain/node/pull/2952) - add error_message to cctx.status ### Tests diff --git a/e2e/e2etests/test_eth_deposit_call.go b/e2e/e2etests/test_eth_deposit_call.go index 272d4b3e13..46805f9f81 100644 --- a/e2e/e2etests/test_eth_deposit_call.go +++ b/e2e/e2etests/test_eth_deposit_call.go @@ -87,6 +87,6 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { r.Logger.Info("Cross-chain call to reverter reverted") - // check the status message contains revert error hash in case of revert - require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo) + // Check the error carries the revert executed. + require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") } diff --git a/e2e/e2etests/test_solana_deposit_refund.go b/e2e/e2etests/test_solana_deposit_refund.go index e9155c9ddd..3176edee78 100644 --- a/e2e/e2etests/test_solana_deposit_refund.go +++ b/e2e/e2etests/test_solana_deposit_refund.go @@ -31,6 +31,6 @@ func TestSolanaDepositAndCallRefund(r *runner.E2ERunner, args []string) { r.Logger.CCTX(*cctx, "solana_deposit_and_refund") utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - // check the status message contains revert error hash in case of revert - require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo) + // Check the error carries the revert executed. + require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") } diff --git a/testutil/sample/crosschain.go b/testutil/sample/crosschain.go index 8f09271e23..ff17525734 100644 --- a/testutil/sample/crosschain.go +++ b/testutil/sample/crosschain.go @@ -191,6 +191,7 @@ func Status(t *testing.T, index string) *types.Status { return &types.Status{ Status: types.CctxStatus(r.Intn(100)), StatusMessage: String(), + ErrorMessage: String(), CreatedTimestamp: createdAt, LastUpdateTimestamp: createdAt, } 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 66031760ee..a4f144c291 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -302,7 +302,7 @@ func TestStatus_UpdateCctxStatus(t *testing.T) { for _, test := range tt { test := test t.Run(test.Name, func(t *testing.T) { - test.Status.UpdateCctxStatus(test.NonErrStatus, false, test.Msg, "") + test.Status.UpdateCctxMessages(test.NonErrStatus, false, test.Msg, "") if test.IsErr { require.Equal(t, test.ErrStatus, test.Status.Status) } else { diff --git a/x/crosschain/types/cctx.go b/x/crosschain/types/cctx.go index 4e3822dfff..b3eb882cc2 100644 --- a/x/crosschain/types/cctx.go +++ b/x/crosschain/types/cctx.go @@ -172,27 +172,27 @@ 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.UpdateCctxStatus(CctxStatus_Aborted, true, statusMsg, errorMsg) + m.CctxStatus.UpdateCctxMessages(CctxStatus_Aborted, true, statusMsg, errorMsg) } // SetPendingRevert sets the CCTX status to PendingRevert with the given error message. func (m CrossChainTx) SetPendingRevert(statusMsg, errorMsg string) { - m.CctxStatus.UpdateCctxStatus(CctxStatus_PendingRevert, true, statusMsg, errorMsg) + m.CctxStatus.UpdateCctxMessages(CctxStatus_PendingRevert, true, statusMsg, errorMsg) } // SetPendingOutbound sets the CCTX status to PendingOutbound with the given error message. func (m CrossChainTx) SetPendingOutbound(statusMsg string) { - m.CctxStatus.UpdateCctxStatus(CctxStatus_PendingOutbound, false, statusMsg, "") + m.CctxStatus.UpdateCctxMessages(CctxStatus_PendingOutbound, false, statusMsg, "") } // SetOutboundMined sets the CCTX status to OutboundMined with the given error message. func (m CrossChainTx) SetOutboundMined(statusMsg string) { - m.CctxStatus.UpdateCctxStatus(CctxStatus_OutboundMined, false, statusMsg, "") + m.CctxStatus.UpdateCctxMessages(CctxStatus_OutboundMined, false, statusMsg, "") } // SetReverted sets the CCTX status to Reverted with the given error message. func (m CrossChainTx) SetReverted(statusMsg, errorMsg string) { - m.CctxStatus.UpdateCctxStatus(CctxStatus_Reverted, true, statusMsg, errorMsg) + m.CctxStatus.UpdateCctxMessages(CctxStatus_Reverted, true, statusMsg, errorMsg) } func (m CrossChainTx) GetCCTXIndexBytes() ([32]byte, error) { @@ -259,6 +259,7 @@ func NewCCTX(ctx sdk.Context, msg MsgVoteInbound, tssPubkey string) (CrossChainT status := &Status{ Status: CctxStatus_PendingInbound, StatusMessage: "", + ErrorMessage: "", CreatedTimestamp: ctx.BlockHeader().Time.Unix(), LastUpdateTimestamp: ctx.BlockHeader().Time.Unix(), IsAbortRefunded: false, diff --git a/x/crosschain/types/cctx_test.go b/x/crosschain/types/cctx_test.go index f49768f8a0..418b5cf475 100644 --- a/x/crosschain/types/cctx_test.go +++ b/x/crosschain/types/cctx_test.go @@ -1,6 +1,7 @@ package types_test import ( + "fmt" "math/rand" "testing" @@ -151,7 +152,8 @@ 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") + cctx.SetAbort("test", fmt.Sprintf("deposit: %s, error: %s", "foo", "bar")) + fmt.Printf("DEBUG: %+v\n", cctx.CctxStatus) require.Equal(t, types.CctxStatus_Aborted, cctx.CctxStatus.Status) require.Contains(t, cctx.CctxStatus.StatusMessage, "test") require.Contains(t, cctx.CctxStatus.ErrorMessage, "test") diff --git a/x/crosschain/types/status.go b/x/crosschain/types/status.go index 0e54c847d0..2a5a53e501 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -9,21 +9,14 @@ func (m *Status) AbortRefunded() { m.StatusMessage = "CCTX aborted and Refunded" } -// UpdateCctxStatus transitions the Status. -// In case of an error, ErrorMessage is updated. -// In case of no error, StatusMessage is updated. -func (m *Status) UpdateCctxStatus(newStatus CctxStatus, isError bool, statusMsg, errorMsg string) { - m.ChangeStatus(newStatus, statusMsg) - - if isError && errorMsg != "" { - m.ErrorMessage = errorMsg - } else if isError && errorMsg == "" { - m.ErrorMessage = "unknown error" - } +// UpdateCctxMessages transitions the Status and Error messages. +func (m *Status) UpdateCctxMessages(newStatus CctxStatus, isError bool, statusMsg, errorMsg string) { + m.UpdateStatusMessage(newStatus, statusMsg) + m.UpdateErrorMessage(isError, errorMsg) } -// ChangeStatus changes the status of the cross chain transaction. -func (m *Status) ChangeStatus(newStatus CctxStatus, statusMsg string) { +// UpdateStatusMessage updates cctx.status.status_message. +func (m *Status) UpdateStatusMessage(newStatus CctxStatus, statusMsg string) { if !m.ValidateTransition(newStatus) { m.StatusMessage = fmt.Sprintf( "Failed to transition status from %s to %s", @@ -35,15 +28,29 @@ func (m *Status) ChangeStatus(newStatus CctxStatus, statusMsg string) { return } - if statusMsg == "" { - m.StatusMessage = fmt.Sprintf("Status changed from %s to %s", m.Status.String(), newStatus.String()) - } else { - m.StatusMessage = statusMsg + m.StatusMessage = fmt.Sprintf("Status changed from %s to %s", m.Status.String(), newStatus.String()) + + if statusMsg != "" { + m.StatusMessage += fmt.Sprintf(" - %s", statusMsg) } m.Status = newStatus } +// UpdateErrorMessage updates cctx.status.error_message. +func (m *Status) UpdateErrorMessage(isError bool, errorMsg string) { + if !isError { + return + } + + errMsg := errorMsg + if errMsg == "" { + errMsg = "unknown error" + } + + m.ErrorMessage = errMsg +} + func (m *Status) ValidateTransition(newStatus CctxStatus) bool { stateTransitionMap := stateTransitionMap() oldStatus := m.Status diff --git a/x/crosschain/types/status_test.go b/x/crosschain/types/status_test.go index 97f2bcef4c..c302b074d9 100644 --- a/x/crosschain/types/status_test.go +++ b/x/crosschain/types/status_test.go @@ -140,7 +140,7 @@ 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.ChangeStatus(types.CctxStatus_PendingOutbound, "msg") + s.UpdateStatusMessage(types.CctxStatus_PendingOutbound, "msg") assert.Equal(t, s.Status, types.CctxStatus_PendingOutbound) assert.Equal(t, s.StatusMessage, "msg") }) @@ -148,7 +148,7 @@ func TestStatus_ChangeStatus(t *testing.T) { t.Run("should change status if transition is valid", func(t *testing.T) { s := types.Status{Status: types.CctxStatus_PendingInbound} - s.ChangeStatus(types.CctxStatus_PendingOutbound, "") + s.UpdateStatusMessage(types.CctxStatus_PendingOutbound, "") fmt.Printf("%+v\n", s) assert.Equal(t, s.Status, types.CctxStatus_PendingOutbound) assert.Equal(t, s.StatusMessage, fmt.Sprintf( @@ -161,7 +161,7 @@ func TestStatus_ChangeStatus(t *testing.T) { 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.ChangeStatus(types.CctxStatus_PendingInbound, "msg") + s.UpdateStatusMessage(types.CctxStatus_PendingInbound, "msg") assert.Equal(t, s.Status, types.CctxStatus_Aborted) assert.Equal( t, From 4d7b1aafa8e186b3bbe3c07de4e47dd05fed1cd9 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Thu, 3 Oct 2024 08:38:43 +0200 Subject: [PATCH 05/10] add query to get cctx error message --- e2e/e2etests/test_eth_deposit_call.go | 2 +- e2e/e2etests/test_solana_deposit_refund.go | 2 +- go.mod | 1 - x/crosschain/keeper/cctx.go | 17 ++++++++++++++ x/crosschain/keeper/cctx_gateway_observers.go | 2 +- x/crosschain/keeper/cctx_gateway_zevm.go | 2 +- .../cctx_orchestrator_validate_outbound.go | 22 ++++++++++--------- x/crosschain/keeper/cctx_test.go | 7 +++++- .../keeper/msg_server_vote_inbound_tx_test.go | 2 +- x/crosschain/types/cctx.go | 10 ++++----- x/crosschain/types/status.go | 10 ++++----- x/crosschain/types/status_test.go | 8 +++---- 12 files changed, 54 insertions(+), 31 deletions(-) diff --git a/e2e/e2etests/test_eth_deposit_call.go b/e2e/e2etests/test_eth_deposit_call.go index 46805f9f81..72e6bd1016 100644 --- a/e2e/e2etests/test_eth_deposit_call.go +++ b/e2e/e2etests/test_eth_deposit_call.go @@ -88,5 +88,5 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { r.Logger.Info("Cross-chain call to reverter reverted") // Check the error carries the revert executed. - require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") + require.Contains(r, cctx.CctxStatus.ErrorMessage, "Revert executed") } diff --git a/e2e/e2etests/test_solana_deposit_refund.go b/e2e/e2etests/test_solana_deposit_refund.go index 3176edee78..8fa49a0d6f 100644 --- a/e2e/e2etests/test_solana_deposit_refund.go +++ b/e2e/e2etests/test_solana_deposit_refund.go @@ -32,5 +32,5 @@ func TestSolanaDepositAndCallRefund(r *runner.E2ERunner, args []string) { utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) // Check the error carries the revert executed. - require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") + require.Contains(r, cctx.CctxStatus.ErrorMessage, "Revert executed") } diff --git a/go.mod b/go.mod index 8842e1f2d7..7625fc2047 100644 --- a/go.mod +++ b/go.mod @@ -337,7 +337,6 @@ require ( github.com/bnb-chain/tss-lib v1.5.0 github.com/showa-93/go-mask v0.6.2 github.com/tonkeeper/tongo v1.9.3 - gotest.tools v2.2.0+incompatible ) require ( diff --git a/x/crosschain/keeper/cctx.go b/x/crosschain/keeper/cctx.go index f2234362f0..0c633345b8 100644 --- a/x/crosschain/keeper/cctx.go +++ b/x/crosschain/keeper/cctx.go @@ -81,6 +81,23 @@ func (k Keeper) GetCrossChainTx(ctx sdk.Context, index string) (val types.CrossC return val, true } +// GetCrossChainTxError returns the error message for a given cctx index. +func (k Keeper) GetCrossChainTxError(ctx sdk.Context, index string) (errMsg string, found bool) { + var cctx types.CrossChainTx + + p := types.KeyPrefix(fmt.Sprintf("%s", types.CCTXKey)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), p) + + b := store.Get(types.KeyPrefix(index)) + if b == nil { + return "", false + } + + k.cdc.MustUnmarshal(b, &cctx) + + return cctx.CctxStatus.ErrorMessage, true +} + // GetAllCrossChainTx returns all cctxs func (k Keeper) GetAllCrossChainTx(ctx sdk.Context) (list []types.CrossChainTx) { p := types.KeyPrefix(fmt.Sprintf("%s", types.CCTXKey)) diff --git a/x/crosschain/keeper/cctx_gateway_observers.go b/x/crosschain/keeper/cctx_gateway_observers.go index 30e414f504..da1849525b 100644 --- a/x/crosschain/keeper/cctx_gateway_observers.go +++ b/x/crosschain/keeper/cctx_gateway_observers.go @@ -75,7 +75,7 @@ func (c CCTXGatewayObservers) InitiateOutbound( }() if err != nil { // do not commit anything here as the CCTX should be aborted - config.CCTX.SetAbort("", err.Error()) + config.CCTX.SetAbort("Aborted due to an internal error", 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 4afa112fc6..b2378e3fdc 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -28,7 +28,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound( if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX - config.CCTX.SetAbort("", err.Error()) + config.CCTX.SetAbort("Aborted while trying to handle EVM deposit", 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 8737cd06e8..606e64e138 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -53,7 +53,9 @@ func (k Keeper) ValidateOutboundZEVM( cctx.InboundParams.Amount, ) if err != nil { - cctx.SetAbort("", fmt.Sprintf("deposit error %s, got error: %s", depositErr, err.Error())) + cctx.SetAbort( + "Aborted because an error was raised while trying to revert cctx", + fmt.Sprintf("Deposit error: %s, Processing error: %s", depositErr, err.Error())) return types.CctxStatus_Aborted } @@ -122,7 +124,7 @@ 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, cmd cctx reverted") + cctx.SetAbort("", "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 @@ -137,7 +139,7 @@ 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("", "Outbound failed for non-ZETA cctx") } } } else { @@ -198,7 +200,7 @@ func (k Keeper) processFailedOutboundOnExternalChain( cctx.SetPendingRevert("", revertMsg) case types.CctxStatus_PendingRevert: cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort("", "outbound and revert failed") + cctx.SetAbort("Aborted while processing failed outbound", "Outbound and revert failed") } return nil } @@ -225,7 +227,7 @@ func (k Keeper) processSuccessfulOutbound( oldStatus := cctx.CctxStatus.Status switch oldStatus { case types.CctxStatus_PendingRevert: - cctx.SetReverted("", "revert executed") + cctx.SetReverted("Reverted as part of a successful outbound", "Revert executed") case types.CctxStatus_PendingOutbound: cctx.SetOutboundMined("") default: @@ -256,7 +258,7 @@ 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("", "Outbound failed") data, err := base64.StdEncoding.DecodeString(cctx.RelayedMessage) if err != nil { return fmt.Errorf("failed decoding relayed message: %s", err.Error()) @@ -290,7 +292,7 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro return fmt.Errorf("failed ZETARevertAndCallContract: %s", err.Error()) } - cctx.SetReverted("", "outbound failed") + cctx.SetReverted("", "Outbound failed") if len(ctx.TxBytes()) > 0 { // add event for tendermint transaction hash format hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()) @@ -336,7 +338,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // update status - cctx.SetPendingRevert("", "outbound failed") + cctx.SetPendingRevert("", "Outbound failed") // process the revert on ZEVM if err := k.fungibleKeeper.ProcessV2RevertDeposit( @@ -354,7 +356,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // tx is reverted - cctx.SetReverted("", "outbound failed") + cctx.SetReverted("", "Outbound failed") // add event for tendermint transaction hash format if len(ctx.TxBytes()) > 0 { @@ -367,7 +369,7 @@ 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("", "outbound and revert failed") + cctx.SetAbort("Aborted while processing failed outbound", "Outbound and revert failed") } return nil } diff --git a/x/crosschain/keeper/cctx_test.go b/x/crosschain/keeper/cctx_test.go index 8a51b4cf2a..70e86d64ec 100644 --- a/x/crosschain/keeper/cctx_test.go +++ b/x/crosschain/keeper/cctx_test.go @@ -169,8 +169,13 @@ func TestCCTXs(t *testing.T) { send, found := keeper.GetCrossChainTx(ctx, s.Index) require.True(t, found) require.Equal(t, s, send) + err, found := keeper.GetCrossChainTxError(ctx, s.Index) + require.True(t, found) + require.Equal(t, "", err) } - + err, found := keeper.GetCrossChainTxError(ctx, "does-not-exist") + require.False(t, found) + require.Equal(t, "", err) }) } } 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 a4f144c291..63ce40f335 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -302,7 +302,7 @@ func TestStatus_UpdateCctxStatus(t *testing.T) { for _, test := range tt { test := test t.Run(test.Name, func(t *testing.T) { - test.Status.UpdateCctxMessages(test.NonErrStatus, false, test.Msg, "") + test.Status.UpdateStatusAndErrorMessages(test.NonErrStatus, false, test.Msg, "") if test.IsErr { require.Equal(t, test.ErrStatus, test.Status.Status) } else { diff --git a/x/crosschain/types/cctx.go b/x/crosschain/types/cctx.go index b3eb882cc2..ad503a1d0a 100644 --- a/x/crosschain/types/cctx.go +++ b/x/crosschain/types/cctx.go @@ -172,27 +172,27 @@ 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.UpdateCctxMessages(CctxStatus_Aborted, true, statusMsg, errorMsg) + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Aborted, true, statusMsg, errorMsg) } // SetPendingRevert sets the CCTX status to PendingRevert with the given error message. func (m CrossChainTx) SetPendingRevert(statusMsg, errorMsg string) { - m.CctxStatus.UpdateCctxMessages(CctxStatus_PendingRevert, true, statusMsg, errorMsg) + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingRevert, true, statusMsg, errorMsg) } // SetPendingOutbound sets the CCTX status to PendingOutbound with the given error message. func (m CrossChainTx) SetPendingOutbound(statusMsg string) { - m.CctxStatus.UpdateCctxMessages(CctxStatus_PendingOutbound, false, statusMsg, "") + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingOutbound, false, statusMsg, "") } // SetOutboundMined sets the CCTX status to OutboundMined with the given error message. func (m CrossChainTx) SetOutboundMined(statusMsg string) { - m.CctxStatus.UpdateCctxMessages(CctxStatus_OutboundMined, false, statusMsg, "") + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_OutboundMined, false, statusMsg, "") } // SetReverted sets the CCTX status to Reverted with the given error message. func (m CrossChainTx) SetReverted(statusMsg, errorMsg string) { - m.CctxStatus.UpdateCctxMessages(CctxStatus_Reverted, true, statusMsg, errorMsg) + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Reverted, true, statusMsg, errorMsg) } func (m CrossChainTx) GetCCTXIndexBytes() ([32]byte, error) { diff --git a/x/crosschain/types/status.go b/x/crosschain/types/status.go index 7cbf344b11..74bd4d7ec1 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -9,14 +9,14 @@ func (m *Status) AbortRefunded() { m.StatusMessage = "CCTX aborted and Refunded" } -// UpdateCctxMessages transitions the Status and Error messages. -func (m *Status) UpdateCctxMessages(newStatus CctxStatus, isError bool, statusMsg, errorMsg string) { - m.UpdateStatusMessage(newStatus, statusMsg) +// UpdateStatusAndErrorMessages transitions the Status and Error messages. +func (m *Status) UpdateStatusAndErrorMessages(newStatus CctxStatus, isError bool, statusMsg, errorMsg string) { + m.UpdateStatus(newStatus, statusMsg) m.UpdateErrorMessage(isError, errorMsg) } -// UpdateStatusMessage updates the cctx status and cctx.status.status_message. -func (m *Status) UpdateStatusMessage(newStatus CctxStatus, statusMsg string) { +// UpdateStatus updates the cctx status and cctx.status.status_message. +func (m *Status) UpdateStatus(newStatus CctxStatus, statusMsg string) { if !m.ValidateTransition(newStatus) { m.StatusMessage = fmt.Sprintf( "Failed to transition status from %s to %s", diff --git a/x/crosschain/types/status_test.go b/x/crosschain/types/status_test.go index 06a101bb72..4650d4d3d1 100644 --- a/x/crosschain/types/status_test.go +++ b/x/crosschain/types/status_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gotest.tools/assert" "github.com/zeta-chain/node/x/crosschain/types" ) @@ -140,7 +140,7 @@ 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.UpdateStatusMessage(types.CctxStatus_PendingOutbound, "msg") + s.UpdateStatus(types.CctxStatus_PendingOutbound, "msg") assert.Equal(t, s.Status, types.CctxStatus_PendingOutbound) assert.Equal(t, s.StatusMessage, "Status changed from PendingInbound to PendingOutbound: msg") }) @@ -148,7 +148,7 @@ func TestStatus_ChangeStatus(t *testing.T) { t.Run("should change status if transition is valid", func(t *testing.T) { s := types.Status{Status: types.CctxStatus_PendingInbound} - s.UpdateStatusMessage(types.CctxStatus_PendingOutbound, "") + s.UpdateStatus(types.CctxStatus_PendingOutbound, "") fmt.Printf("%+v\n", s) assert.Equal(t, s.Status, types.CctxStatus_PendingOutbound) assert.Equal(t, s.StatusMessage, fmt.Sprintf( @@ -161,7 +161,7 @@ func TestStatus_ChangeStatus(t *testing.T) { 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.UpdateStatusMessage(types.CctxStatus_PendingInbound, "msg") + s.UpdateStatus(types.CctxStatus_PendingInbound, "msg") assert.Equal(t, s.Status, types.CctxStatus_Aborted) assert.Equal( t, From cd9818ed0d429a1de34c477722eba0375f31539b Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Fri, 4 Oct 2024 09:46:25 +0200 Subject: [PATCH 06/10] fix error messages --- .../zetacore/crosschain/cross_chain_tx.proto | 4 ++++ x/crosschain/keeper/cctx.go | 17 ----------------- x/crosschain/keeper/cctx_gateway_observers.go | 2 +- x/crosschain/keeper/cctx_gateway_zevm.go | 2 +- .../cctx_orchestrator_validate_outbound.go | 12 ++++++------ x/crosschain/keeper/cctx_test.go | 6 ------ 6 files changed, 12 insertions(+), 31 deletions(-) diff --git a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto index dd59a44c04..36fd0c1b50 100644 --- a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto +++ b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto @@ -94,7 +94,11 @@ message OutboundParams { message Status { CctxStatus status = 1; + // status_message carries information about the status transitions + // specifying the old status and new status string status_message = 2; + // error_message carries information about the error that caused the tx + // to be PendingRevert, Reverted or Aborted. string error_message = 6; int64 lastUpdate_timestamp = 3; bool isAbortRefunded = 4; diff --git a/x/crosschain/keeper/cctx.go b/x/crosschain/keeper/cctx.go index 0c633345b8..f2234362f0 100644 --- a/x/crosschain/keeper/cctx.go +++ b/x/crosschain/keeper/cctx.go @@ -81,23 +81,6 @@ func (k Keeper) GetCrossChainTx(ctx sdk.Context, index string) (val types.CrossC return val, true } -// GetCrossChainTxError returns the error message for a given cctx index. -func (k Keeper) GetCrossChainTxError(ctx sdk.Context, index string) (errMsg string, found bool) { - var cctx types.CrossChainTx - - p := types.KeyPrefix(fmt.Sprintf("%s", types.CCTXKey)) - store := prefix.NewStore(ctx.KVStore(k.storeKey), p) - - b := store.Get(types.KeyPrefix(index)) - if b == nil { - return "", false - } - - k.cdc.MustUnmarshal(b, &cctx) - - return cctx.CctxStatus.ErrorMessage, true -} - // GetAllCrossChainTx returns all cctxs func (k Keeper) GetAllCrossChainTx(ctx sdk.Context) (list []types.CrossChainTx) { p := types.KeyPrefix(fmt.Sprintf("%s", types.CCTXKey)) diff --git a/x/crosschain/keeper/cctx_gateway_observers.go b/x/crosschain/keeper/cctx_gateway_observers.go index da1849525b..d045efda0a 100644 --- a/x/crosschain/keeper/cctx_gateway_observers.go +++ b/x/crosschain/keeper/cctx_gateway_observers.go @@ -75,7 +75,7 @@ func (c CCTXGatewayObservers) InitiateOutbound( }() if err != nil { // do not commit anything here as the CCTX should be aborted - config.CCTX.SetAbort("Aborted due to an internal error", err.Error()) + config.CCTX.SetAbort("aborted due to an internal error", 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 b2378e3fdc..f734c60751 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -28,7 +28,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound( if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX - config.CCTX.SetAbort("Aborted while trying to handle EVM deposit", err.Error()) + config.CCTX.SetAbort("error during deposit that is not smart contract revert", 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 606e64e138..d9278ffdd1 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -54,8 +54,8 @@ func (k Keeper) ValidateOutboundZEVM( ) if err != nil { cctx.SetAbort( - "Aborted because an error was raised while trying to revert cctx", - fmt.Sprintf("Deposit error: %s, Processing error: %s", depositErr, err.Error())) + "aborted because revert failed", + fmt.Sprintf("deposit error: %s, processing error: %s", depositErr, err.Error())) return types.CctxStatus_Aborted } @@ -124,7 +124,7 @@ 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("", "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 +139,7 @@ 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("", "outbound failed for non-ZETA cctx") } } } else { @@ -200,7 +200,7 @@ func (k Keeper) processFailedOutboundOnExternalChain( cctx.SetPendingRevert("", revertMsg) case types.CctxStatus_PendingRevert: cctx.GetCurrentOutboundParam().TxFinalizationStatus = types.TxFinalizationStatus_Executed - cctx.SetAbort("Aborted while processing failed outbound", "Outbound and revert failed") + cctx.SetAbort("aborted while processing failed outbound", "outbound and revert failed") } return nil } @@ -369,7 +369,7 @@ 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("aborted while processing failed outbound", "outbound and revert failed") } return nil } diff --git a/x/crosschain/keeper/cctx_test.go b/x/crosschain/keeper/cctx_test.go index 70e86d64ec..d1e3f6fafc 100644 --- a/x/crosschain/keeper/cctx_test.go +++ b/x/crosschain/keeper/cctx_test.go @@ -169,13 +169,7 @@ func TestCCTXs(t *testing.T) { send, found := keeper.GetCrossChainTx(ctx, s.Index) require.True(t, found) require.Equal(t, s, send) - err, found := keeper.GetCrossChainTxError(ctx, s.Index) - require.True(t, found) - require.Equal(t, "", err) } - err, found := keeper.GetCrossChainTxError(ctx, "does-not-exist") - require.False(t, found) - require.Equal(t, "", err) }) } } From e9011617179c32c351369cf93666e355a0f3a76a Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Fri, 4 Oct 2024 13:06:16 +0200 Subject: [PATCH 07/10] reviews suggestions --- e2e/e2etests/test_eth_deposit_call.go | 2 +- e2e/e2etests/test_solana_deposit_refund.go | 2 +- proto/zetachain/zetacore/crosschain/cross_chain_tx.proto | 4 ++-- x/crosschain/keeper/cctx_gateway_zevm.go | 6 +++++- x/crosschain/keeper/cctx_orchestrator_validate_outbound.go | 6 +++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/e2e/e2etests/test_eth_deposit_call.go b/e2e/e2etests/test_eth_deposit_call.go index 72e6bd1016..46805f9f81 100644 --- a/e2e/e2etests/test_eth_deposit_call.go +++ b/e2e/e2etests/test_eth_deposit_call.go @@ -88,5 +88,5 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { r.Logger.Info("Cross-chain call to reverter reverted") // Check the error carries the revert executed. - require.Contains(r, cctx.CctxStatus.ErrorMessage, "Revert executed") + require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") } diff --git a/e2e/e2etests/test_solana_deposit_refund.go b/e2e/e2etests/test_solana_deposit_refund.go index 8fa49a0d6f..3176edee78 100644 --- a/e2e/e2etests/test_solana_deposit_refund.go +++ b/e2e/e2etests/test_solana_deposit_refund.go @@ -32,5 +32,5 @@ func TestSolanaDepositAndCallRefund(r *runner.E2ERunner, args []string) { utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) // Check the error carries the revert executed. - require.Contains(r, cctx.CctxStatus.ErrorMessage, "Revert executed") + require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") } diff --git a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto index 36fd0c1b50..9b634a6378 100644 --- a/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto +++ b/proto/zetachain/zetacore/crosschain/cross_chain_tx.proto @@ -94,8 +94,8 @@ message OutboundParams { message Status { CctxStatus status = 1; - // status_message carries information about the status transitions - // specifying the old status and new status + // status_message carries information about the status transitions: + // why they were triggered, old and new status. string status_message = 2; // error_message carries information about the error that caused the tx // to be PendingRevert, Reverted or Aborted. diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index f734c60751..67caae51e3 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -1,6 +1,8 @@ package keeper import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/node/x/crosschain/types" @@ -28,7 +30,9 @@ 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( + "aborted because of an error during deposit that is not smart contract revert", + fmt.Sprintf("deposit error: %s", 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 d9278ffdd1..4ef8d0d7fa 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -227,7 +227,7 @@ func (k Keeper) processSuccessfulOutbound( oldStatus := cctx.CctxStatus.Status switch oldStatus { case types.CctxStatus_PendingRevert: - cctx.SetReverted("Reverted as part of a successful outbound", "Revert executed") + cctx.SetReverted("", "revert executed") case types.CctxStatus_PendingOutbound: cctx.SetOutboundMined("") default: @@ -292,7 +292,7 @@ func (k Keeper) processFailedZETAOutboundOnZEVM(ctx sdk.Context, cctx *types.Cro return fmt.Errorf("failed ZETARevertAndCallContract: %s", err.Error()) } - cctx.SetReverted("", "Outbound failed") + cctx.SetReverted("", "outbound failed") if len(ctx.TxBytes()) > 0 { // add event for tendermint transaction hash format hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()) @@ -356,7 +356,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // tx is reverted - cctx.SetReverted("", "Outbound failed") + cctx.SetReverted("", "outbound failed") // add event for tendermint transaction hash format if len(ctx.TxBytes()) > 0 { From b0c1ffcd84589c46d86b60856443cd262374ac62 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Fri, 4 Oct 2024 15:29:18 +0200 Subject: [PATCH 08/10] include new generated files --- docs/openapi/openapi.swagger.yaml | 6 ++++++ .../zetacore/crosschain/cross_chain_tx_pb.d.ts | 6 ++++++ x/crosschain/keeper/cctx_gateway_zevm.go | 4 +--- x/crosschain/types/cross_chain_tx.pb.go | 14 +++++++++----- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 8af21304be..461b8566cc 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -58446,8 +58446,14 @@ definitions: $ref: '#/definitions/crosschainCctxStatus' status_message: type: string + description: |- + status_message carries information about the status transitions: + why they were triggered, old and new status. error_message: type: string + description: |- + error_message carries information about the error that caused the tx + to be PendingRevert, Reverted or Aborted. lastUpdate_timestamp: type: string format: int64 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 0b0f67c762..e5295ee133 100644 --- a/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts +++ b/typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts @@ -355,11 +355,17 @@ export declare class Status extends Message { status: CctxStatus; /** + * status_message carries information about the status transitions: + * why they were triggered, old and new status. + * * @generated from field: string status_message = 2; */ statusMessage: string; /** + * error_message carries information about the error that caused the tx + * to be PendingRevert, Reverted or Aborted. + * * @generated from field: string error_message = 6; */ errorMessage: string; diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index 67caae51e3..377117dfef 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -1,8 +1,6 @@ package keeper import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/node/x/crosschain/types" @@ -32,7 +30,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound( // exceptional case; internal error; should abort CCTX config.CCTX.SetAbort( "aborted because of an error during deposit that is not smart contract revert", - fmt.Sprintf("deposit error: %s", err.Error())) + err.Error()) return types.CctxStatus_Aborted, err } diff --git a/x/crosschain/types/cross_chain_tx.pb.go b/x/crosschain/types/cross_chain_tx.pb.go index ade3cf51e9..23923a9cbf 100644 --- a/x/crosschain/types/cross_chain_tx.pb.go +++ b/x/crosschain/types/cross_chain_tx.pb.go @@ -488,11 +488,15 @@ func (m *OutboundParams) GetCallOptions() *CallOptions { } type Status struct { - Status CctxStatus `protobuf:"varint,1,opt,name=status,proto3,enum=zetachain.zetacore.crosschain.CctxStatus" json:"status,omitempty"` - StatusMessage string `protobuf:"bytes,2,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"` - ErrorMessage string `protobuf:"bytes,6,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` - LastUpdateTimestamp int64 `protobuf:"varint,3,opt,name=lastUpdate_timestamp,json=lastUpdateTimestamp,proto3" json:"lastUpdate_timestamp,omitempty"` - IsAbortRefunded bool `protobuf:"varint,4,opt,name=isAbortRefunded,proto3" json:"isAbortRefunded,omitempty"` + Status CctxStatus `protobuf:"varint,1,opt,name=status,proto3,enum=zetachain.zetacore.crosschain.CctxStatus" json:"status,omitempty"` + // status_message carries information about the status transitions: + // why they were triggered, old and new status. + StatusMessage string `protobuf:"bytes,2,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"` + // error_message carries information about the error that caused the tx + // to be PendingRevert, Reverted or Aborted. + ErrorMessage string `protobuf:"bytes,6,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + LastUpdateTimestamp int64 `protobuf:"varint,3,opt,name=lastUpdate_timestamp,json=lastUpdateTimestamp,proto3" json:"lastUpdate_timestamp,omitempty"` + 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"` } From 21ca074612ae22f8f70c2913e45c78155bd5b8cd Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Mon, 7 Oct 2024 16:19:02 +0200 Subject: [PATCH 09/10] make every msg lowercase --- x/crosschain/keeper/cctx_orchestrator_validate_outbound.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go index 4ef8d0d7fa..9fce366028 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -258,7 +258,7 @@ 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("", "outbound failed") data, err := base64.StdEncoding.DecodeString(cctx.RelayedMessage) if err != nil { return fmt.Errorf("failed decoding relayed message: %s", err.Error()) @@ -338,7 +338,7 @@ func (k Keeper) processFailedOutboundV2(ctx sdk.Context, cctx *types.CrossChainT } // update status - cctx.SetPendingRevert("", "Outbound failed") + cctx.SetPendingRevert("", "outbound failed") // process the revert on ZEVM if err := k.fungibleKeeper.ProcessV2RevertDeposit( From 93f1789f0d6a2c7b1485e3d00d6ba71724e136f8 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Mon, 7 Oct 2024 23:02:12 +0200 Subject: [PATCH 10/10] applied suggestions --- x/crosschain/keeper/cctx_gateway_observers.go | 2 +- x/crosschain/keeper/cctx_gateway_zevm.go | 2 +- .../cctx_orchestrator_validate_outbound.go | 4 ++-- .../keeper/msg_server_vote_inbound_tx_test.go | 2 +- x/crosschain/types/cctx.go | 10 ++++---- x/crosschain/types/status.go | 24 +++++++++---------- x/crosschain/types/status_test.go | 2 +- 7 files changed, 22 insertions(+), 24 deletions(-) diff --git a/x/crosschain/keeper/cctx_gateway_observers.go b/x/crosschain/keeper/cctx_gateway_observers.go index d045efda0a..9576bcfe32 100644 --- a/x/crosschain/keeper/cctx_gateway_observers.go +++ b/x/crosschain/keeper/cctx_gateway_observers.go @@ -75,7 +75,7 @@ func (c CCTXGatewayObservers) InitiateOutbound( }() if err != nil { // do not commit anything here as the CCTX should be aborted - config.CCTX.SetAbort("aborted due to an internal error", err.Error()) + config.CCTX.SetAbort("internal error", 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 377117dfef..fc247ad7a4 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -29,7 +29,7 @@ func (c CCTXGatewayZEVM) InitiateOutbound( if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX config.CCTX.SetAbort( - "aborted because of an error during deposit that is not smart contract revert", + "error during deposit that is not smart contract revert", 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 9fce366028..2f3acdd744 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -54,8 +54,8 @@ func (k Keeper) ValidateOutboundZEVM( ) if err != nil { cctx.SetAbort( - "aborted because revert failed", - fmt.Sprintf("deposit error: %s, processing error: %s", depositErr, err.Error())) + "revert failed", + fmt.Sprintf("deposit error: %s, processing error: %s", depositErr.Error(), err.Error())) return types.CctxStatus_Aborted } 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 63ce40f335..5aa70be3bd 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -302,7 +302,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, false, test.Msg, "") + test.Status.UpdateStatusAndErrorMessages(test.NonErrStatus, test.Msg, "") if test.IsErr { require.Equal(t, test.ErrStatus, test.Status.Status) } else { diff --git a/x/crosschain/types/cctx.go b/x/crosschain/types/cctx.go index ad503a1d0a..91004511d4 100644 --- a/x/crosschain/types/cctx.go +++ b/x/crosschain/types/cctx.go @@ -172,27 +172,27 @@ 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, true, statusMsg, errorMsg) + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Aborted, statusMsg, errorMsg) } // SetPendingRevert sets the CCTX status to PendingRevert with the given error message. func (m CrossChainTx) SetPendingRevert(statusMsg, errorMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingRevert, true, statusMsg, errorMsg) + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingRevert, statusMsg, errorMsg) } // SetPendingOutbound sets the CCTX status to PendingOutbound with the given error message. func (m CrossChainTx) SetPendingOutbound(statusMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingOutbound, false, statusMsg, "") + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_PendingOutbound, statusMsg, "") } // SetOutboundMined sets the CCTX status to OutboundMined with the given error message. func (m CrossChainTx) SetOutboundMined(statusMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_OutboundMined, false, statusMsg, "") + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_OutboundMined, statusMsg, "") } // SetReverted sets the CCTX status to Reverted with the given error message. func (m CrossChainTx) SetReverted(statusMsg, errorMsg string) { - m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Reverted, true, statusMsg, errorMsg) + m.CctxStatus.UpdateStatusAndErrorMessages(CctxStatus_Reverted, statusMsg, errorMsg) } func (m CrossChainTx) GetCCTXIndexBytes() ([32]byte, error) { diff --git a/x/crosschain/types/status.go b/x/crosschain/types/status.go index 74bd4d7ec1..00c08bf6f7 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -10,14 +10,20 @@ func (m *Status) AbortRefunded() { } // UpdateStatusAndErrorMessages transitions the Status and Error messages. -func (m *Status) UpdateStatusAndErrorMessages(newStatus CctxStatus, isError bool, statusMsg, errorMsg string) { +func (m *Status) UpdateStatusAndErrorMessages(newStatus CctxStatus, statusMsg, errorMsg string) { m.UpdateStatus(newStatus, statusMsg) - m.UpdateErrorMessage(isError, errorMsg) + + if newStatus == CctxStatus_Aborted || newStatus == CctxStatus_Reverted || newStatus == CctxStatus_PendingRevert { + m.UpdateErrorMessage(errorMsg) + } } // UpdateStatus updates the cctx status and cctx.status.status_message. func (m *Status) UpdateStatus(newStatus CctxStatus, statusMsg string) { - if !m.ValidateTransition(newStatus) { + 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( "Failed to transition status from %s to %s", m.Status.String(), @@ -25,25 +31,17 @@ func (m *Status) UpdateStatus(newStatus CctxStatus, statusMsg string) { ) m.Status = CctxStatus_Aborted - return } - m.StatusMessage = fmt.Sprintf("Status changed from %s to %s", m.Status.String(), newStatus.String()) - if statusMsg != "" { m.StatusMessage += fmt.Sprintf(": %s", statusMsg) } - - m.Status = newStatus } // UpdateErrorMessage updates cctx.status.error_message. -func (m *Status) UpdateErrorMessage(isError bool, errorMsg string) { - if !isError { - return - } - +func (m *Status) UpdateErrorMessage(errorMsg string) { errMsg := errorMsg + if errMsg == "" { errMsg = "unknown error" } diff --git a/x/crosschain/types/status_test.go b/x/crosschain/types/status_test.go index 4650d4d3d1..5bb272d522 100644 --- a/x/crosschain/types/status_test.go +++ b/x/crosschain/types/status_test.go @@ -166,7 +166,7 @@ func TestStatus_ChangeStatus(t *testing.T) { assert.Equal( t, fmt.Sprintf( - "Failed to transition status from %s to %s", + "Failed to transition status from %s to %s: msg", types.CctxStatus_PendingOutbound.String(), types.CctxStatus_PendingInbound.String(), ),