Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use any as validator pubkey #7597

Merged
merged 58 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e098384
protobuf pubkey type update
robert-zaremba Oct 19, 2020
4999b5c
wip2
robert-zaremba Oct 19, 2020
8f3645c
wip3
robert-zaremba Oct 19, 2020
bdd82af
solving types.NewValidator issues
robert-zaremba Oct 19, 2020
94047df
remove bech32 from validator type assignment
robert-zaremba Oct 19, 2020
324f31a
update Validator interface
robert-zaremba Oct 19, 2020
cc2d8a5
Changelog update
robert-zaremba Oct 19, 2020
774bf73
wip4
robert-zaremba Oct 19, 2020
ee2cad2
update genutil
robert-zaremba Oct 19, 2020
fc02eab
fix simapp & x/ibc/testing tests
clevinson Oct 19, 2020
51b2ab9
update staking
robert-zaremba Oct 19, 2020
05b8e73
changelog update
robert-zaremba Oct 19, 2020
3f139a1
fix import cycle in tests
robert-zaremba Oct 19, 2020
8734a4e
fix amino panic on TestValidatorMarshalUnmarshalJSON
robert-zaremba Oct 19, 2020
dfa92d6
fix TestValidatorMarshalUnmarshalJSON consensus_pubkey check
robert-zaremba Oct 19, 2020
32a2278
Add UnpackInterfaces to HistoricalInfo
robert-zaremba Oct 20, 2020
da990bf
fix TestHistoricalInfo
robert-zaremba Oct 20, 2020
003affd
update todos
robert-zaremba Oct 20, 2020
ff38afc
fix: Expecting ed25519.PubKey to implement proto.Message
robert-zaremba Oct 20, 2020
d50c77e
fix linter issues
robert-zaremba Oct 20, 2020
27ef9a7
Fix migrate test
amaury1093 Oct 20, 2020
4a95588
Update CHANGELOG.md
robert-zaremba Oct 20, 2020
98080ac
Merge pull request #7596 from cosmos/am-7477-migrate-staking
amaury1093 Oct 20, 2020
1dd1742
review comments
robert-zaremba Oct 20, 2020
515c072
cosmetic changes
robert-zaremba Oct 20, 2020
5cc8260
add UnpackInterfaces got GenesisRandomized test
robert-zaremba Oct 20, 2020
217bd2d
Validator.Equal reuses Validator.MinEqual
robert-zaremba Oct 20, 2020
605e33e
fix test
robert-zaremba Oct 20, 2020
d95c789
use Validator.Equal in tests
robert-zaremba Oct 20, 2020
5a07467
Fix staking simulation TestRandomizedGenState
blushi Oct 20, 2020
77f149f
Remove TODO
blushi Oct 20, 2020
1ac1245
use HistoricalInfo.Equal
robert-zaremba Oct 20, 2020
e6ac2ee
use proto.Equal
robert-zaremba Oct 20, 2020
da53a90
rename Validator.GetConsPubKey to TmConsPubKey
robert-zaremba Oct 20, 2020
978d9df
prefer require.Equal over reflect.DeepEqual
robert-zaremba Oct 20, 2020
653e4e4
SetHistoricalInfo using a pointer
robert-zaremba Oct 20, 2020
3da8daf
Fix TestQueryDelegation test
blushi Oct 21, 2020
34257ee
Fix TestQueryValidators test
blushi Oct 21, 2020
8905dfe
Fix TestSimulateMsgUnjail test
blushi Oct 21, 2020
fa73f01
experiement with LegacyAmino instances
robert-zaremba Oct 21, 2020
602928c
Register codecs in all simapp tests
robert-zaremba Oct 21, 2020
4774148
Fix cli_test compilation problems
robert-zaremba Oct 21, 2020
5350cc3
fix typo sdk -> std
robert-zaremba Oct 21, 2020
eddbe0c
fix typo
robert-zaremba Oct 21, 2020
62c1fc5
fix TestPlanStringer
robert-zaremba Oct 21, 2020
bfc93a3
Merge branch 'master' into robert/validator-pubkey
robert-zaremba Oct 21, 2020
a500f82
Rename to MakeEncodingConfig
amaury1093 Oct 22, 2020
6e33895
Remove RegisterCodecsTests
amaury1093 Oct 22, 2020
71e5331
Use gRPC in GetCmdQueryValidators
amaury1093 Oct 22, 2020
1cae118
Empty status
amaury1093 Oct 22, 2020
334253f
Merge pull request #7626 from cosmos/am-validator-pubkey
robert-zaremba Oct 22, 2020
54c85a5
fix info log check
robert-zaremba Oct 22, 2020
9d0ca25
linter fixes
robert-zaremba Oct 22, 2020
2598a7f
rename simapparams to simappparams
robert-zaremba Oct 23, 2020
4e21ba4
Update simapp/test_helpers.go
robert-zaremba Oct 23, 2020
a019c4d
comments updates
robert-zaremba Oct 23, 2020
1c8b045
use valAddr1 instead of sdk.ValAddress(pk1.Address().Bytes())
robert-zaremba Oct 23, 2020
1fa3829
Merge branch 'master' into robert/validator-pubkey
robert-zaremba Oct 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking

* (AppModule) [\#7518](https://github.com/cosmos/cosmos-sdk/pull/7518) [\#7584](https://github.com/cosmos/cosmos-sdk/pull/7584) Rename `AppModule.RegisterQueryServices` to `AppModule.RegisterServices`, as this method now registers multiple services (the gRPC query service and the protobuf Msg service). A `Configurator` struct is used to hold the different services.
* (x/staking/types) [\#7447](https://github.com/cosmos/cosmos-sdk/issues/7447) Remove bech32 PubKey support:
* `ValidatorI` interface update. `GetConsPubKey` renamed to `TmConsPubKey` (consensus public key must be a tendermint key). `TmConsPubKey`, `GetConsAddr` methods return error.
* `Validator` update. Methods changed in `ValidatorI` (as described above) and `ToTmValidator` return error.
* `Validator.ConsensusPubkey` type changed from `string` to `codectypes.Any`.
* `MsgCreateValidator.Pubkey` type changed from `string` to `codectypes.Any`.

### Features

Expand Down Expand Up @@ -165,7 +170,7 @@ of the Cosmos SDK since launch. Please read through this changelog and [release
* `NewAnteHandler` and `NewSigVerificationDecorator` both now take a `SignModeHandler` parameter.
* `SignatureVerificationGasConsumer` now has the signature: `func(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error`.
* The `SigVerifiableTx` interface now has a `GetSignaturesV2() ([]signing.SignatureV2, error)` method and no longer has the `GetSignBytes` method.

### State Machine Breaking

* __General__
Expand Down Expand Up @@ -358,7 +363,7 @@ falling below their minimum self-delegation and never having been bonded. The va

* (x/auth) [\#6861](https://github.com/cosmos/cosmos-sdk/pull/6861) Remove public key Bech32 encoding for all account types for JSON serialization, instead relying on direct Amino encoding. In addition, JSON serialization utilizes Amino instead of the Go stdlib, so integers are treated as strings.

### Improvements
### Improvements

* (client) [\#6853](https://github.com/cosmos/cosmos-sdk/pull/6853) Add --unsafe-cors flag.

Expand Down
13 changes: 0 additions & 13 deletions client/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ func (ctx Context) QueryABCI(req abci.RequestQuery) (abci.ResponseQuery, error)
return ctx.queryABCI(req)
}

// QuerySubspace performs a query to a Tendermint node with the provided
// store name and subspace. It returns key value pair and height of the query
// upon success or an error if the query fails.
func (ctx Context) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, height int64, err error) {
resRaw, height, err := ctx.queryStore(subspace, storeName, "subspace")
if err != nil {
return res, height, err
}

ctx.LegacyAmino.MustUnmarshalBinaryBare(resRaw, &res)
return
}

// GetFromAddress returns the from address from the context's name.
func (ctx Context) GetFromAddress() sdk.AccAddress {
return ctx.FromAddress
Expand Down
2 changes: 2 additions & 0 deletions codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (cdc *LegacyAmino) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interfa
}
}

// MarshalJSON implements codec.Marshaler interface
func (cdc *LegacyAmino) MarshalJSON(o interface{}) ([]byte, error) {
err := cdc.jsonMarshalAnys(o)
if err != nil {
Expand All @@ -155,6 +156,7 @@ func (cdc *LegacyAmino) MustMarshalJSON(o interface{}) []byte {
return bz
}

// UnmarshalJSON implements codec.Marshaler interface
func (cdc *LegacyAmino) UnmarshalJSON(bz []byte, ptr interface{}) error {
err := cdc.Amino.UnmarshalJSON(bz, ptr)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions crypto/codec/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
// TODO We now register both Tendermint's PubKey and our own PubKey. In the
// long-term, we should move away from Tendermint's PubKey, and delete
// these lines.
registry.RegisterInterface("tendermint.crypto.Pubkey", (*tmcrypto.PubKey)(nil))
registry.RegisterInterface("tendermint.crypto.PubKey", (*tmcrypto.PubKey)(nil))
registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &ed25519.PubKey{})
registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &secp256k1.PubKey{})
registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &multisig.LegacyAminoPubKey{})

registry.RegisterInterface("cosmos.crypto.Pubkey", (*cryptotypes.PubKey)(nil))
registry.RegisterInterface("cosmos.crypto.PubKey", (*cryptotypes.PubKey)(nil))
registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &ed25519.PubKey{})
registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{})
registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &multisig.LegacyAminoPubKey{})
Expand Down
17 changes: 11 additions & 6 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ syntax = "proto3";
package cosmos.staking.v1beta1;

import "gogoproto/gogo.proto";
import "tendermint/types/types.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "tendermint/types/types.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

Expand Down Expand Up @@ -73,10 +76,12 @@ message Validator {
option (gogoproto.goproto_getters) = false;

string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""];
string consensus_pubkey = 2 [(gogoproto.moretags) = "yaml:\"consensus_pubkey\""];
bool jailed = 3;
BondStatus status = 4;
string tokens = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
google.protobuf.Any consensus_pubkey = 2 [
(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey",
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.moretags) = "yaml:\"consensus_pubkey\""];
bool jailed = 3;
BondStatus status = 4;
string tokens = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string delegator_shares = 6 [
(gogoproto.moretags) = "yaml:\"delegator_shares\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
Expand Down
12 changes: 7 additions & 5 deletions proto/cosmos/staking/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
syntax = "proto3";
package cosmos.staking.v1beta1;

import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "gogoproto/gogo.proto";

import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/timestamp.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "google/protobuf/any.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

Expand Down Expand Up @@ -44,7 +46,7 @@ message MsgCreateValidator {
];
string delegator_address = 4 [(gogoproto.moretags) = "yaml:\"delegator_address\""];
string validator_address = 5 [(gogoproto.moretags) = "yaml:\"validator_address\""];
google.protobuf.Any pubkey = 6;
google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"];
cosmos.base.v1beta1.Coin value = 7 [(gogoproto.nullable) = false];
}

Expand Down Expand Up @@ -104,7 +106,7 @@ message MsgBeginRedelegate {
}

// MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type.
message MsgBeginRedelegateResponse {
message MsgBeginRedelegateResponse {
google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}

Expand All @@ -120,6 +122,6 @@ message MsgUndelegate {
}

// MsgUndelegateResponse defines the Msg/Undelegate response type.
message MsgUndelegateResponse {
message MsgUndelegateResponse {
google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}
6 changes: 3 additions & 3 deletions simapp/encoding.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package simapp

import (
"github.com/cosmos/cosmos-sdk/simapp/params"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/cosmos/cosmos-sdk/std"
)

// MakeEncodingConfig creates an EncodingConfig for testing
func MakeEncodingConfig() params.EncodingConfig {
encodingConfig := params.MakeEncodingConfig()
func MakeEncodingConfig() simappparams.EncodingConfig {
encodingConfig := simappparams.MakeEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
Expand Down
9 changes: 6 additions & 3 deletions simapp/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ func (app *SimApp) ExportAppStateAndValidators(
return servertypes.ExportedApp{}, err
}

validators := staking.WriteValidators(ctx, app.StakingKeeper)
validators, err := staking.WriteValidators(ctx, app.StakingKeeper)
return servertypes.ExportedApp{
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
}, nil
}, err
}

// prepare for fresh start at zero height
Expand Down Expand Up @@ -174,7 +174,10 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []

iter.Close()

_ = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx)
_, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx)
if err != nil {
log.Fatal(err)
}

/* Handle slashing state. */

Expand Down
9 changes: 4 additions & 5 deletions simapp/params/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/tx"
)

// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration.
// MakeEncodingConfig creates an EncodingConfig for a non-amino based test configuration.
func MakeEncodingConfig() EncodingConfig {
amino := codec.NewLegacyAmino()
cdc := codec.NewLegacyAmino()
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)

return EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
TxConfig: txCfg,
Amino: amino,
TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes),
Amino: cdc,
}
}
2 changes: 2 additions & 0 deletions simapp/sim_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)

// export state and simParams before the simulation error is checked
Expand Down Expand Up @@ -83,6 +84,7 @@ func BenchmarkInvariants(b *testing.B) {
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)

// export state and simParams before the simulation error is checked
Expand Down
5 changes: 5 additions & 0 deletions simapp/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func TestFullAppSimulation(t *testing.T) {
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)

// export state and simParams before the simulation error is checked
Expand Down Expand Up @@ -118,6 +119,7 @@ func TestAppImportExport(t *testing.T) {
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)

// export state and simParams before the simulation error is checked
Expand Down Expand Up @@ -214,6 +216,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)

// export state and simParams before the simulation error is checked
Expand Down Expand Up @@ -261,6 +264,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
SimulationOperations(newApp, newApp.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)
require.NoError(t, err)
}
Expand Down Expand Up @@ -311,6 +315,7 @@ func TestAppStateDeterminism(t *testing.T) {
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)
require.NoError(t, err)

Expand Down
6 changes: 3 additions & 3 deletions simapp/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
simapparams "github.com/cosmos/cosmos-sdk/simapp/params"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -85,11 +85,11 @@ func AppStateRandomizedFn(
// number of bonded accounts
var initialStake, numInitiallyBonded int64
appParams.GetOrGenerate(
cdc, simapparams.StakePerAccount, &initialStake, r,
cdc, simappparams.StakePerAccount, &initialStake, r,
func(r *rand.Rand) { initialStake = r.Int63n(1e12) },
)
appParams.GetOrGenerate(
cdc, simapparams.InitiallyBondedValidators, &numInitiallyBonded, r,
cdc, simappparams.InitiallyBondedValidators, &numInitiallyBonded, r,
func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(300)) },
)

Expand Down
10 changes: 9 additions & 1 deletion simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -92,9 +93,16 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
bondAmt := sdk.NewInt(1000000)

for _, val := range valSet.Validators {
// Currently validator requires tmcrypto.ed25519 keys, which don't support
// our Marshaling interfaces, so we need to pack them into our version of ed25519.
// There is ongoing work to add secp256k1 keys (https://github.com/cosmos/cosmos-sdk/pull/7604).
pk, err := ed25519.FromTmEd25519(val.PubKey)
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
require.NoError(t, err)
pkAny, err := codectypes.PackAny(pk)
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
require.NoError(t, err)
validator := stakingtypes.Validator{
OperatorAddress: sdk.ValAddress(val.Address).String(),
ConsensusPubkey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, val.PubKey),
ConsensusPubkey: pkAny,
Jailed: false,
Status: stakingtypes.Bonded,
Tokens: bondAmt,
Expand Down
4 changes: 2 additions & 2 deletions x/auth/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ type AppModule struct {
AppModuleBasic

accountKeeper keeper.AccountKeeper
randGenAccountsFn simulation.RandomGenesisAccountsFn
randGenAccountsFn types.RandomGenesisAccountsFn
}

// NewAppModule creates a new AppModule object
func NewAppModule(cdc codec.Marshaler, accountKeeper keeper.AccountKeeper, randGenAccountsFn simulation.RandomGenesisAccountsFn) AppModule {
func NewAppModule(cdc codec.Marshaler, accountKeeper keeper.AccountKeeper, randGenAccountsFn types.RandomGenesisAccountsFn) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
accountKeeper: accountKeeper,
Expand Down
6 changes: 1 addition & 5 deletions x/auth/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ const (
SigVerifyCostSECP256K1 = "sig_verify_cost_secp256k1"
)

// RandomGenesisAccountsFn defines the function required to generate custom account types
// on the auth module simulation.
type RandomGenesisAccountsFn func(simState *module.SimulationState) types.GenesisAccounts

// RandomGenesisAccounts defines the default RandomGenesisAccountsFn used on the SDK.
// It creates a slice of BaseAccount, ContinuousVestingAccount and DelayedVestingAccount.
func RandomGenesisAccounts(simState *module.SimulationState) types.GenesisAccounts {
Expand Down Expand Up @@ -92,7 +88,7 @@ func GenSigVerifyCostSECP256K1(r *rand.Rand) uint64 {
}

// RandomizedGenState generates a random GenesisState for auth
func RandomizedGenState(simState *module.SimulationState, randGenAccountsFn RandomGenesisAccountsFn) {
func RandomizedGenState(simState *module.SimulationState, randGenAccountsFn types.RandomGenesisAccountsFn) {
var maxMemoChars uint64
simState.AppParams.GetOrGenerate(
simState.Cdc, MaxMemoChars, &maxMemoChars, simState.Rand,
Expand Down
3 changes: 1 addition & 2 deletions x/auth/simulation/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import (
"fmt"
"math/rand"

"github.com/cosmos/cosmos-sdk/x/simulation"

simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
)

const (
Expand Down
4 changes: 4 additions & 0 deletions x/auth/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"
)

var _ types.UnpackInterfacesMessage = GenesisState{}

// RandomGenesisAccountsFn defines the function required to generate custom account types
type RandomGenesisAccountsFn func(simState *module.SimulationState) GenesisAccounts

// NewGenesisState - Create a new genesis state
func NewGenesisState(params Params, accounts GenesisAccounts) *GenesisState {
genAccounts, err := PackAccounts(accounts)
Expand Down
Loading