diff --git a/baseapp/block_gas_test.go b/baseapp/block_gas_test.go index e69a4e00c8a0..e41bd212a431 100644 --- a/baseapp/block_gas_test.go +++ b/baseapp/block_gas_test.go @@ -26,6 +26,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -35,8 +36,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx/signing" ) -const mintModuleName = "mint" - var blockMaxGas = uint64(simtestutil.DefaultConsensusParams.Block.MaxGas) type BlockGasImpl struct { @@ -130,9 +129,9 @@ func TestBaseApp_BlockGas(t *testing.T) { // test account and fund priv1, _, addr1 := testdata.KeyTestPubAddr() - err = bankKeeper.MintCoins(ctx, mintModuleName, feeAmount) + err = bankKeeper.MintCoins(ctx, testutil.MintModuleName, feeAmount) require.NoError(t, err) - err = bankKeeper.SendCoinsFromModuleToAccount(ctx, mintModuleName, addr1, feeAmount) + err = bankKeeper.SendCoinsFromModuleToAccount(ctx, testutil.MintModuleName, addr1, feeAmount) require.NoError(t, err) require.Equal(t, feeCoin.Amount, bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount) seq := accountKeeper.GetAccount(ctx, addr1).GetSequence() diff --git a/client/v2/go.mod b/client/v2/go.mod index b7c75424ee6f..11f78903067b 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -163,7 +163,6 @@ replace ( cosmossdk.io/x/auth => ./../../x/auth cosmossdk.io/x/bank => ./../../x/bank cosmossdk.io/x/distribution => ./../../x/distribution - cosmossdk.io/x/gov => ./../../x/gov cosmossdk.io/x/mint => ./../../x/mint cosmossdk.io/x/protocolpool => ./../../x/protocolpool cosmossdk.io/x/slashing => ./../../x/slashing diff --git a/go.mod b/go.mod index d567c59d0f21..db9ba98f8b0d 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( cosmossdk.io/store v1.0.0 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.12.0 github.com/99designs/keyring v1.2.1 @@ -170,7 +169,6 @@ replace ( cosmossdk.io/x/auth => ./x/auth cosmossdk.io/x/bank => ./x/bank cosmossdk.io/x/distribution => ./x/distribution - cosmossdk.io/x/gov => ./x/gov cosmossdk.io/x/mint => ./x/mint cosmossdk.io/x/protocolpool => ./x/protocolpool cosmossdk.io/x/slashing => ./x/slashing diff --git a/go.work.example b/go.work.example index b01e3260a663..49efc9086a9f 100644 --- a/go.work.example +++ b/go.work.example @@ -30,6 +30,7 @@ use ( ./x/feegrant ./x/gov ./x/group + ./x/mint ./x/nft ./x/params ./x/protocolpool diff --git a/testutil/configurator/configurator.go b/testutil/configurator/configurator.go index 08f577b8ab8a..1a929abe5f57 100644 --- a/testutil/configurator/configurator.go +++ b/testutil/configurator/configurator.go @@ -8,6 +8,7 @@ import ( bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" + countermodulev1 "cosmossdk.io/api/cosmos/counter/module/v1" distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" @@ -24,6 +25,7 @@ import ( vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/core/appconfig" "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/testutil" ) // Config should never need to be instantiated manually and is solely used for ModuleOption. @@ -40,68 +42,68 @@ func defaultConfig() *Config { return &Config{ ModuleConfigs: make(map[string]*appv1alpha1.ModuleConfig), PreBlockersOrder: []string{ - "upgrade", + testutil.UpgradeModuleName, }, BeginBlockersOrder: []string{ - "mint", - "distribution", - "slashing", - "evidence", - "staking", - "auth", - "bank", - "gov", + testutil.MintModuleName, + testutil.DistributionModuleName, + testutil.SlashingModuleName, + testutil.EvidenceModuleName, + testutil.StakingModuleName, + testutil.AuthModuleName, + testutil.BankModuleName, + testutil.GovModuleName, "crisis", "genutil", - "authz", - "feegrant", - "nft", - "group", + testutil.AuthzModuleName, + testutil.FeegrantModuleName, + testutil.NFTModuleName, + testutil.GroupModuleName, "consensus", - "params", + testutil.ParamsModuleName, "vesting", - "circuit", + testutil.CircuitModuleName, }, EndBlockersOrder: []string{ "crisis", - "gov", - "staking", - "auth", - "bank", - "distribution", - "slashing", - "mint", + testutil.GovModuleName, + testutil.StakingModuleName, + testutil.AuthModuleName, + testutil.BankModuleName, + testutil.DistributionModuleName, + testutil.SlashingModuleName, + testutil.MintModuleName, "genutil", - "evidence", - "authz", - "feegrant", - "nft", - "group", + testutil.EvidenceModuleName, + testutil.AuthzModuleName, + testutil.FeegrantModuleName, + testutil.NFTModuleName, + testutil.GroupModuleName, "consensus", - "upgrade", + testutil.UpgradeModuleName, "vesting", - "circuit", - "protocolpool", + testutil.CircuitModuleName, + testutil.ProtocolPoolModuleName, }, InitGenesisOrder: []string{ - "auth", - "bank", - "distribution", - "staking", - "slashing", - "gov", - "mint", + testutil.AuthModuleName, + testutil.BankModuleName, + testutil.DistributionModuleName, + testutil.StakingModuleName, + testutil.SlashingModuleName, + testutil.GovModuleName, + testutil.MintModuleName, "crisis", "genutil", - "evidence", - "authz", - "feegrant", - "nft", - "group", + testutil.EvidenceModuleName, + testutil.AuthzModuleName, + testutil.FeegrantModuleName, + testutil.NFTModuleName, + testutil.GroupModuleName, "consensus", - "upgrade", + testutil.UpgradeModuleName, "vesting", - "circuit", + testutil.CircuitModuleName, }, setInitGenesis: true, } @@ -135,8 +137,8 @@ func WithCustomInitGenesisOrder(initGenesisOrder ...string) ModuleOption { func BankModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["bank"] = &appv1alpha1.ModuleConfig{ - Name: "bank", + config.ModuleConfigs[testutil.BankModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.BankModuleName, Config: appconfig.WrapAny(&bankmodulev1.Module{}), } } @@ -144,19 +146,19 @@ func BankModule() ModuleOption { func AuthModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["auth"] = &appv1alpha1.ModuleConfig{ - Name: "auth", + config.ModuleConfigs[testutil.AuthModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.AuthModuleName, Config: appconfig.WrapAny(&authmodulev1.Module{ Bech32Prefix: "cosmos", ModuleAccountPermissions: []*authmodulev1.ModuleAccountPermission{ {Account: "fee_collector"}, - {Account: "distribution"}, - {Account: "mint", Permissions: []string{"minter"}}, - {Account: "bonded_tokens_pool", Permissions: []string{"burner", "staking"}}, - {Account: "not_bonded_tokens_pool", Permissions: []string{"burner", "staking"}}, - {Account: "gov", Permissions: []string{"burner"}}, - {Account: "nft"}, - {Account: "protocolpool"}, + {Account: testutil.DistributionModuleName}, + {Account: testutil.MintModuleName, Permissions: []string{"minter"}}, + {Account: "bonded_tokens_pool", Permissions: []string{"burner", testutil.StakingModuleName}}, + {Account: "not_bonded_tokens_pool", Permissions: []string{"burner", testutil.StakingModuleName}}, + {Account: testutil.GovModuleName, Permissions: []string{"burner"}}, + {Account: testutil.NFTModuleName}, + {Account: testutil.ProtocolPoolModuleName}, }, }), } @@ -165,8 +167,8 @@ func AuthModule() ModuleOption { func ParamsModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["params"] = &appv1alpha1.ModuleConfig{ - Name: "params", + config.ModuleConfigs[testutil.ParamsModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.ParamsModuleName, Config: appconfig.WrapAny(¶msmodulev1.Module{}), } } @@ -174,8 +176,8 @@ func ParamsModule() ModuleOption { func TxModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["tx"] = &appv1alpha1.ModuleConfig{ - Name: "tx", + config.ModuleConfigs[testutil.TxModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.TxModuleName, Config: appconfig.WrapAny(&txconfigv1.Config{}), } } @@ -183,8 +185,8 @@ func TxModule() ModuleOption { func StakingModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["staking"] = &appv1alpha1.ModuleConfig{ - Name: "staking", + config.ModuleConfigs[testutil.StakingModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.StakingModuleName, Config: appconfig.WrapAny(&stakingmodulev1.Module{}), } } @@ -192,8 +194,8 @@ func StakingModule() ModuleOption { func SlashingModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["slashing"] = &appv1alpha1.ModuleConfig{ - Name: "slashing", + config.ModuleConfigs[testutil.SlashingModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.SlashingModuleName, Config: appconfig.WrapAny(&slashingmodulev1.Module{}), } } @@ -210,8 +212,8 @@ func GenutilModule() ModuleOption { func DistributionModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["distribution"] = &appv1alpha1.ModuleConfig{ - Name: "distribution", + config.ModuleConfigs[testutil.DistributionModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.DistributionModuleName, Config: appconfig.WrapAny(&distrmodulev1.Module{}), } } @@ -219,8 +221,8 @@ func DistributionModule() ModuleOption { func FeegrantModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["feegrant"] = &appv1alpha1.ModuleConfig{ - Name: "feegrant", + config.ModuleConfigs[testutil.FeegrantModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.FeegrantModuleName, Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), } } @@ -237,8 +239,8 @@ func VestingModule() ModuleOption { func GovModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["gov"] = &appv1alpha1.ModuleConfig{ - Name: "gov", + config.ModuleConfigs[testutil.GovModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.GovModuleName, Config: appconfig.WrapAny(&govmodulev1.Module{}), } } @@ -255,8 +257,8 @@ func ConsensusModule() ModuleOption { func MintModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["mint"] = &appv1alpha1.ModuleConfig{ - Name: "mint", + config.ModuleConfigs[testutil.MintModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.MintModuleName, Config: appconfig.WrapAny(&mintmodulev1.Module{}), GolangBindings: []*appv1alpha1.GolangBinding{ { @@ -270,8 +272,8 @@ func MintModule() ModuleOption { func EvidenceModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["evidence"] = &appv1alpha1.ModuleConfig{ - Name: "evidence", + config.ModuleConfigs[testutil.EvidenceModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.EvidenceModuleName, Config: appconfig.WrapAny(&evidencemodulev1.Module{}), } } @@ -279,8 +281,8 @@ func EvidenceModule() ModuleOption { func AuthzModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["authz"] = &appv1alpha1.ModuleConfig{ - Name: "authz", + config.ModuleConfigs[testutil.AuthzModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.AuthzModuleName, Config: appconfig.WrapAny(&authzmodulev1.Module{}), } } @@ -288,8 +290,8 @@ func AuthzModule() ModuleOption { func GroupModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["group"] = &appv1alpha1.ModuleConfig{ - Name: "group", + config.ModuleConfigs[testutil.GroupModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.GroupModuleName, Config: appconfig.WrapAny(&groupmodulev1.Module{}), } } @@ -297,8 +299,8 @@ func GroupModule() ModuleOption { func NFTModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["nft"] = &appv1alpha1.ModuleConfig{ - Name: "nft", + config.ModuleConfigs[testutil.NFTModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.NFTModuleName, Config: appconfig.WrapAny(&nftmodulev1.Module{}), } } @@ -306,8 +308,8 @@ func NFTModule() ModuleOption { func CircuitModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["circuit"] = &appv1alpha1.ModuleConfig{ - Name: "circuit", + config.ModuleConfigs[testutil.CircuitModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.CircuitModuleName, Config: appconfig.WrapAny(&circuitmodulev1.Module{}), } } @@ -315,13 +317,22 @@ func CircuitModule() ModuleOption { func ProtocolPoolModule() ModuleOption { return func(config *Config) { - config.ModuleConfigs["protocolpool"] = &appv1alpha1.ModuleConfig{ - Name: "protocolpool", + config.ModuleConfigs[testutil.ProtocolPoolModuleName] = &appv1alpha1.ModuleConfig{ + Name: testutil.ProtocolPoolModuleName, Config: appconfig.WrapAny(&poolmodulev1.Module{}), } } } +func CounterModule() ModuleOption { + return func(config *Config) { + config.ModuleConfigs["counter"] = &appv1alpha1.ModuleConfig{ + Name: "counter", + Config: appconfig.WrapAny(&countermodulev1.Module{}), + } + } +} + func OmitInitGenesis() ModuleOption { return func(config *Config) { config.setInitGenesis = false @@ -364,8 +375,8 @@ func NewAppConfig(opts ...ModuleOption) depinject.Config { } } - if _, ok := cfg.ModuleConfigs["auth"]; ok { - overrides = append(overrides, &runtimev1alpha1.StoreKeyConfig{ModuleName: "auth", KvStoreKey: "acc"}) + if _, ok := cfg.ModuleConfigs[testutil.AuthModuleName]; ok { + overrides = append(overrides, &runtimev1alpha1.StoreKeyConfig{ModuleName: testutil.AuthModuleName, KvStoreKey: "acc"}) } runtimeConfig := &runtimev1alpha1.Module{ diff --git a/testutil/types.go b/testutil/types.go new file mode 100644 index 000000000000..7f5663167b67 --- /dev/null +++ b/testutil/types.go @@ -0,0 +1,25 @@ +package testutil + +// This file contains the list of module names are that maintained by the SDK team. +// Those constants are defined here to be used in the SDK without importing those modules + +const ( + AccountsModuleName = "accounts" + AuthModuleName = "auth" + AuthzModuleName = "authz" + BankModuleName = "bank" + CircuitModuleName = "circuit" + DistributionModuleName = "distribution" + EvidenceModuleName = "evidence" + FeegrantModuleName = "feegrant" + GovModuleName = "gov" + GroupModuleName = "group" + MintModuleName = "mint" + NFTModuleName = "nft" + ParamsModuleName = "params" + ProtocolPoolModuleName = "protocolpool" + SlashingModuleName = "slashing" + StakingModuleName = "staking" + TxModuleName = "tx" + UpgradeModuleName = "upgrade" +) diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 7f4d329f144f..ef81053fda64 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -150,16 +150,13 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -replace ( - cosmossdk.io/api => ../../api - github.com/cosmos/cosmos-sdk => ../../. -) +replace github.com/cosmos/cosmos-sdk => ../../. replace ( + cosmossdk.io/api => ../../api cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/slashing => ../slashing cosmossdk.io/x/staking => ../staking diff --git a/x/auth/go.mod b/x/auth/go.mod index 4c914079074c..e0c4d1024f22 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -163,7 +163,6 @@ replace github.com/cosmos/cosmos-sdk => ../../. replace ( cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing diff --git a/x/bank/go.mod b/x/bank/go.mod index c6322e0b33c4..4989f28751be 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -162,7 +162,6 @@ replace github.com/cosmos/cosmos-sdk => ../../. replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 75a840a2549b..92f352db010b 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -163,7 +163,6 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing diff --git a/x/crisis/keeper/msg_server.go b/x/crisis/keeper/msg_server.go index b09d1353c889..1602a685882e 100644 --- a/x/crisis/keeper/msg_server.go +++ b/x/crisis/keeper/msg_server.go @@ -4,7 +4,6 @@ import ( "context" "cosmossdk.io/errors" - govtypes "cosmossdk.io/x/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -78,7 +77,7 @@ func (k *Keeper) VerifyInvariant(goCtx context.Context, msg *types.MsgVerifyInva // It defines a method to update the x/crisis module parameters. func (k *Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.authority != msg.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } if !msg.ConstantFee.IsValid() { diff --git a/x/crisis/module.go b/x/crisis/module.go index b1b7f287d268..1dfdb01499d0 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -16,7 +16,6 @@ import ( "cosmossdk.io/core/store" "cosmossdk.io/depinject" authtypes "cosmossdk.io/x/auth/types" - govtypes "cosmossdk.io/x/gov/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -201,7 +200,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } // default to governance authority if not provided - authority := authtypes.NewModuleAddress(govtypes.ModuleName) + authority := authtypes.NewModuleAddress(types.GovModuleName) if in.Config.Authority != "" { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } diff --git a/x/crisis/types/errors.go b/x/crisis/types/errors.go index 9086c5abf0e5..6bb22700a068 100644 --- a/x/crisis/types/errors.go +++ b/x/crisis/types/errors.go @@ -6,4 +6,5 @@ import "cosmossdk.io/errors" var ( ErrNoSender = errors.Register(ModuleName, 2, "sender address is empty") ErrUnknownInvariant = errors.Register(ModuleName, 3, "unknown invariant") + ErrInvalidSigner = errors.Register(ModuleName, 4, "expected authority account as only signer for proposal message") ) diff --git a/x/crisis/types/keys.go b/x/crisis/types/keys.go index 26218e63fd53..91df68ddaa14 100644 --- a/x/crisis/types/keys.go +++ b/x/crisis/types/keys.go @@ -7,6 +7,11 @@ const ( ModuleName = "crisis" StoreKey = ModuleName + + // GovModuleName duplicates the gov module's name to avoid a cyclic dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9 + GovModuleName = "gov" ) var ConstantFeeKey = collections.NewPrefix(1) diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 5f2d55b06896..55f4d0052fb4 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -164,7 +164,6 @@ replace github.com/cosmos/cosmos-sdk => ../../. replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 1c440306c047..34225df0240d 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -129,8 +129,6 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= @@ -531,8 +529,6 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= -github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= diff --git a/x/distribution/types/keys.go b/x/distribution/types/keys.go index 8c44743f5d86..70260d5a7515 100644 --- a/x/distribution/types/keys.go +++ b/x/distribution/types/keys.go @@ -20,7 +20,9 @@ const ( // RouterKey is the message route for distribution RouterKey = ModuleName - // GovModuleName is the name of the gov module + // GovModuleName duplicates the gov module's name to avoid a cyclic dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9 GovModuleName = "gov" ) diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 66a75f06404e..0365b6abcac2 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -30,7 +30,6 @@ require ( ) require ( - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 // indirect cosmossdk.io/x/tx v0.12.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -166,7 +165,6 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing diff --git a/x/mint/go.mod b/x/mint/go.mod index 065157b6d843..fc499fd8d113 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -164,7 +164,6 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing cosmossdk.io/x/staking => ../staking diff --git a/x/nft/go.mod b/x/nft/go.mod index 82a335c96f84..bb896d0f626a 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -164,7 +164,6 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 015b55d6cfe7..b1c3f52fba2d 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -14,7 +14,6 @@ require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/distribution v0.0.0-20230925135524-a1bc045b3190 - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-proto v1.0.0-beta.3 @@ -42,7 +41,6 @@ require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect @@ -107,7 +105,6 @@ require ( github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.8.4 // indirect github.com/magiconair/properties v1.8.7 // indirect - github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect @@ -168,7 +165,6 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/slashing => ../slashing cosmossdk.io/x/staking => ../staking diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index ffbb0d4f4995..34225df0240d 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -128,14 +128,8 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= -github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= -github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -535,8 +529,6 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= -github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -1016,7 +1008,6 @@ golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/x/protocolpool/testutil/app_config.go b/x/protocolpool/testutil/app_config.go index cb20ee67f165..2c4fe0c6b488 100644 --- a/x/protocolpool/testutil/app_config.go +++ b/x/protocolpool/testutil/app_config.go @@ -5,7 +5,6 @@ import ( _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring _ "cosmossdk.io/x/bank" // import as blank for app wiring _ "cosmossdk.io/x/distribution" // import as blank for app wiring - _ "cosmossdk.io/x/gov" // import as blank for app wiring _ "cosmossdk.io/x/mint" // import as blank for app wiring _ "cosmossdk.io/x/protocolpool" // import as blank for app wiring _ "cosmossdk.io/x/staking" // import as blank for app wiring @@ -25,5 +24,4 @@ var AppConfig = configurator.NewAppConfig( configurator.DistributionModule(), configurator.MintModule(), configurator.ProtocolPoolModule(), - configurator.GovModule(), ) diff --git a/x/protocolpool/types/keys.go b/x/protocolpool/types/keys.go index e9427489c754..67f58b8ffec8 100644 --- a/x/protocolpool/types/keys.go +++ b/x/protocolpool/types/keys.go @@ -12,7 +12,9 @@ const ( // RouterKey is the message route for protocolpool RouterKey = ModuleName - // GovModuleName is the name of the gov module + // GovModuleName duplicates the gov module's name to avoid a cyclic dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9 GovModuleName = "gov" ) diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 3130c0432788..ffe6e1c90c9b 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -13,7 +13,6 @@ require ( cosmossdk.io/store v1.0.0 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/distribution v0.0.0-20230925135524-a1bc045b3190 - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000 cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 @@ -169,7 +168,6 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/staking => ../staking diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 1c440306c047..34225df0240d 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -129,8 +129,6 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= @@ -531,8 +529,6 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= -github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= diff --git a/x/slashing/keeper/keeper_test.go b/x/slashing/keeper/keeper_test.go index 24cf08c2aa16..65472079868e 100644 --- a/x/slashing/keeper/keeper_test.go +++ b/x/slashing/keeper/keeper_test.go @@ -13,9 +13,9 @@ import ( sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" - govtypes "cosmossdk.io/x/gov/types" slashingkeeper "cosmossdk.io/x/slashing/keeper" slashingtestutil "cosmossdk.io/x/slashing/testutil" + "cosmossdk.io/x/slashing/types" slashingtypes "cosmossdk.io/x/slashing/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -55,7 +55,7 @@ func (s *KeeperTestSuite) SetupTest() { s.stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec("cosmosvaloper")).AnyTimes() s.stakingKeeper.EXPECT().ConsensusAddressCodec().Return(address.NewBech32Codec("cosmosvalcons")).AnyTimes() - authStr, err := address.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(govtypes.ModuleName)) + authStr, err := address.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(types.GovModuleName)) s.Require().NoError(err) s.ctx = ctx diff --git a/x/slashing/keeper/msg_server.go b/x/slashing/keeper/msg_server.go index b96ebb5b9250..e8ad08d01f23 100644 --- a/x/slashing/keeper/msg_server.go +++ b/x/slashing/keeper/msg_server.go @@ -4,7 +4,6 @@ import ( "context" "cosmossdk.io/errors" - govtypes "cosmossdk.io/x/gov/types" "cosmossdk.io/x/slashing/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -26,7 +25,7 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { // It defines a method to update the x/slashing module parameters. func (k msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.authority != msg.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } if err := msg.Params.Validate(); err != nil { diff --git a/x/slashing/module.go b/x/slashing/module.go index 49a62f30dedb..c758d8fbef71 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -12,7 +12,6 @@ import ( store "cosmossdk.io/core/store" "cosmossdk.io/depinject" authtypes "cosmossdk.io/x/auth/types" - govtypes "cosmossdk.io/x/gov/types" "cosmossdk.io/x/slashing/keeper" "cosmossdk.io/x/slashing/simulation" "cosmossdk.io/x/slashing/types" @@ -218,7 +217,7 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { // default to governance authority if not provided - authority := authtypes.NewModuleAddress(govtypes.ModuleName) + authority := authtypes.NewModuleAddress(types.GovModuleName) if in.Config.Authority != "" { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } diff --git a/x/slashing/types/errors.go b/x/slashing/types/errors.go index 2fb1f5e75649..4c26bc79fc83 100644 --- a/x/slashing/types/errors.go +++ b/x/slashing/types/errors.go @@ -12,4 +12,5 @@ var ( ErrSelfDelegationTooLowToUnjail = errors.Register(ModuleName, 7, "validator's self delegation less than minimum; cannot be unjailed") ErrNoSigningInfoFound = errors.Register(ModuleName, 8, "no validator signing info found") ErrValidatorTombstoned = errors.Register(ModuleName, 9, "validator already tombstoned") + ErrInvalidSigner = errors.Register(ModuleName, 10, "expected authority account as only signer for proposal message") ) diff --git a/x/slashing/types/keys.go b/x/slashing/types/keys.go index 91a8c9fe1c98..9bbaf26bcadb 100644 --- a/x/slashing/types/keys.go +++ b/x/slashing/types/keys.go @@ -35,6 +35,11 @@ const ( // As for the storage overhead, with the same factor f, it is as follows: // (N - 256) + (N / ChunkSize) * (512 * f) MissedBlockBitmapChunkSize = 1024 // 2^10 bits + + // GovModuleName duplicates the gov module's name to avoid a cyclic dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9 + GovModuleName = "gov" ) // Keys for slashing store diff --git a/x/staking/go.mod b/x/staking/go.mod index 533d6bd96474..259b3b0a5d65 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -36,7 +36,6 @@ require ( require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 // indirect cosmossdk.io/x/tx v0.12.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -169,7 +168,6 @@ replace ( cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution - cosmossdk.io/x/gov => ../gov cosmossdk.io/x/mint => ../mint cosmossdk.io/x/protocolpool => ../protocolpool cosmossdk.io/x/slashing => ../slashing diff --git a/x/staking/go.sum b/x/staking/go.sum index 1c440306c047..34225df0240d 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -129,8 +129,6 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= @@ -531,8 +529,6 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= -github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= diff --git a/x/upgrade/keeper/grpc_query_test.go b/x/upgrade/keeper/grpc_query_test.go index 7395020af0b8..939746872769 100644 --- a/x/upgrade/keeper/grpc_query_test.go +++ b/x/upgrade/keeper/grpc_query_test.go @@ -41,7 +41,7 @@ func (suite *UpgradeTestSuite) SetupTest() { suite.ctx = testCtx.Ctx skipUpgradeHeights := make(map[int64]bool) - authority, err := addresscodec.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(govModuleName)) + authority, err := addresscodec.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(types.GovModuleName)) suite.Require().NoError(err) suite.encodedAuthority = authority suite.upgradeKeeper = keeper.NewKeeper(skipUpgradeHeights, storeService, suite.encCfg.Codec, suite.T().TempDir(), nil, authority) diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 951e2e42acfb..ee87c2f23d89 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -27,8 +27,6 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" ) -const govModuleName = "gov" - type KeeperTestSuite struct { suite.Suite @@ -67,7 +65,7 @@ func (s *KeeperTestSuite) SetupTest() { homeDir := filepath.Join(s.T().TempDir(), "x_upgrade_keeper_test") ac := addresscodec.NewBech32Codec("cosmos") - authority, err := ac.BytesToString(authtypes.NewModuleAddress(govModuleName)) + authority, err := ac.BytesToString(authtypes.NewModuleAddress(types.GovModuleName)) s.Require().NoError(err) s.encodedAuthority = authority s.upgradeKeeper = keeper.NewKeeper(skipUpgradeHeights, storeService, s.encCfg.Codec, homeDir, s.baseApp, authority) diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 472ebe0d8f5a..7a0014178c56 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -29,8 +29,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" ) -const govModuleName = "gov" - func init() { types.RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } @@ -207,7 +205,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } // default to governance authority if not provided - authority := authtypes.NewModuleAddress(govModuleName) + authority := authtypes.NewModuleAddress(types.GovModuleName) if in.Config.Authority != "" { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } diff --git a/x/upgrade/types/keys.go b/x/upgrade/types/keys.go index 2920aafaf614..e74420fbfe74 100644 --- a/x/upgrade/types/keys.go +++ b/x/upgrade/types/keys.go @@ -11,6 +11,11 @@ const ( // StoreKey is the prefix under which we store this module's data StoreKey = ModuleName + + // GovModuleName duplicates the gov module's name to avoid a cyclic dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9 + GovModuleName = "gov" ) const (