x/auth: remove alias.go usage (#6440)

* x/auth: remove alias.go usage

* Fix simd_test.go and formatting

* Fix app.go formatting

* Fix cli_test.go

* Fix lint warnings

* Undo accidental deletion during merge

Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
dauTT 2020-06-17 20:42:27 +02:00 committed by GitHub
parent eb3f7e6473
commit 32278d9a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 207 additions and 305 deletions

View File

@ -22,6 +22,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@ -105,13 +107,13 @@ var (
// module account permissions
maccPerms = map[string][]string{
auth.FeeCollectorName: nil,
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {auth.Minter},
stakingtypes.BondedPoolName: {auth.Burner, auth.Staking},
stakingtypes.NotBondedPoolName: {auth.Burner, auth.Staking},
govtypes.ModuleName: {auth.Burner},
ibctransfertypes.ModuleName: {auth.Minter, auth.Burner},
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
}
// module accounts that are allowed to receive tokens
@ -141,7 +143,7 @@ type SimApp struct {
subspaces map[string]paramstypes.Subspace
// keepers
AccountKeeper auth.AccountKeeper
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
@ -176,12 +178,12 @@ func NewSimApp(
// TODO: Remove cdc in favor of appCodec once all modules are migrated.
appCodec, cdc := MakeCodecs()
bApp := baseapp.NewBaseApp(appName, logger, db, auth.DefaultTxDecoder(cdc), baseAppOptions...)
bApp := baseapp.NewBaseApp(appName, logger, db, authtypes.DefaultTxDecoder(cdc), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetAppVersion(version.Version)
keys := sdk.NewKVStoreKeys(
auth.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
@ -202,7 +204,7 @@ func NewSimApp(
// init params keeper and subspaces
app.ParamsKeeper = paramskeeper.NewKeeper(appCodec, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
app.subspaces[auth.ModuleName] = app.ParamsKeeper.Subspace(auth.DefaultParamspace)
app.subspaces[authtypes.ModuleName] = app.ParamsKeeper.Subspace(authtypes.DefaultParamspace)
app.subspaces[banktypes.ModuleName] = app.ParamsKeeper.Subspace(banktypes.DefaultParamspace)
app.subspaces[stakingtypes.ModuleName] = app.ParamsKeeper.Subspace(stakingtypes.DefaultParamspace)
app.subspaces[minttypes.ModuleName] = app.ParamsKeeper.Subspace(minttypes.DefaultParamspace)
@ -220,8 +222,8 @@ func NewSimApp(
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
// add keepers
app.AccountKeeper = auth.NewAccountKeeper(
appCodec, keys[auth.StoreKey], app.subspaces[auth.ModuleName], auth.ProtoBaseAccount, maccPerms,
app.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec, keys[authtypes.StoreKey], app.subspaces[authtypes.ModuleName], authtypes.ProtoBaseAccount, maccPerms,
)
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.subspaces[banktypes.ModuleName], app.BlockedAddrs(),
@ -231,17 +233,17 @@ func NewSimApp(
)
app.MintKeeper = mintkeeper.NewKeeper(
appCodec, keys[minttypes.StoreKey], app.subspaces[minttypes.ModuleName], &stakingKeeper,
app.AccountKeeper, app.BankKeeper, auth.FeeCollectorName,
app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName,
)
app.DistrKeeper = distrkeeper.NewKeeper(
appCodec, keys[distrtypes.StoreKey], app.subspaces[distrtypes.ModuleName], app.AccountKeeper, app.BankKeeper,
&stakingKeeper, auth.FeeCollectorName, app.ModuleAccountAddrs(),
&stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(),
)
app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.subspaces[slashingtypes.ModuleName],
)
app.CrisisKeeper = crisiskeeper.NewKeeper(
app.subspaces[crisistypes.ModuleName], invCheckPeriod, app.BankKeeper, auth.FeeCollectorName,
app.subspaces[crisistypes.ModuleName], invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName,
)
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath)
@ -328,7 +330,7 @@ func NewSimApp(
// so that other modules that want to create or claim capabilities afterwards in InitChain
// can do so safely.
app.mm.SetOrderInitGenesis(
capabilitytypes.ModuleName, auth.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, banktypes.ModuleName,
capabilitytypes.ModuleName, authtypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, banktypes.ModuleName,
slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName,
ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, ibctransfertypes.ModuleName,
)
@ -437,7 +439,7 @@ func (app *SimApp) LoadHeight(height int64) error {
func (app *SimApp) ModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool)
for acc := range maccPerms {
modAccAddrs[auth.NewModuleAddress(acc).String()] = true
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
}
return modAccAddrs
@ -448,7 +450,7 @@ func (app *SimApp) ModuleAccountAddrs() map[string]bool {
func (app *SimApp) BlockedAddrs() map[string]bool {
blockedAddrs := make(map[string]bool)
for acc := range maccPerms {
blockedAddrs[auth.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc]
blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc]
}
return blockedAddrs

View File

@ -18,8 +18,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
@ -86,10 +85,11 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
}
// create concrete account type based on input parameters
var genAccount types.GenesisAccount
var genAccount authtypes.GenesisAccount
balances := banktypes.Balance{Address: addr, Coins: coins.Sort()}
baseAccount := auth.NewBaseAccount(addr, nil, 0, 0)
baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0)
if !vestingAmt.IsZero() {
baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
@ -122,7 +122,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
return fmt.Errorf("failed to unmarshal genesis state: %w", err)
}
authGenState := auth.GetGenesisStateFromAppState(cdc, appState)
authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState)
if authGenState.Accounts.Contains(addr) {
return fmt.Errorf("cannot add account at existing address %s", addr)
@ -131,14 +131,14 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
// Add the new account to the set of genesis accounts and sanitize the
// accounts afterwards.
authGenState.Accounts = append(authGenState.Accounts, genAccount)
authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts)
authGenState.Accounts = authtypes.SanitizeGenesisAccounts(authGenState.Accounts)
authGenStateBz, err := cdc.MarshalJSON(authGenState)
if err != nil {
return fmt.Errorf("failed to marshal auth genesis state: %w", err)
}
appState[auth.ModuleName] = authGenStateBz
appState[authtypes.ModuleName] = authGenStateBz
bankGenState := banktypes.GetGenesisStateFromAppState(depCdc, appState)
bankGenState.Balances = append(bankGenState.Balances, balances)

View File

@ -27,7 +27,6 @@ import (
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
@ -208,7 +207,7 @@ func InitTestnet(
}
genBalances = append(genBalances, banktypes.Balance{Address: addr, Coins: coins.Sort()})
genAccounts = append(genAccounts, auth.NewBaseAccount(addr, nil, 0, 0))
genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0))
valTokens := sdk.TokensFromConsensusPower(100)
msg := stakingtypes.NewMsgCreateValidator(
@ -220,8 +219,8 @@ func InitTestnet(
sdk.OneInt(),
)
tx := auth.NewStdTx([]sdk.Msg{msg}, auth.StdFee{}, []auth.StdSignature{}, memo)
txBldr := auth.NewTxBuilderFromCLI(inBuf).WithChainID(chainID).WithMemo(memo).WithKeybase(kb)
tx := authtypes.NewStdTx([]sdk.Msg{msg}, authtypes.StdFee{}, []authtypes.StdSignature{}, memo) //nolint:staticcheck // SA1019: authtypes.StdFee is deprecated
txBldr := authtypes.NewTxBuilderFromCLI(inBuf).WithChainID(chainID).WithMemo(memo).WithKeybase(kb)
signedTx, err := txBldr.SignStdTx(nodeDirName, tx, false)
if err != nil {
@ -269,11 +268,11 @@ func initGenFiles(
appGenState := mbm.DefaultGenesis(cdc)
// set the accounts in the genesis state
var authGenState auth.GenesisState
cdc.MustUnmarshalJSON(appGenState[auth.ModuleName], &authGenState)
var authGenState authtypes.GenesisState
cdc.MustUnmarshalJSON(appGenState[authtypes.ModuleName], &authGenState)
authGenState.Accounts = genAccounts
appGenState[auth.ModuleName] = cdc.MustMarshalJSON(authGenState)
appGenState[authtypes.ModuleName] = cdc.MustMarshalJSON(authGenState)
// set the balances in the genesis state
var bankGenState banktypes.GenesisState

View File

@ -4,7 +4,6 @@ import (
"errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
@ -36,7 +35,7 @@ func (sga SimGenesisAccount) Validate() error {
}
if sga.ModuleName != "" {
ma := auth.ModuleAccount{
ma := authtypes.ModuleAccount{
BaseAccount: sga.BaseAccount, Name: sga.ModuleName, Permissions: sga.ModulePermissions,
}
if err := ma.Validate(); err != nil {

View File

@ -8,7 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
// SimAppChainID hardcoded chainID for simulation
@ -18,13 +18,13 @@ const (
)
// GenTx generates a signed mock transaction.
func GenTx(msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx {
fee := auth.StdFee{
func GenTx(msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) authtypes.StdTx {
fee := authtypes.StdFee{ //nolint:staticcheck // SA1019: authtypes.StdFee is deprecated
Amount: feeAmt,
Gas: gas,
}
sigs := make([]auth.StdSignature, len(priv))
sigs := make([]authtypes.StdSignature, len(priv)) //nolint:staticcheck // SA1019: authtypes.StdSignature is deprecated
// create a random length memo
r := rand.New(rand.NewSource(time.Now().UnixNano()))
@ -33,16 +33,16 @@ func GenTx(msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accnums
for i, p := range priv {
// use a empty chainID for ease of testing
sig, err := p.Sign(auth.StdSignBytes(chainID, accnums[i], seq[i], fee, msgs, memo))
sig, err := p.Sign(authtypes.StdSignBytes(chainID, accnums[i], seq[i], fee, msgs, memo))
if err != nil {
panic(err)
}
sigs[i] = auth.StdSignature{
sigs[i] = authtypes.StdSignature{ //nolint:staticcheck // SA1019: authtypes.StdSignature is deprecated
PubKey: p.PubKey().Bytes(),
Signature: sig,
}
}
return auth.NewStdTx(msgs, fee, sigs, memo)
return authtypes.NewStdTx(msgs, fee, sigs, memo)
}

View File

@ -17,7 +17,7 @@ import (
"github.com/cosmos/cosmos-sdk/simapp/helpers"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
@ -148,7 +148,7 @@ func TestAppImportExport(t *testing.T) {
fmt.Printf("comparing stores...\n")
storeKeysPrefixes := []StoreKeysPrefixes{
{app.keys[auth.StoreKey], newApp.keys[auth.StoreKey], [][]byte{}},
{app.keys[authtypes.StoreKey], newApp.keys[authtypes.StoreKey], [][]byte{}},
{app.keys[stakingtypes.StoreKey], newApp.keys[stakingtypes.StoreKey],
[][]byte{
stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey,

View File

@ -15,7 +15,7 @@ import (
simapparams "github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
// AppStateFn returns the initial application state using a genesis or the simulation parameters.
@ -137,9 +137,9 @@ func AppStateFromGenesisFileFn(r io.Reader, cdc *codec.Codec, genesisFile string
var appState GenesisState
cdc.MustUnmarshalJSON(genesis.AppState, &appState)
var authGenesis auth.GenesisState
if appState[auth.ModuleName] != nil {
cdc.MustUnmarshalJSON(appState[auth.ModuleName], &authGenesis)
var authGenesis authtypes.GenesisState
if appState[authtypes.ModuleName] != nil {
cdc.MustUnmarshalJSON(appState[authtypes.ModuleName], &authGenesis)
}
newAccs := make([]simtypes.Account, len(authGenesis.Accounts))

View File

@ -19,7 +19,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)
@ -69,15 +69,15 @@ func Setup(isCheckTx bool) *SimApp {
// SetupWithGenesisAccounts initializes a new SimApp with the provided genesis
// accounts and possible balances.
func SetupWithGenesisAccounts(genAccs []auth.GenesisAccount, balances ...banktypes.Balance) *SimApp {
func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp {
db := dbm.NewMemDB()
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0)
// initialize the chain with the passed in genesis accounts
genesisState := NewDefaultGenesisState()
authGenesis := auth.NewGenesisState(auth.DefaultParams(), genAccs)
genesisState[auth.ModuleName] = app.Codec().MustMarshalJSON(authGenesis)
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
genesisState[authtypes.ModuleName] = app.Codec().MustMarshalJSON(authGenesis)
totalSupply := sdk.NewCoins()
for _, b := range balances {
@ -288,8 +288,8 @@ func SignCheckDeliver(
// GenSequenceOfTxs generates a set of signed transactions of messages, such
// that they differ only by having the sequence numbers incremented between
// every transaction.
func GenSequenceOfTxs(msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...crypto.PrivKey) []auth.StdTx {
txs := make([]auth.StdTx, numToGenerate)
func GenSequenceOfTxs(msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...crypto.PrivKey) []authtypes.StdTx {
txs := make([]authtypes.StdTx, numToGenerate)
for i := 0; i < numToGenerate; i++ {
txs[i] = helpers.GenTx(
msgs,

View File

@ -10,14 +10,14 @@ import (
tmkv "github.com/tendermint/tendermint/libs/kv"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
func TestGetSimulationLog(t *testing.T) {
cdc := std.MakeCodec(ModuleBasics)
decoders := make(sdk.StoreDecoderRegistry)
decoders[auth.StoreKey] = func(kvAs, kvBs tmkv.Pair) string { return "10" }
decoders[authtypes.StoreKey] = func(kvAs, kvBs tmkv.Pair) string { return "10" }
tests := []struct {
store string
@ -30,8 +30,8 @@ func TestGetSimulationLog(t *testing.T) {
"",
},
{
auth.StoreKey,
[]tmkv.Pair{{Key: auth.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryBare(uint64(10))}},
authtypes.StoreKey,
[]tmkv.Pair{{Key: authtypes.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryBare(uint64(10))}},
"10",
},
{

View File

@ -14,7 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/tests"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
var (
@ -191,7 +191,7 @@ func AddFlags(cmd string, flags []string) string {
return strings.TrimSpace(cmd)
}
func UnmarshalStdTx(t require.TestingT, c *codec.Codec, s string) (stdTx auth.StdTx) {
func UnmarshalStdTx(t require.TestingT, c *codec.Codec, s string) (stdTx authtypes.StdTx) {
require.Nil(t, c.UnmarshalJSON([]byte(s), &stdTx))
return
}
@ -200,7 +200,7 @@ func buildEventsQueryString(events []string) string {
return strings.Join(events, "&")
}
func MarshalStdTx(t require.TestingT, c *codec.Codec, stdTx auth.StdTx) []byte {
func MarshalStdTx(t require.TestingT, c *codec.Codec, stdTx authtypes.StdTx) []byte {
bz, err := c.MarshalBinaryBare(stdTx)
require.NoError(t, err)

View File

@ -15,7 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/tests/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)
@ -102,7 +102,7 @@ func TestCLISimdAddGenesisAccount(t *testing.T) {
interfaceRegistry := codectypes.NewInterfaceRegistry()
appCodec := std.NewAppCodec(f.Cdc, interfaceRegistry)
accounts := auth.GetGenesisStateFromAppState(appCodec, genesisState).Accounts
accounts := authtypes.GetGenesisStateFromAppState(appCodec, genesisState).Accounts
balances := banktypes.GetGenesisStateFromAppState(f.Cdc, genesisState).Balances
balancesSet := make(map[string]sdk.Coins)

View File

@ -1,99 +0,0 @@
package auth
import (
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
// DONTCOVER
// nolint
const (
ModuleName = types.ModuleName
StoreKey = types.StoreKey
FeeCollectorName = types.FeeCollectorName
QuerierRoute = types.QuerierRoute
DefaultParamspace = types.DefaultParamspace
DefaultMaxMemoCharacters = types.DefaultMaxMemoCharacters
DefaultTxSigLimit = types.DefaultTxSigLimit
DefaultTxSizeCostPerByte = types.DefaultTxSizeCostPerByte
DefaultSigVerifyCostED25519 = types.DefaultSigVerifyCostED25519
DefaultSigVerifyCostSecp256k1 = types.DefaultSigVerifyCostSecp256k1
QueryAccount = types.QueryAccount
QueryParams = types.QueryParams
MaxGasWanted = types.MaxGasWanted
Minter = types.Minter
Burner = types.Burner
Staking = types.Staking
)
var (
// functions aliases
NewAnteHandler = ante.NewAnteHandler
GetSignerAcc = ante.GetSignerAcc
DefaultSigVerificationGasConsumer = ante.DefaultSigVerificationGasConsumer
DeductFees = ante.DeductFees
SetGasMeter = ante.SetGasMeter
NewAccountKeeper = keeper.NewAccountKeeper
NewQuerier = keeper.NewQuerier
NewBaseAccount = types.NewBaseAccount
ProtoBaseAccount = types.ProtoBaseAccount
NewBaseAccountWithAddress = types.NewBaseAccountWithAddress
NewAccountRetriever = types.NewAccountRetriever
RegisterCodec = types.RegisterCodec
NewGenesisState = types.NewGenesisState
DefaultGenesisState = types.DefaultGenesisState
ValidateGenesis = types.ValidateGenesis
SanitizeGenesisAccounts = types.SanitizeGenesisAccounts
AddressStoreKey = types.AddressStoreKey
NewParams = types.NewParams
ParamKeyTable = types.ParamKeyTable
DefaultParams = types.DefaultParams
NewQueryAccountParams = types.NewQueryAccountParams
NewStdTx = types.NewStdTx
CountSubKeys = types.CountSubKeys
NewStdFee = types.NewStdFee //nolint:staticcheck // this will be removed when proto is ready
StdSignBytes = types.StdSignBytes
DefaultTxDecoder = types.DefaultTxDecoder
DefaultTxEncoder = types.DefaultTxEncoder
NewTxBuilder = types.NewTxBuilder
NewTxBuilderFromCLI = types.NewTxBuilderFromCLI
MakeSignature = types.MakeSignature
ValidateGenAccounts = types.ValidateGenAccounts
GetGenesisStateFromAppState = types.GetGenesisStateFromAppState
NewStdSignature = types.NewStdSignature
NewModuleAddress = types.NewModuleAddress
NewEmptyModuleAccount = types.NewEmptyModuleAccount
NewModuleAccount = types.NewModuleAccount
// variable aliases
AddressStoreKeyPrefix = types.AddressStoreKeyPrefix
GlobalAccountNumberKey = types.GlobalAccountNumberKey
KeyMaxMemoCharacters = types.KeyMaxMemoCharacters
KeyTxSigLimit = types.KeyTxSigLimit
KeyTxSizeCostPerByte = types.KeyTxSizeCostPerByte
KeySigVerifyCostED25519 = types.KeySigVerifyCostED25519
KeySigVerifyCostSecp256k1 = types.KeySigVerifyCostSecp256k1
)
type (
AccountI = types.AccountI
SignatureVerificationGasConsumer = ante.SignatureVerificationGasConsumer
AccountKeeper = keeper.AccountKeeper
BaseAccount = types.BaseAccount
AccountRetriever = types.AccountRetriever
GenesisState = types.GenesisState
Params = types.Params
QueryAccountParams = types.QueryAccountParams
StdSignMsg = types.StdSignMsg
StdTx = types.StdTx
StdFee = types.StdFee //nolint:staticcheck // this will be removed when proto is ready
StdSignDoc = types.StdSignDoc
StdSignature = types.StdSignature //nolint:staticcheck // this will be removed when proto is ready
TxBuilder = types.TxBuilder
GenesisAccountIterator = types.GenesisAccountIterator
ModuleAccount = types.ModuleAccount
GenesisAccounts = types.GenesisAccounts
GenesisAccount = types.GenesisAccount
)

View File

@ -14,8 +14,8 @@ import (
"github.com/cosmos/cosmos-sdk/tests"
"github.com/cosmos/cosmos-sdk/tests/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/client/testutil"
"github.com/cosmos/cosmos-sdk/x/auth/types"
bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/testutil"
)
@ -308,7 +308,7 @@ func TestCLIEncode(t *testing.T) {
require.Nil(t, err)
// Check that the transaction decodes as epxceted
var decodedTx auth.StdTx
var decodedTx types.StdTx
require.Nil(t, f.Cdc.UnmarshalBinaryBare(decodedBytes, &decodedTx))
require.Equal(t, "deadbeef", decodedTx.Memo)
}

View File

@ -2,6 +2,7 @@ package auth
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
@ -9,20 +10,20 @@ import (
//
// CONTRACT: old coins from the FeeCollectionKeeper need to be transferred through
// a genesis port script to the new fee collector account
func InitGenesis(ctx sdk.Context, ak AccountKeeper, data GenesisState) {
func InitGenesis(ctx sdk.Context, ak keeper.AccountKeeper, data types.GenesisState) {
ak.SetParams(ctx, data.Params)
data.Accounts = SanitizeGenesisAccounts(data.Accounts)
data.Accounts = types.SanitizeGenesisAccounts(data.Accounts)
for _, a := range data.Accounts {
acc := ak.NewAccount(ctx, a)
ak.SetAccount(ctx, acc)
}
ak.GetModuleAccount(ctx, FeeCollectorName)
ak.GetModuleAccount(ctx, types.FeeCollectorName)
}
// ExportGenesis returns a GenesisState for a given context and keeper
func ExportGenesis(ctx sdk.Context, ak AccountKeeper) GenesisState {
func ExportGenesis(ctx sdk.Context, ak keeper.AccountKeeper) types.GenesisState {
params := ak.GetParams(ctx)
var genAccounts types.GenesisAccounts
@ -32,5 +33,5 @@ func ExportGenesis(ctx sdk.Context, ak AccountKeeper) GenesisState {
return false
})
return NewGenesisState(params, genAccounts)
return types.NewGenesisState(params, genAccounts)
}

View File

@ -9,7 +9,7 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
@ -20,8 +20,8 @@ const (
)
var (
multiPermAcc = auth.NewEmptyModuleAccount(multiPerm, auth.Burner, auth.Minter, auth.Staking)
randomPermAcc = auth.NewEmptyModuleAccount(randomPerm, "random")
multiPermAcc = types.NewEmptyModuleAccount(multiPerm, types.Burner, types.Minter, types.Staking)
randomPermAcc = types.NewEmptyModuleAccount(randomPerm, "random")
)
func TestAccountMapperGetSet(t *testing.T) {
@ -104,12 +104,12 @@ func TestSupply_ValidatePermissions(t *testing.T) {
maccPerms := simapp.GetMaccPerms()
maccPerms[holder] = nil
maccPerms[types.Burner] = []string{types.Burner}
maccPerms[auth.Minter] = []string{types.Minter}
maccPerms[types.Minter] = []string{types.Minter}
maccPerms[multiPerm] = []string{types.Burner, types.Minter, types.Staking}
maccPerms[randomPerm] = []string{"random"}
appCodec := std.NewAppCodec(app.Codec(), codectypes.NewInterfaceRegistry())
keeper := auth.NewAccountKeeper(
keeper := keeper.NewAccountKeeper(
appCodec, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName),
types.ProtoBaseAccount, maccPerms,
)

View File

@ -13,14 +13,15 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/auth/client/rest"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
var (
@ -35,33 +36,33 @@ type AppModuleBasic struct{}
// Name returns the auth module's name.
func (AppModuleBasic) Name() string {
return authtypes.ModuleName
return types.ModuleName
}
// RegisterCodec registers the auth module's types for the given codec.
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {
authtypes.RegisterCodec(cdc)
types.RegisterCodec(cdc)
}
// DefaultGenesis returns default genesis state as raw bytes for the auth
// module.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage {
return cdc.MustMarshalJSON(authtypes.DefaultGenesisState())
return cdc.MustMarshalJSON(types.DefaultGenesisState())
}
// ValidateGenesis performs genesis state validation for the auth module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessage) error {
var data authtypes.GenesisState
var data types.GenesisState
if err := cdc.UnmarshalJSON(bz, &data); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", authtypes.ModuleName, err)
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return authtypes.ValidateGenesis(data)
return types.ValidateGenesis(data)
}
// RegisterRESTRoutes registers the REST routes for the auth module.
func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {
rest.RegisterRoutes(clientCtx, rtr, authtypes.StoreKey)
rest.RegisterRoutes(clientCtx, rtr, types.StoreKey)
}
// GetTxCmd returns the root tx command for the auth module.
@ -75,8 +76,8 @@ func (AppModuleBasic) GetQueryCmd(clientCtx client.Context) *cobra.Command {
}
// RegisterInterfaceTypes registers interfaces and implementations of the auth module.
func (AppModuleBasic) RegisterInterfaceTypes(registry types.InterfaceRegistry) {
authtypes.RegisterInterfaces(registry)
func (AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) {
types.RegisterInterfaces(registry)
}
//____________________________________________________________________________
@ -85,11 +86,11 @@ func (AppModuleBasic) RegisterInterfaceTypes(registry types.InterfaceRegistry) {
type AppModule struct {
AppModuleBasic
accountKeeper AccountKeeper
accountKeeper keeper.AccountKeeper
}
// NewAppModule creates a new AppModule object
func NewAppModule(cdc codec.Marshaler, accountKeeper AccountKeeper) AppModule {
func NewAppModule(cdc codec.Marshaler, accountKeeper keeper.AccountKeeper) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
accountKeeper: accountKeeper,
@ -98,7 +99,7 @@ func NewAppModule(cdc codec.Marshaler, accountKeeper AccountKeeper) AppModule {
// Name returns the auth module's name.
func (AppModule) Name() string {
return authtypes.ModuleName
return types.ModuleName
}
// RegisterInvariants performs a no-op.
@ -109,12 +110,12 @@ func (AppModule) Route() sdk.Route { return sdk.Route{} }
// QuerierRoute returns the auth module's querier route name.
func (AppModule) QuerierRoute() string {
return authtypes.QuerierRoute
return types.QuerierRoute
}
// NewQuerierHandler returns the auth module sdk.Querier.
func (am AppModule) NewQuerierHandler() sdk.Querier {
return NewQuerier(am.accountKeeper)
return keeper.NewQuerier(am.accountKeeper)
}
func (am AppModule) RegisterQueryService(grpc.Server) {}
@ -122,7 +123,7 @@ func (am AppModule) RegisterQueryService(grpc.Server) {}
// InitGenesis performs genesis initialization for the auth module. It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
var genesisState GenesisState
var genesisState types.GenesisState
cdc.MustUnmarshalJSON(data, &genesisState)
InitGenesis(ctx, am.accountKeeper, genesisState)
return []abci.ValidatorUpdate{}
@ -165,7 +166,7 @@ func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
// RegisterStoreDecoder registers a decoder for auth module's types
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
sdr[StoreKey] = simulation.NewDecodeStore(am.accountKeeper)
sdr[types.StoreKey] = simulation.NewDecodeStore(am.accountKeeper)
}
// WeightedOperations doesn't return any auth module operation.

View File

@ -4,23 +4,23 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/abci/types"
abcitypes "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, types.Header{})
ctx := app.BaseApp.NewContext(false, abcitypes.Header{})
app.InitChain(
types.RequestInitChain{
abcitypes.RequestInitChain{
AppStateBytes: []byte("{}"),
ChainId: "test-chain-id",
},
)
acc := app.AccountKeeper.GetAccount(ctx, auth.NewModuleAddress(auth.FeeCollectorName))
acc := app.AccountKeeper.GetAccount(ctx, types.NewModuleAddress(types.FeeCollectorName))
require.NotNil(t, acc)
}

View File

@ -3,6 +3,7 @@ package types_test
import (
"testing"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/stretchr/testify/require"
@ -11,8 +12,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)
@ -24,7 +23,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
coins := sdk.Coins{sdk.NewInt64Coin("foocoin", 10)}
fee := auth.StdFee{
fee := types.StdFee{
Amount: coins,
Gas: 10000,
}
@ -37,7 +36,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
},
}
tx := auth.StdTx{
tx := types.StdTx{
Msgs: msgs,
Fee: fee,
Signatures: nil,
@ -59,7 +58,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
signBz, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signingData, tx)
require.NoError(t, err)
expectedSignBz := auth.StdSignBytes(chainId, accNum, seqNum, fee, msgs, memo)
expectedSignBz := types.StdSignBytes(chainId, accNum, seqNum, fee, msgs, memo)
require.Equal(t, expectedSignBz, signBz)

View File

@ -13,7 +13,6 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/bank/types"
)
@ -89,7 +88,7 @@ var (
)
func TestSendNotEnoughBalance(t *testing.T) {
acc := &auth.BaseAccount{
acc := &authtypes.BaseAccount{
Address: addr1,
}
@ -104,7 +103,7 @@ func TestSendNotEnoughBalance(t *testing.T) {
res1 := app.AccountKeeper.GetAccount(ctx, addr1)
require.NotNil(t, res1)
require.Equal(t, acc, res1.(*auth.BaseAccount))
require.Equal(t, acc, res1.(*authtypes.BaseAccount))
origAccNum := res1.GetAccountNumber()
origSeq := res1.GetSequence()
@ -146,7 +145,7 @@ func TestSendToModuleAcc(t *testing.T) {
{
name: "Allowed module account can be the recipient of bank sends",
fromBalance: coins,
msg: types.NewMsgSend(addr1, auth.NewModuleAddress(distrtypes.ModuleName), coins),
msg: types.NewMsgSend(addr1, authtypes.NewModuleAddress(distrtypes.ModuleName), coins),
expPass: true,
expSimPass: true,
expFromBalance: sdk.NewCoins(),
@ -157,7 +156,7 @@ func TestSendToModuleAcc(t *testing.T) {
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
acc := &auth.BaseAccount{
acc := &authtypes.BaseAccount{
Address: test.msg.FromAddress,
}
@ -172,7 +171,7 @@ func TestSendToModuleAcc(t *testing.T) {
res1 := app.AccountKeeper.GetAccount(ctx, test.msg.FromAddress)
require.NotNil(t, res1)
require.Equal(t, acc, res1.(*auth.BaseAccount))
require.Equal(t, acc, res1.(*authtypes.BaseAccount))
origAccNum := res1.GetAccountNumber()
origSeq := res1.GetSequence()
@ -198,7 +197,7 @@ func TestSendToModuleAcc(t *testing.T) {
}
func TestMsgMultiSendWithAccounts(t *testing.T) {
acc := &auth.BaseAccount{
acc := &authtypes.BaseAccount{
Address: addr1,
}
@ -213,7 +212,7 @@ func TestMsgMultiSendWithAccounts(t *testing.T) {
res1 := app.AccountKeeper.GetAccount(ctx, addr1)
require.NotNil(t, res1)
require.Equal(t, acc, res1.(*auth.BaseAccount))
require.Equal(t, acc, res1.(*authtypes.BaseAccount))
testCases := []appTestCase{
{
@ -262,10 +261,10 @@ func TestMsgMultiSendWithAccounts(t *testing.T) {
}
func TestMsgMultiSendMultipleOut(t *testing.T) {
acc1 := &auth.BaseAccount{
acc1 := &authtypes.BaseAccount{
Address: addr1,
}
acc2 := &auth.BaseAccount{
acc2 := &authtypes.BaseAccount{
Address: addr2,
}
@ -309,13 +308,13 @@ func TestMsgMultiSendMultipleOut(t *testing.T) {
}
func TestMsgMultiSendMultipleInOut(t *testing.T) {
acc1 := &auth.BaseAccount{
acc1 := &authtypes.BaseAccount{
Address: addr1,
}
acc2 := &auth.BaseAccount{
acc2 := &authtypes.BaseAccount{
Address: addr2,
}
acc4 := &auth.BaseAccount{
acc4 := &authtypes.BaseAccount{
Address: addr4,
}
@ -363,8 +362,8 @@ func TestMsgMultiSendMultipleInOut(t *testing.T) {
}
func TestMsgMultiSendDependent(t *testing.T) {
acc1 := auth.NewBaseAccountWithAddress(addr1)
acc2 := auth.NewBaseAccountWithAddress(addr2)
acc1 := authtypes.NewBaseAccountWithAddress(addr1)
acc2 := authtypes.NewBaseAccountWithAddress(addr2)
err := acc2.SetAccountNumber(1)
require.NoError(t, err)

View File

@ -8,16 +8,16 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)
var moduleAccAddr = auth.NewModuleAddress(stakingtypes.BondedPoolName)
var moduleAccAddr = authtypes.NewModuleAddress(stakingtypes.BondedPoolName)
func BenchmarkOneBankSendTxPerBlock(b *testing.B) {
// Add an account at genesis
acc := auth.BaseAccount{
acc := authtypes.BaseAccount{
Address: addr1,
}
@ -57,12 +57,12 @@ func BenchmarkOneBankSendTxPerBlock(b *testing.B) {
func BenchmarkOneBankMultiSendTxPerBlock(b *testing.B) {
// Add an account at genesis
acc := auth.BaseAccount{
acc := authtypes.BaseAccount{
Address: addr1,
}
// Construct genesis state
genAccs := []types.GenesisAccount{&acc}
genAccs := []authtypes.GenesisAccount{&acc}
benchmarkApp := simapp.SetupWithGenesisAccounts(genAccs)
ctx := benchmarkApp.BaseApp.NewContext(false, abci.Header{})

View File

@ -10,7 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/tests"
"github.com/cosmos/cosmos-sdk/tests/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
// TxSend is simcli tx send
@ -21,7 +21,7 @@ func TxSend(f *cli.Fixtures, from string, to sdk.AccAddress, amount sdk.Coin, fl
}
// QueryAccount is simcli query account
func QueryAccount(f *cli.Fixtures, address sdk.AccAddress, flags ...string) auth.BaseAccount {
func QueryAccount(f *cli.Fixtures, address sdk.AccAddress, flags ...string) authtypes.BaseAccount {
cmd := fmt.Sprintf("%s query account %s %v", f.SimcliBinary, address, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
@ -31,7 +31,7 @@ func QueryAccount(f *cli.Fixtures, address sdk.AccAddress, flags ...string) auth
require.NoError(f.T, err, "out %v, err %v", out, err)
value := initRes["value"]
var acc auth.BaseAccount
var acc authtypes.BaseAccount
err = f.Cdc.UnmarshalJSON(value, &acc)
require.NoError(f.T, err, "value %v, err %v", string(value), err)

View File

@ -10,7 +10,7 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
"github.com/cosmos/cosmos-sdk/x/bank/exported"
"github.com/cosmos/cosmos-sdk/x/bank/types"
@ -236,7 +236,7 @@ func (k BaseKeeper) DelegateCoinsFromAccountToModule(
panic(sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule))
}
if !recipientAcc.HasPermission(auth.Staking) {
if !recipientAcc.HasPermission(authtypes.Staking) {
panic(sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to receive delegated coins", recipientModule))
}
@ -255,7 +255,7 @@ func (k BaseKeeper) UndelegateCoinsFromModuleToAccount(
panic(sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule))
}
if !acc.HasPermission(auth.Staking) {
if !acc.HasPermission(authtypes.Staking) {
panic(sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to undelegate coins", senderModule))
}
@ -270,7 +270,7 @@ func (k BaseKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins)
panic(sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName))
}
if !acc.HasPermission(auth.Minter) {
if !acc.HasPermission(authtypes.Minter) {
panic(sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to mint tokens", moduleName))
}
@ -299,7 +299,7 @@ func (k BaseKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins)
panic(sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName))
}
if !acc.HasPermission(auth.Burner) {
if !acc.HasPermission(authtypes.Burner) {
panic(sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to burn tokens", moduleName))
}

View File

@ -11,7 +11,8 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
"github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/bank/types"
@ -27,11 +28,11 @@ const (
)
var (
holderAcc = auth.NewEmptyModuleAccount(holder)
burnerAcc = auth.NewEmptyModuleAccount(auth.Burner, auth.Burner)
minterAcc = auth.NewEmptyModuleAccount(auth.Minter, auth.Minter)
multiPermAcc = auth.NewEmptyModuleAccount(multiPerm, auth.Burner, auth.Minter, auth.Staking)
randomPermAcc = auth.NewEmptyModuleAccount(randomPerm, "random")
holderAcc = authtypes.NewEmptyModuleAccount(holder)
burnerAcc = authtypes.NewEmptyModuleAccount(authtypes.Burner, authtypes.Burner)
minterAcc = authtypes.NewEmptyModuleAccount(authtypes.Minter, authtypes.Minter)
multiPermAcc = authtypes.NewEmptyModuleAccount(multiPerm, authtypes.Burner, authtypes.Minter, authtypes.Staking)
randomPermAcc = authtypes.NewEmptyModuleAccount(randomPerm, "random")
initTokens = sdk.TokensFromConsensusPower(initialPower)
initCoins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, initTokens))
@ -67,7 +68,7 @@ func (suite *IntegrationTestSuite) SetupTest() {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, abci.Header{})
app.AccountKeeper.SetParams(ctx, auth.DefaultParams())
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
app.BankKeeper.SetSendEnabled(ctx, true)
suite.app = app
@ -95,21 +96,21 @@ func (suite *IntegrationTestSuite) TestSupply_SendCoins() {
// add module accounts to supply keeper
maccPerms := simapp.GetMaccPerms()
maccPerms[holder] = nil
maccPerms[auth.Burner] = []string{auth.Burner}
maccPerms[auth.Minter] = []string{auth.Minter}
maccPerms[multiPerm] = []string{auth.Burner, auth.Minter, auth.Staking}
maccPerms[authtypes.Burner] = []string{authtypes.Burner}
maccPerms[authtypes.Minter] = []string{authtypes.Minter}
maccPerms[multiPerm] = []string{authtypes.Burner, authtypes.Minter, authtypes.Staking}
maccPerms[randomPerm] = []string{"random"}
authKeeper := auth.NewAccountKeeper(
authKeeper := authkeeper.NewAccountKeeper(
appCodec, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName),
auth.ProtoBaseAccount, maccPerms,
authtypes.ProtoBaseAccount, maccPerms,
)
keeper := keeper.NewBaseKeeper(
appCodec, app.GetKey(types.StoreKey), authKeeper,
app.GetSubspace(types.ModuleName), make(map[string]bool),
)
baseAcc := authKeeper.NewAccountWithAddress(ctx, auth.NewModuleAddress("baseAcc"))
baseAcc := authKeeper.NewAccountWithAddress(ctx, authtypes.NewModuleAddress("baseAcc"))
suite.Require().NoError(keeper.SetBalances(ctx, holderAcc.GetAddress(), initCoins))
keeper.SetSupply(ctx, types.NewSupply(initCoins))
@ -122,7 +123,7 @@ func (suite *IntegrationTestSuite) TestSupply_SendCoins() {
})
suite.Require().Panics(func() {
keeper.SendCoinsFromModuleToModule(ctx, auth.Burner, "", initCoins) // nolint:errcheck
keeper.SendCoinsFromModuleToModule(ctx, authtypes.Burner, "", initCoins) // nolint:errcheck
})
suite.Require().Panics(func() {
@ -134,20 +135,20 @@ func (suite *IntegrationTestSuite) TestSupply_SendCoins() {
)
suite.Require().NoError(
keeper.SendCoinsFromModuleToModule(ctx, holderAcc.GetName(), auth.Burner, initCoins),
keeper.SendCoinsFromModuleToModule(ctx, holderAcc.GetName(), authtypes.Burner, initCoins),
)
suite.Require().Equal(sdk.Coins(nil), getCoinsByName(ctx, keeper, authKeeper, holderAcc.GetName()))
suite.Require().Equal(initCoins, getCoinsByName(ctx, keeper, authKeeper, auth.Burner))
suite.Require().Equal(initCoins, getCoinsByName(ctx, keeper, authKeeper, authtypes.Burner))
suite.Require().NoError(
keeper.SendCoinsFromModuleToAccount(ctx, auth.Burner, baseAcc.GetAddress(), initCoins),
keeper.SendCoinsFromModuleToAccount(ctx, authtypes.Burner, baseAcc.GetAddress(), initCoins),
)
suite.Require().Equal(sdk.Coins(nil), getCoinsByName(ctx, keeper, authKeeper, auth.Burner))
suite.Require().Equal(sdk.Coins(nil), getCoinsByName(ctx, keeper, authKeeper, authtypes.Burner))
suite.Require().Equal(initCoins, keeper.GetAllBalances(ctx, baseAcc.GetAddress()))
suite.Require().NoError(keeper.SendCoinsFromAccountToModule(ctx, baseAcc.GetAddress(), auth.Burner, initCoins))
suite.Require().NoError(keeper.SendCoinsFromAccountToModule(ctx, baseAcc.GetAddress(), authtypes.Burner, initCoins))
suite.Require().Equal(sdk.Coins(nil), keeper.GetAllBalances(ctx, baseAcc.GetAddress()))
suite.Require().Equal(initCoins, getCoinsByName(ctx, keeper, authKeeper, auth.Burner))
suite.Require().Equal(initCoins, getCoinsByName(ctx, keeper, authKeeper, authtypes.Burner))
}
func (suite *IntegrationTestSuite) TestSupply_MintCoins() {
@ -158,14 +159,14 @@ func (suite *IntegrationTestSuite) TestSupply_MintCoins() {
// add module accounts to supply keeper
maccPerms := simapp.GetMaccPerms()
maccPerms[holder] = nil
maccPerms[auth.Burner] = []string{auth.Burner}
maccPerms[auth.Minter] = []string{auth.Minter}
maccPerms[multiPerm] = []string{auth.Burner, auth.Minter, auth.Staking}
maccPerms[authtypes.Burner] = []string{authtypes.Burner}
maccPerms[authtypes.Minter] = []string{authtypes.Minter}
maccPerms[multiPerm] = []string{authtypes.Burner, authtypes.Minter, authtypes.Staking}
maccPerms[randomPerm] = []string{"random"}
authKeeper := auth.NewAccountKeeper(
authKeeper := authkeeper.NewAccountKeeper(
appCodec, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName),
auth.ProtoBaseAccount, maccPerms,
authtypes.ProtoBaseAccount, maccPerms,
)
keeper := keeper.NewBaseKeeper(
appCodec, app.GetKey(types.StoreKey), authKeeper,
@ -179,18 +180,18 @@ func (suite *IntegrationTestSuite) TestSupply_MintCoins() {
initialSupply := keeper.GetSupply(ctx)
suite.Require().Panics(func() { keeper.MintCoins(ctx, "", initCoins) }, "no module account") // nolint:errcheck
suite.Require().Panics(func() { keeper.MintCoins(ctx, auth.Burner, initCoins) }, "invalid permission") // nolint:errcheck
suite.Require().Panics(func() { keeper.MintCoins(ctx, "", initCoins) }, "no module account") // nolint:errcheck
suite.Require().Panics(func() { keeper.MintCoins(ctx, authtypes.Burner, initCoins) }, "invalid permission") // nolint:errcheck
err := keeper.MintCoins(ctx, auth.Minter, sdk.Coins{sdk.Coin{Denom: "denom", Amount: sdk.NewInt(-10)}})
err := keeper.MintCoins(ctx, authtypes.Minter, sdk.Coins{sdk.Coin{Denom: "denom", Amount: sdk.NewInt(-10)}})
suite.Require().Error(err, "insufficient coins")
suite.Require().Panics(func() { keeper.MintCoins(ctx, randomPerm, initCoins) }) // nolint:errcheck
err = keeper.MintCoins(ctx, auth.Minter, initCoins)
err = keeper.MintCoins(ctx, authtypes.Minter, initCoins)
suite.Require().NoError(err)
suite.Require().Equal(initCoins, getCoinsByName(ctx, keeper, authKeeper, auth.Minter))
suite.Require().Equal(initCoins, getCoinsByName(ctx, keeper, authKeeper, authtypes.Minter))
suite.Require().Equal(initialSupply.GetTotal().Add(initCoins...), keeper.GetSupply(ctx).GetTotal())
// test same functionality on module account with multiple permissions
@ -201,7 +202,7 @@ func (suite *IntegrationTestSuite) TestSupply_MintCoins() {
suite.Require().Equal(initCoins, getCoinsByName(ctx, keeper, authKeeper, multiPermAcc.GetName()))
suite.Require().Equal(initialSupply.GetTotal().Add(initCoins...), keeper.GetSupply(ctx).GetTotal())
suite.Require().Panics(func() { keeper.MintCoins(ctx, auth.Burner, initCoins) }) // nolint:errcheck
suite.Require().Panics(func() { keeper.MintCoins(ctx, authtypes.Burner, initCoins) }) // nolint:errcheck
}
func (suite *IntegrationTestSuite) TestSupply_BurnCoins() {
@ -212,14 +213,14 @@ func (suite *IntegrationTestSuite) TestSupply_BurnCoins() {
// add module accounts to supply keeper
maccPerms := simapp.GetMaccPerms()
maccPerms[holder] = nil
maccPerms[auth.Burner] = []string{auth.Burner}
maccPerms[auth.Minter] = []string{auth.Minter}
maccPerms[multiPerm] = []string{auth.Burner, auth.Minter, auth.Staking}
maccPerms[authtypes.Burner] = []string{authtypes.Burner}
maccPerms[authtypes.Minter] = []string{authtypes.Minter}
maccPerms[multiPerm] = []string{authtypes.Burner, authtypes.Minter, authtypes.Staking}
maccPerms[randomPerm] = []string{"random"}
authKeeper := auth.NewAccountKeeper(
authKeeper := authkeeper.NewAccountKeeper(
appCodec, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName),
auth.ProtoBaseAccount, maccPerms,
authtypes.ProtoBaseAccount, maccPerms,
)
keeper := keeper.NewBaseKeeper(
appCodec, app.GetKey(types.StoreKey), authKeeper,
@ -235,14 +236,14 @@ func (suite *IntegrationTestSuite) TestSupply_BurnCoins() {
keeper.SetSupply(ctx, initialSupply)
suite.Require().Panics(func() { keeper.BurnCoins(ctx, "", initCoins) }, "no module account") // nolint:errcheck
suite.Require().Panics(func() { keeper.BurnCoins(ctx, auth.Minter, initCoins) }, "invalid permission") // nolint:errcheck
suite.Require().Panics(func() { keeper.BurnCoins(ctx, authtypes.Minter, initCoins) }, "invalid permission") // nolint:errcheck
suite.Require().Panics(func() { keeper.BurnCoins(ctx, randomPerm, initialSupply.GetTotal()) }, "random permission") // nolint:errcheck
err := keeper.BurnCoins(ctx, auth.Burner, initialSupply.GetTotal())
err := keeper.BurnCoins(ctx, authtypes.Burner, initialSupply.GetTotal())
suite.Require().Error(err, "insufficient coins")
err = keeper.BurnCoins(ctx, auth.Burner, initCoins)
err = keeper.BurnCoins(ctx, authtypes.Burner, initCoins)
suite.Require().NoError(err)
suite.Require().Equal(sdk.Coins(nil), getCoinsByName(ctx, keeper, authKeeper, auth.Burner))
suite.Require().Equal(sdk.Coins(nil), getCoinsByName(ctx, keeper, authKeeper, authtypes.Burner))
suite.Require().Equal(initialSupply.GetTotal().Sub(initCoins), keeper.GetSupply(ctx).GetTotal())
// test same functionality on module account with multiple permissions
@ -414,7 +415,7 @@ func (suite *IntegrationTestSuite) TestValidateBalance() {
suite.Require().NoError(app.BankKeeper.SetBalances(ctx, addr1, balances))
suite.Require().NoError(app.BankKeeper.ValidateBalance(ctx, addr1))
bacc := auth.NewBaseAccountWithAddress(addr2)
bacc := authtypes.NewBaseAccountWithAddress(addr2)
vacc := vesting.NewContinuousVestingAccount(bacc, balances.Add(balances...), now.Unix(), endTime.Unix())
app.AccountKeeper.SetAccount(ctx, vacc)
@ -635,7 +636,7 @@ func (suite *IntegrationTestSuite) TestSpendableCoins() {
addrModule := sdk.AccAddress([]byte("moduleAcc"))
macc := app.AccountKeeper.NewAccountWithAddress(ctx, addrModule)
bacc := auth.NewBaseAccountWithAddress(addr1)
bacc := authtypes.NewBaseAccountWithAddress(addr1)
vacc := vesting.NewContinuousVestingAccount(bacc, origCoins, ctx.BlockHeader().Time.Unix(), endTime.Unix())
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr2)
@ -664,7 +665,7 @@ func (suite *IntegrationTestSuite) TestVestingAccountSend() {
addr1 := sdk.AccAddress([]byte("addr1"))
addr2 := sdk.AccAddress([]byte("addr2"))
bacc := auth.NewBaseAccountWithAddress(addr1)
bacc := authtypes.NewBaseAccountWithAddress(addr1)
vacc := vesting.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix())
app.AccountKeeper.SetAccount(ctx, vacc)
@ -697,7 +698,7 @@ func (suite *IntegrationTestSuite) TestPeriodicVestingAccountSend() {
vesting.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin("stake", 25)}},
}
bacc := auth.NewBaseAccountWithAddress(addr1)
bacc := authtypes.NewBaseAccountWithAddress(addr1)
vacc := vesting.NewPeriodicVestingAccount(bacc, origCoins, ctx.BlockHeader().Time.Unix(), periods)
app.AccountKeeper.SetAccount(ctx, vacc)
@ -727,7 +728,7 @@ func (suite *IntegrationTestSuite) TestVestingAccountReceive() {
addr1 := sdk.AccAddress([]byte("addr1"))
addr2 := sdk.AccAddress([]byte("addr2"))
bacc := auth.NewBaseAccountWithAddress(addr1)
bacc := authtypes.NewBaseAccountWithAddress(addr1)
vacc := vesting.NewContinuousVestingAccount(bacc, origCoins, ctx.BlockHeader().Time.Unix(), endTime.Unix())
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr2)
@ -760,7 +761,7 @@ func (suite *IntegrationTestSuite) TestPeriodicVestingAccountReceive() {
addr1 := sdk.AccAddress([]byte("addr1"))
addr2 := sdk.AccAddress([]byte("addr2"))
bacc := auth.NewBaseAccountWithAddress(addr1)
bacc := authtypes.NewBaseAccountWithAddress(addr1)
periods := vesting.Periods{
vesting.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin("stake", 50)}},
vesting.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin("stake", 25)}},
@ -803,7 +804,7 @@ func (suite *IntegrationTestSuite) TestDelegateCoins() {
macc := app.AccountKeeper.NewAccountWithAddress(ctx, addrModule) // we don't need to define an actual module account bc we just need the address for testing
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr2)
bacc := auth.NewBaseAccountWithAddress(addr1)
bacc := authtypes.NewBaseAccountWithAddress(addr1)
vacc := vesting.NewContinuousVestingAccount(bacc, origCoins, ctx.BlockHeader().Time.Unix(), endTime.Unix())
app.AccountKeeper.SetAccount(ctx, vacc)
@ -861,7 +862,7 @@ func (suite *IntegrationTestSuite) TestUndelegateCoins() {
addr2 := sdk.AccAddress([]byte("addr2"))
addrModule := sdk.AccAddress([]byte("moduleAcc"))
bacc := auth.NewBaseAccountWithAddress(addr1)
bacc := authtypes.NewBaseAccountWithAddress(addr1)
macc := app.AccountKeeper.NewAccountWithAddress(ctx, addrModule) // we don't need to define an actual module account bc we just need the address for testing
vacc := vesting.NewContinuousVestingAccount(bacc, origCoins, ctx.BlockHeader().Time.Unix(), endTime.Unix())

View File

@ -3,7 +3,7 @@ package keeper_test
import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
@ -17,5 +17,5 @@ var (
valConsAddr1 = sdk.ConsAddress(valConsPk1.Address())
valConsAddr2 = sdk.ConsAddress(valConsPk2.Address())
distrAcc = auth.NewEmptyModuleAccount(types.ModuleName)
distrAcc = authtypes.NewEmptyModuleAccount(types.ModuleName)
)

View File

@ -7,7 +7,7 @@ import (
abcitypes "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
@ -22,6 +22,6 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
},
)
acc := app.AccountKeeper.GetAccount(ctx, auth.NewModuleAddress(types.ModuleName))
acc := app.AccountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.ModuleName))
require.NotNil(t, acc)
}

View File

@ -8,7 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/evidence/exported"
"github.com/cosmos/cosmos-sdk/x/evidence/keeper"
@ -95,7 +95,7 @@ func (suite *KeeperTestSuite) SetupTest() {
for i, addr := range valAddresses {
addr := sdk.AccAddress(addr)
app.AccountKeeper.SetAccount(suite.ctx, auth.NewBaseAccount(addr, pubkeys[i], uint64(i), 0))
app.AccountKeeper.SetAccount(suite.ctx, authtypes.NewBaseAccount(addr, pubkeys[i], uint64(i), 0))
}
}

View File

@ -26,8 +26,8 @@ import (
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/genutil/types"
)
@ -36,7 +36,7 @@ import (
type StakingMsgBuildingHelpers interface {
CreateValidatorMsgHelpers(ipDefault string) (fs *flag.FlagSet, nodeIDFlag, pubkeyFlag, amountFlag, defaultsDesc string)
PrepareFlagsForTxCreateValidator(config *cfg.Config, nodeID, chainID string, valPubKey crypto.PubKey)
BuildCreateValidatorMsg(clientCtx client.Context, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error)
BuildCreateValidatorMsg(clientCtx client.Context, txBldr authtypes.TxBuilder) (authtypes.TxBuilder, sdk.Msg, error)
}
// GenTxCmd builds the application's gentx command.
@ -120,7 +120,7 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager, sm
return errors.Wrap(err, "failed to validate account in genesis")
}
txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(authclient.GetTxEncoder(cdc))
txBldr := authtypes.NewTxBuilderFromCLI(inBuf).WithTxEncoder(authclient.GetTxEncoder(cdc))
clientCtx := client.NewContextWithInput(inBuf).WithCodec(cdc).WithJSONMarshaler(cdc)
// Set the generate-only flag here after the CLI context has
@ -203,8 +203,8 @@ func makeOutputFilepath(rootDir, nodeID string) (string, error) {
return filepath.Join(writePath, fmt.Sprintf("gentx-%v.json", nodeID)), nil
}
func readUnsignedGenTxFile(cdc *codec.Codec, r io.Reader) (auth.StdTx, error) {
var stdTx auth.StdTx
func readUnsignedGenTxFile(cdc *codec.Codec, r io.Reader) (authtypes.StdTx, error) {
var stdTx authtypes.StdTx
bytes, err := ioutil.ReadAll(r)
if err != nil {
@ -216,7 +216,7 @@ func readUnsignedGenTxFile(cdc *codec.Codec, r io.Reader) (auth.StdTx, error) {
return stdTx, err
}
func writeSignedGenTx(cdc *codec.Codec, outputDocument string, tx auth.StdTx) error {
func writeSignedGenTx(cdc *codec.Codec, outputDocument string, tx authtypes.StdTx) error {
outputFile, err := os.OpenFile(outputDocument, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
if err != nil {
return err

View File

@ -11,6 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/bank"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/gov"
@ -57,7 +58,7 @@ func TestImportExportQueues(t *testing.T) {
govGenState := gov.ExportGenesis(ctx, app.GovKeeper)
genesisState := simapp.NewDefaultGenesisState()
genesisState[auth.ModuleName] = app.AppCodec().MustMarshalJSON(authGenState)
genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenState)
genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenState)
genesisState[types.ModuleName] = app.AppCodec().MustMarshalJSON(govGenState)

View File

@ -7,7 +7,7 @@ import (
abcitypes "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
)
@ -22,6 +22,6 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
},
)
acc := app.AccountKeeper.GetAccount(ctx, auth.NewModuleAddress(types.ModuleName))
acc := app.AccountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.ModuleName))
require.NotNil(t, acc)
}

View File

@ -7,7 +7,7 @@ import (
abcitypes "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/mint/types"
)
@ -22,6 +22,6 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
},
)
acc := app.AccountKeeper.GetAccount(ctx, auth.NewModuleAddress(types.ModuleName))
acc := app.AccountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.ModuleName))
require.NotNil(t, acc)
}

View File

@ -10,7 +10,6 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/slashing/types"
@ -42,7 +41,7 @@ func TestSlashingMsgs(t *testing.T) {
genCoin := sdk.NewCoin(sdk.DefaultBondDenom, genTokens)
bondCoin := sdk.NewCoin(sdk.DefaultBondDenom, bondTokens)
acc1 := &auth.BaseAccount{
acc1 := &authtypes.BaseAccount{
Address: addr1,
}
accs := authtypes.GenesisAccounts{acc1}

View File

@ -8,7 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"
)
@ -44,9 +44,9 @@ func TestStakingMsgs(t *testing.T) {
genCoin := sdk.NewCoin(sdk.DefaultBondDenom, genTokens)
bondCoin := sdk.NewCoin(sdk.DefaultBondDenom, bondTokens)
acc1 := &auth.BaseAccount{Address: addr1}
acc2 := &auth.BaseAccount{Address: addr2}
accs := auth.GenesisAccounts{acc1, acc2}
acc1 := &authtypes.BaseAccount{Address: addr1}
acc2 := &authtypes.BaseAccount{Address: addr2}
accs := authtypes.GenesisAccounts{acc1, acc2}
balances := []banktypes.Balance{
{
Address: addr1,

View File

@ -5,7 +5,7 @@ import (
"os"
"strings"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
@ -408,7 +408,7 @@ func PrepareFlagsForTxCreateValidator(
}
// BuildCreateValidatorMsg makes a new MsgCreateValidator.
func BuildCreateValidatorMsg(clientCtx client.Context, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) {
func BuildCreateValidatorMsg(clientCtx client.Context, txBldr authtypes.TxBuilder) (authtypes.TxBuilder, sdk.Msg, error) {
amounstStr := viper.GetString(FlagAmount)
amount, err := sdk.ParseCoin(amounstStr)

View File

@ -7,7 +7,7 @@ import (
abcitypes "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"
)
@ -22,9 +22,9 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
},
)
acc := app.AccountKeeper.GetAccount(ctx, auth.NewModuleAddress(types.BondedPoolName))
acc := app.AccountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.BondedPoolName))
require.NotNil(t, acc)
acc = app.AccountKeeper.GetAccount(ctx, auth.NewModuleAddress(types.NotBondedPoolName))
acc = app.AccountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.NotBondedPoolName))
require.NotNil(t, acc)
}