Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Aug 15, 2024
1 parent eea41e6 commit 52db441
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions app/ante/cosmos/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cosmos
import (
"fmt"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/authz"
Expand All @@ -28,7 +27,7 @@ func NewAuthzLimiterDecorator(disabledMsgTypes ...string) AuthzLimiterDecorator

func (ald AuthzLimiterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
if err := ald.checkDisabledMsgs(tx.GetMsgs(), false, 1); err != nil {
return ctx, errorsmod.Wrapf(errortypes.ErrUnauthorized, err.Error())
return ctx, errortypes.ErrUnauthorized.Wrap(err.Error())
}
return next(ctx, tx, simulate)
}
Expand Down
2 changes: 1 addition & 1 deletion precompiles/avs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (p Precompile) GetAVSParamsFromInputs(_ sdk.Context, args []interface{}) (*

// string, since it is the address_id representation
assetID, ok := args[6].([]string)
if !ok || assetID == nil || len(assetID) == 0 {
if !ok || len(assetID) == 0 {
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "[]string", assetID)
}
avsParams.AssetID = assetID
Expand Down
5 changes: 2 additions & 3 deletions testutil/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package testutil
import (
"time"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
abci "github.com/cometbft/cometbft/abci/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
Expand Down Expand Up @@ -191,7 +190,7 @@ func BroadcastTxBytes(app *app.ExocoreApp, txEncoder sdk.TxEncoder, tx sdk.Tx) (
req := abci.RequestDeliverTx{Tx: bz}
res := app.BaseApp.DeliverTx(req)
if res.Code != 0 {
return abci.ResponseDeliverTx{}, errorsmod.Wrapf(errortypes.ErrInvalidRequest, res.Log)
return abci.ResponseDeliverTx{}, errortypes.ErrInvalidRequest.Wrap(res.Log)
}

return res, nil
Expand Down Expand Up @@ -238,7 +237,7 @@ func checkTxBytes(app *app.ExocoreApp, txEncoder sdk.TxEncoder, tx sdk.Tx) (abci
req := abci.RequestCheckTx{Tx: bz}
res := app.BaseApp.CheckTx(req)
if res.Code != 0 {
return abci.ResponseCheckTx{}, errorsmod.Wrapf(errortypes.ErrInvalidRequest, res.Log)
return abci.ResponseCheckTx{}, errortypes.ErrInvalidRequest.Wrap(res.Log)
}

return res, nil
Expand Down
2 changes: 1 addition & 1 deletion x/dogfood/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (gs GenesisState) Validate() error {
}

if gs.LastTotalPower.IsNil() {
return errorsmod.Wrapf(
return errorsmod.Wrap(
ErrInvalidGenesisData,
"nil last total power",
)
Expand Down
4 changes: 2 additions & 2 deletions x/oracle/keeper/aggregator/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ func (agc *AggregatorContext) sanityCheck(msg *types.MsgCreatePrice) error {
}

// TODO: sanity check for price(no more than maxDetId count for each source, this should be take care in anteHandler)
if msg.Prices == nil || len(msg.Prices) == 0 {
if len(msg.Prices) == 0 {
return errors.New("msg should provide at least one price")
}

for _, pSource := range msg.Prices {
if pSource.Prices == nil || len(pSource.Prices) == 0 || len(pSource.Prices) > int(common.MaxDetID) || !agc.params.IsValidSource(pSource.SourceID) {
if len(pSource.Prices) == 0 || len(pSource.Prices) > int(common.MaxDetID) || !agc.params.IsValidSource(pSource.SourceID) {
return errors.New("source should be valid and provide at least one price")
}
// check with params is coressponding source is deteministic
Expand Down
2 changes: 1 addition & 1 deletion x/oracle/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func (p Params) CheckRules(feederID uint64, prices []*PriceSource) (bool, error)
feeder := p.TokenFeeders[feederID]
rule := p.Rules[feeder.RuleID]
// specified sources set, v1 use this rule to set `chainlink` as official source
if rule.SourceIDs != nil && len(rule.SourceIDs) > 0 {
if len(rule.SourceIDs) > 0 {
if len(rule.SourceIDs) != len(prices) {
return false, errors.New("count prices should match rule")
}
Expand Down

0 comments on commit 52db441

Please sign in to comment.