diff --git a/CHANGELOG.md b/CHANGELOG.md index 575189fedfb..fd754cd2bd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -251,6 +251,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/*all*) [#16052](https://github.com/cosmos/cosmos-sdk/pull/16062) `GetSignBytes` implementations on messages and global legacy amino codec definitions have been removed from all modules. * (sims) [#16052](https://github.com/cosmos/cosmos-sdk/pull/16062) `GetOrGenerate` no longer requires a codec argument is now 4-arity instead of 5-arity. * (baseapp) [#16342](https://github.com/cosmos/cosmos-sdk/pull/16342) NewContext was renamed to NewContextLegacy. The replacement (NewContext) now does not take a header, instead you should set the header via `WithHeaderInfo` or `WithBlockHeight`. Note that `WithBlockHeight` will soon be depreacted and its recommneded to use `WithHeaderInfo` +* (x/auth) [#16112](https://github.com/cosmos/cosmos-sdk/issues/16112) `helpers.AddGenesisAccount` has been moved to `x/genutil` to remove the cyclic dependency between `x/auth` and `x/genutil`. ### Client Breaking Changes diff --git a/x/auth/client/cli/suite_test.go b/tests/integration/auth/client/cli/suite_test.go similarity index 100% rename from x/auth/client/cli/suite_test.go rename to tests/integration/auth/client/cli/suite_test.go diff --git a/x/auth/keeper/msg_server.go b/x/auth/keeper/msg_server.go index fbfc0f95ebe..cee9af2633e 100644 --- a/x/auth/keeper/msg_server.go +++ b/x/auth/keeper/msg_server.go @@ -2,12 +2,10 @@ package keeper import ( "context" - - "cosmossdk.io/errors" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) var _ types.MsgServer = msgServer{} @@ -25,7 +23,9 @@ func NewMsgServerImpl(ak AccountKeeper) types.MsgServer { func (ms msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if ms.ak.authority != msg.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.ak.authority, msg.Authority) + return nil, fmt.Errorf( + "expected gov account as only signer for proposal message; invalid authority; expected %s, got %s", + ms.ak.authority, msg.Authority) } if err := msg.Params.Validate(); err != nil { diff --git a/x/auth/module.go b/x/auth/module.go index b6319950ef8..40bd46896d6 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -10,6 +10,7 @@ import ( "github.com/spf13/cobra" "cosmossdk.io/depinject" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" "cosmossdk.io/core/address" @@ -30,11 +31,13 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/simulation" "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) // ConsensusVersion defines the current x/auth module consensus version. -const ConsensusVersion = 5 +const ( + ConsensusVersion = 5 + GovModuleName = "gov" +) var ( _ module.AppModule = AppModule{} @@ -239,7 +242,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } // default to governance authority if not provided - authority := types.NewModuleAddress(govtypes.ModuleName) + authority := types.NewModuleAddress(GovModuleName) if in.Config.Authority != "" { authority = types.NewModuleAddressOrBech32Address(in.Config.Authority) } diff --git a/x/genutil/client/cli/genaccount.go b/x/genutil/client/cli/genaccount.go index d92fc2888df..0bedc26a1ba 100644 --- a/x/genutil/client/cli/genaccount.go +++ b/x/genutil/client/cli/genaccount.go @@ -4,14 +4,14 @@ import ( "bufio" "fmt" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" - auth "github.com/cosmos/cosmos-sdk/x/auth/helpers" - - "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/x/genutil" ) const ( @@ -74,7 +74,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa vestingAmtStr, _ := cmd.Flags().GetString(flagVestingAmt) moduleNameStr, _ := cmd.Flags().GetString(flagModuleName) - return auth.AddGenesisAccount(clientCtx.Codec, addr, appendflag, config.GenesisFile(), args[1], vestingAmtStr, vestingStart, vestingEnd, moduleNameStr) + return genutil.AddGenesisAccount(clientCtx.Codec, addr, appendflag, config.GenesisFile(), args[1], vestingAmtStr, vestingStart, vestingEnd, moduleNameStr) }, } diff --git a/x/auth/helpers/genaccounts.go b/x/genutil/genaccounts.go similarity index 97% rename from x/auth/helpers/genaccounts.go rename to x/genutil/genaccounts.go index 9ff62f17150..8e92ab61e9a 100644 --- a/x/auth/helpers/genaccounts.go +++ b/x/genutil/genaccounts.go @@ -1,4 +1,4 @@ -package helpers +package genutil import ( "encoding/json" @@ -10,7 +10,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -137,5 +136,5 @@ func AddGenesisAccount( } appGenesis.AppState = appStateJSON - return genutil.ExportGenesisFile(appGenesis, genesisFileURL) + return ExportGenesisFile(appGenesis, genesisFileURL) }