Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions app/ante/vesting.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package ante

import (
"slices"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -35,14 +37,12 @@ func (vad VestingAccountDecorator) AnteHandle(
for _, msg := range tx.GetMsgs() {
typeURL := sdk.MsgTypeURL(msg)

for _, disabledTypeURL := range vad.disabledMsgTypeURLs {
if typeURL == disabledTypeURL {
return ctx, errorsmod.Wrapf(
sdkerrors.ErrUnauthorized,
"MsgTypeURL %s not supported",
typeURL,
)
}
if slices.Contains(vad.disabledMsgTypeURLs, typeURL) {
return ctx, errorsmod.Wrapf(
sdkerrors.ErrUnauthorized,
"MsgTypeURL %s not supported",
typeURL,
)
}
}

Expand Down
7 changes: 3 additions & 4 deletions cmd/zetaclientd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"os"
"slices"
"strconv"

"github.com/pkg/errors"
Expand All @@ -22,10 +23,8 @@ func isObserverNode(ctx context.Context, zc *zetacore.Client) (bool, error) {

operatorAddress := zc.GetKeys().GetOperatorAddress().String()

for _, observer := range observers {
if observer == operatorAddress {
return true, nil
}
if slices.Contains(observers, operatorAddress) {
return true, nil
}

return false, nil
Expand Down
9 changes: 2 additions & 7 deletions cmd/zetae2e/local/monitor_priority_txs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package local
import (
"context"
"errors"
"slices"
"strings"
"time"

Expand Down Expand Up @@ -102,13 +103,7 @@ func isMsgTypeURLSystemTx(attr types.EventAttribute) bool {
"\"/zetachain.zetacore.observer.MsgVoteBlame\"",
}

for _, url := range systemTxsMsgTypeUrls {
if url == attr.Value {
return true
}
}

return false
return slices.Contains(systemTxsMsgTypeUrls, attr.Value)
}

func isActionNonSystemTx(attr types.EventAttribute) bool {
Expand Down
11 changes: 2 additions & 9 deletions rpc/namespaces/ethereum/eth/filters/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package filters

import (
"math/big"
"slices"

"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"golang.org/x/exp/slices"
)

// FilterLogs creates a slice of logs matching the given criteria.
Expand Down Expand Up @@ -37,14 +37,7 @@ Logs:
continue
}
for i, sub := range topics {
match := len(sub) == 0 // empty rule set == wildcard
for _, topic := range sub {
if log.Topics[i] == topic {
match = true
break
}
}
if !match {
if !slices.Contains(sub, log.Topics[i]) {
continue Logs
}
}
Expand Down
11 changes: 3 additions & 8 deletions x/crosschain/keeper/cctx.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keeper

import (
"slices"

"cosmossdk.io/store/prefix"
storetypes "cosmossdk.io/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -47,14 +49,7 @@ func (k Keeper) updateInboundHashToCCTX(
) {
in, _ := k.GetInboundHashToCctx(ctx, cctx.InboundParams.ObservedHash)
in.InboundHash = cctx.InboundParams.ObservedHash
found := false
for _, cctxIndex := range in.CctxIndex {
if cctxIndex == cctx.Index {
found = true
break
}
}
if !found {
if !slices.Contains(in.CctxIndex, cctx.Index) {
in.CctxIndex = append(in.CctxIndex, cctx.Index)
}
k.SetInboundHashToCctx(ctx, in)
Expand Down
9 changes: 3 additions & 6 deletions x/observer/keeper/observer_set.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keeper

import (
"slices"

"cosmossdk.io/errors"
"cosmossdk.io/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -29,12 +31,7 @@ func (k Keeper) IsAddressPartOfObserverSet(ctx sdk.Context, address string) bool
if !found {
return false
}
for _, addr := range observerSet.ObserverList {
if addr == address {
return true
}
}
return false
return slices.Contains(observerSet.ObserverList, address)
}

// AddObserverToSet adds an observer to the observer set.It makes sure the updated observer set is valid.
Expand Down