refactor(consensus): remove gov from consensus (#16500)

This commit is contained in:
Marko 2023-06-12 15:09:38 +02:00 committed by GitHub
parent f5a596c88b
commit 65ed869e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View File

@ -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()

View File

@ -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

View File

@ -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)
}