From 65ed869e3913a79c484c15bf1930c47e0cee818d Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 12 Jun 2023 15:09:38 +0200 Subject: [PATCH] refactor(consensus): remove gov from consensus (#16500) --- x/consensus/keeper/keeper.go | 5 ++--- x/consensus/keeper/keeper_test.go | 3 +-- x/consensus/module.go | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 6de6457bf2..d23cf6fc7f 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -2,11 +2,11 @@ package keeper import ( "context" + "fmt" "cosmossdk.io/collections" "cosmossdk.io/core/event" storetypes "cosmossdk.io/core/store" - "cosmossdk.io/errors" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" cmttypes "github.com/cometbft/cometbft/types" @@ -16,7 +16,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/consensus/exported" "github.com/cosmos/cosmos-sdk/x/consensus/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) var StoreKey = "Consensus" @@ -65,7 +64,7 @@ var _ types.MsgServer = Keeper{} func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != msg.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, fmt.Errorf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) } consensusParams := msg.ToProtoConsensusParams() diff --git a/x/consensus/keeper/keeper_test.go b/x/consensus/keeper/keeper_test.go index e1b142d319..a0057659d9 100644 --- a/x/consensus/keeper/keeper_test.go +++ b/x/consensus/keeper/keeper_test.go @@ -17,7 +17,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" "github.com/cosmos/cosmos-sdk/x/consensus/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) type KeeperTestSuite struct { @@ -35,7 +34,7 @@ func (s *KeeperTestSuite) SetupTest() { encCfg := moduletestutil.MakeTestEncodingConfig() storeService := runtime.NewKVStoreService(key) - keeper := consensusparamkeeper.NewKeeper(encCfg.Codec, storeService, authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) + keeper := consensusparamkeeper.NewKeeper(encCfg.Codec, storeService, authtypes.NewModuleAddress("gov").String(), runtime.EventService{}) s.ctx = ctx s.consensusParamsKeeper = &keeper diff --git a/x/consensus/module.go b/x/consensus/module.go index 1834077305..ca186a595a 100644 --- a/x/consensus/module.go +++ b/x/consensus/module.go @@ -25,7 +25,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/consensus/keeper" "github.com/cosmos/cosmos-sdk/x/consensus/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) // ConsensusVersion defines the current x/consensus module consensus version. @@ -160,7 +159,7 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { // default to governance authority if not provided - authority := authtypes.NewModuleAddress(govtypes.ModuleName) + authority := authtypes.NewModuleAddress("gov") if in.Config.Authority != "" { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) }