diff --git a/changelog.md b/changelog.md index dc9ffa7a9d..1479bc50dd 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,7 @@ ### Fixes +* [1516](https://github.com/zeta-chain/node/issues/1516) - Unprivileged outtx tracker removal * [1537](https://github.com/zeta-chain/node/issues/1537) - Sanity check events of ZetaSent/ZetaReceived/ZetaRevertedWithdrawn/Deposited * [1530](https://github.com/zeta-chain/node/pull/1530) - Outbound tx confirmation/inclusion enhancement * [1496](https://github.com/zeta-chain/node/issues/1496) - post block header for enabled EVM chains only @@ -52,6 +53,7 @@ * Remove chain id from the index for observer mapper and rename it to observer set. * Add logger to smoke tests * [1521](https://github.com/zeta-chain/node/pull/1521) - replace go-tss lib version with one that reverts back to thorchain tss-lib +* Update --ledger flag hint ### Chores * [1446](https://github.com/zeta-chain/node/pull/1446) - renamed file `zetaclientd/aux.go` to `zetaclientd/utils.go` to avoid complaints from go package resolver. diff --git a/cmd/zetacored/main.go b/cmd/zetacored/main.go index 5da5d57913..4b12f153c7 100644 --- a/cmd/zetacored/main.go +++ b/cmd/zetacored/main.go @@ -34,7 +34,7 @@ func processError(err error) { if strings.Contains(err.Error(), "cannot set custom bip32 path with ledger") { printNotice([]string{ "note: --ledger flag can't be used with Ethereum HD path (used by default)", - "use --hd-path=\"\" in the command to use Cosmos HD path", + "Please set a blank path with --hd-path=\"\" to use Cosmos HD path instead.", }) os.Exit(1) } diff --git a/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go b/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go index 0af5fc9a2b..64f1396859 100644 --- a/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go +++ b/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go @@ -29,6 +29,24 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO return nil, observertypes.ErrSupportedChains } + // the cctx must exist + cctx, err := k.CctxByNonce(ctx, &types.QueryGetCctxByNonceRequest{ + ChainID: msg.ChainId, + Nonce: msg.Nonce, + }) + if err != nil { + return nil, cosmoserrors.Wrap(err, "CcxtByNonce failed") + } + if cctx == nil || cctx.CrossChainTx == nil { + return nil, cosmoserrors.Wrapf(types.ErrCannotFindCctx, "no corresponding cctx found for chain %d, nonce %d", msg.ChainId, msg.Nonce) + } + // tracker submission is only allowed when the cctx is pending + if !IsPending(*cctx.CrossChainTx) { + // garbage tracker (for any reason) is harmful to outTx observation and should be removed + k.RemoveOutTxTracker(ctx, msg.ChainId, msg.Nonce) + return &types.MsgAddToOutTxTrackerResponse{IsRemoved: true}, nil + } + if msg.Proof == nil { // without proof, only certain accounts can send this message adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) isAdmin := msg.Creator == adminPolicyAccount @@ -53,18 +71,6 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO isProven = true } - cctx, err := k.CctxByNonce(ctx, &types.QueryGetCctxByNonceRequest{ - ChainID: msg.ChainId, - Nonce: msg.Nonce, - }) - if err != nil || cctx == nil || cctx.CrossChainTx == nil { - return nil, cosmoserrors.Wrap(types.ErrCannotFindCctx, "cannot add out tx: no corresponding cctx found") - } - if !IsPending(*cctx.CrossChainTx) { - k.RemoveOutTxTracker(ctx, msg.ChainId, msg.Nonce) - return &types.MsgAddToOutTxTrackerResponse{IsRemoved: true}, nil - } - tracker, found := k.GetOutTxTracker(ctx, msg.ChainId, msg.Nonce) hash := types.TxHashList{ TxHash: msg.TxHash,