Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Sep 14, 2024
1 parent 8cdd8d7 commit 1329db4
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions vald/multisig/mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package multisig

import (
"context"
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -55,7 +56,7 @@ func (mgr Mgr) generateKey(keyUID string) (exported.PublicKey, error) {
case *tofnd.KeygenResponse_PubKey:
return res.GetPubKey(), nil
case *tofnd.KeygenResponse_Error:
return nil, fmt.Errorf(res.GetError())
return nil, errors.New(res.GetError())
default:
panic(fmt.Errorf("unknown multisig keygen response %T", res.GetKeygenResponse()))
}
Expand All @@ -72,14 +73,14 @@ func (mgr Mgr) sign(keyUID string, payloadHash exported.Hash, pubKey []byte) (ty
PubKey: pubKey,
})
if err != nil {
return nil, sdkerrors.Wrapf(err, "failed signing")
return nil, sdkerrors.Wrap(err, "failed signing")
}

switch res.GetSignResponse().(type) {
case *tofnd.SignResponse_Signature:
return res.GetSignature(), nil
case *tofnd.SignResponse_Error:
return nil, fmt.Errorf(res.GetError())
return nil, errors.New(res.GetError())
default:
panic(fmt.Errorf("unknown multisig sign response %T", res.GetSignResponse()))
}
Expand Down
3 changes: 2 additions & 1 deletion vald/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/spf13/cobra"

"github.com/axelarnetwork/axelar-core/utils"
Expand Down Expand Up @@ -126,7 +127,7 @@ func GetSignCommand() *cobra.Command {

return nil
case *tofnd.SignResponse_Error:
return fmt.Errorf(res.GetError())
return errors.New(res.GetError())
default:
panic(fmt.Errorf("unknown multisig sign response %T", res.GetSignResponse()))
}
Expand Down
2 changes: 1 addition & 1 deletion x/ante/check_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (d CheckProxy) AnteHandle(ctx sdk.Context, msgs []sdk.Msg, simulate bool, n
case *stakingtypes.MsgCreateValidator:
valAddress, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
if err != nil {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, err.Error())
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}
if proxy, active := d.snapshotter.GetProxy(ctx, valAddress); proxy.Empty() || !active {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "no proxy found for operator %s", valAddress.String())
Expand Down
2 changes: 1 addition & 1 deletion x/ante/check_refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (d CheckRefundFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
req := *msg
err := d.reward.SetPendingRefund(ctx, req, rewardtypes.Refund{Payer: feePayer, Fees: splitFees[0]})
if err != nil {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, err.Error())
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}
// when messages are batched not all are refundable, so we cannot use the msg index directly
splitFees = splitFees[1:]
Expand Down
4 changes: 2 additions & 2 deletions x/ante/undelegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ func (d UndelegateDecorator) AnteHandle(ctx sdk.Context, msgs []sdk.Msg, simulat
case *stakingtypes.MsgUndelegate:
valAddress, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
if err != nil {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, err.Error())
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}

delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, err.Error())
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}

// only restrict a validator from unbonding it's self-delegation
Expand Down
2 changes: 1 addition & 1 deletion x/axelarnet/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func ValidateIBCPath(path string) error {
// we only support direct IBC connections
pathSplit := strings.Split(path, "/")
if len(pathSplit) != 2 {
return fmt.Errorf(fmt.Sprintf("invalid IBC path %s", path))
return fmt.Errorf("invalid IBC path %s", path)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (q Querier) Bytecode(c context.Context, req *types.BytecodeRequest) (*types
return nil, status.Error(codes.NotFound, sdkerrors.Wrap(types.ErrEVM, fmt.Sprintf("could not retrieve bytecode for chain %s", req.Chain)).Error())
}

return &types.BytecodeResponse{Bytecode: fmt.Sprintf("0x" + common.Bytes2Hex(bytecode))}, nil
return &types.BytecodeResponse{Bytecode: "0x" + common.Bytes2Hex(bytecode)}, nil
}

// ERC20Tokens returns the ERC20 tokens registered for a chain
Expand Down
2 changes: 1 addition & 1 deletion x/nexus/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (q Querier) TransferRateLimit(c context.Context, req *types.TransferRateLim

chain, ok := q.keeper.GetChain(ctx, nexus.ChainName(req.Chain))
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrNotFound, fmt.Errorf("chain %s not found", req.Chain).Error())
return nil, sdkerrors.Wrap(sdkerrors.ErrNotFound, fmt.Errorf("chain %s not found", req.Chain).Error())
}

rateLimit, found := q.keeper.getRateLimit(ctx, chain.Name, req.Asset)
Expand Down

0 comments on commit 1329db4

Please sign in to comment.