refactor: remove dependencies x/auth -> x/genutil, x/gov (#16423)
This commit is contained in:
parent
bf6edae9b6
commit
e169374eb4
@ -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
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user