From dbfb052c808c5152456d1307e94d0fc373c408e0 Mon Sep 17 00:00:00 2001 From: skosito Date: Thu, 11 Apr 2024 21:12:40 +0200 Subject: [PATCH] Lint fixes --- x/emissions/module.go | 7 +++---- x/emissions/types/message_update_params.go | 13 +++++++++---- x/observer/types/message_update_params.go | 13 +++++++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/x/emissions/module.go b/x/emissions/module.go index 951467740c..172a79052f 100644 --- a/x/emissions/module.go +++ b/x/emissions/module.go @@ -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" @@ -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{ @@ -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 { diff --git a/x/emissions/types/message_update_params.go b/x/emissions/types/message_update_params.go index b71386ebb1..78b3d9912e 100644 --- a/x/emissions/types/message_update_params.go +++ b/x/emissions/types/message_update_params.go @@ -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{} @@ -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 { diff --git a/x/observer/types/message_update_params.go b/x/observer/types/message_update_params.go index b71386ebb1..78b3d9912e 100644 --- a/x/observer/types/message_update_params.go +++ b/x/observer/types/message_update_params.go @@ -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{} @@ -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 {