Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Apr 11, 2024
1 parent d32aa34 commit dbfb052
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
7 changes: 3 additions & 4 deletions x/emissions/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/zeta-chain/zetacore/x/emissions/client/cli"
"github.com/zeta-chain/zetacore/x/emissions/exported"
"github.com/zeta-chain/zetacore/x/emissions/keeper"
emissionskeeper "github.com/zeta-chain/zetacore/x/emissions/keeper"
"github.com/zeta-chain/zetacore/x/emissions/types"

abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -103,14 +102,14 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command {
type AppModule struct {
AppModuleBasic

keeper emissionskeeper.Keeper
keeper keeper.Keeper
// legacySubspace is used solely for migration of x/params managed parameters
legacySubspace exported.Subspace
}

func NewAppModule(
cdc codec.Codec,
keeper emissionskeeper.Keeper,
keeper keeper.Keeper,
ss exported.Subspace,
) AppModule {
return AppModule{
Expand Down Expand Up @@ -141,7 +140,7 @@ func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), emissionskeeper.NewMsgServerImpl(am.keeper))
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
m := keeper.NewMigrator(am.keeper, am.legacySubspace)
if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil {
Expand Down
13 changes: 9 additions & 4 deletions x/emissions/types/message_update_params.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package types

import (
errorsmod "cosmossdk.io/errors"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

var _ sdk.Msg = &MsgUpdateParams{}
Expand All @@ -12,13 +13,17 @@ func (m MsgUpdateParams) GetSignBytes() []byte {
}

func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(m.Authority)
addr, err := sdk.AccAddressFromBech32(m.Authority)
if err != nil {
panic(err)
}
return []sdk.AccAddress{addr}
}

func (m *MsgUpdateParams) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil {
return errorsmod.Wrap(err, "invalid authority address")
_, err := sdk.AccAddressFromBech32(m.Authority)
if err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err)
}

if err := m.Params.Validate(); err != nil {
Expand Down
13 changes: 9 additions & 4 deletions x/observer/types/message_update_params.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package types

import (
errorsmod "cosmossdk.io/errors"
cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

var _ sdk.Msg = &MsgUpdateParams{}
Expand All @@ -12,13 +13,17 @@ func (m MsgUpdateParams) GetSignBytes() []byte {
}

func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(m.Authority)
addr, err := sdk.AccAddressFromBech32(m.Authority)
if err != nil {
panic(err)
}
return []sdk.AccAddress{addr}
}

func (m *MsgUpdateParams) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil {
return errorsmod.Wrap(err, "invalid authority address")
_, err := sdk.AccAddressFromBech32(m.Authority)
if err != nil {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err)
}

if err := m.Params.Validate(); err != nil {

Check warning on line 29 in x/observer/types/message_update_params.go

View workflow job for this annotation

GitHub Actions / lint

if-return: redundant if ...; err != nil check, just return error instead. (revive)
Expand Down

0 comments on commit dbfb052

Please sign in to comment.