Skip to content

Commit

Permalink
Merge branch 'develop' into fix/websocket-size
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Jan 11, 2024
2 parents 973f2ee + 361fcaf commit 8371ed6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cmd/zetacored/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
30 changes: 18 additions & 12 deletions x/crosschain/keeper/msg_server_add_to_outtx_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 8371ed6

Please sign in to comment.