From c4bc88837584804c012070da708ff9e282ec47d7 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Sat, 7 Apr 2018 00:02:00 -0700 Subject: [PATCH] Fix almost all tests --- Makefile | 2 +- examples/basecoin/app/app.go | 28 +++++++++++++-------- examples/basecoin/app/app_test.go | 3 +-- examples/democoin/app/app.go | 13 +++++++--- examples/democoin/app/app_test.go | 9 +++---- examples/democoin/x/pow/handler_test.go | 5 +++- examples/democoin/x/pow/keeper_test.go | 5 +++- types/coin.go | 2 +- types/coin_test.go | 4 +-- x/auth/ante_test.go | 24 +++++++++++++----- x/auth/baseaccount.go | 5 +++- x/auth/mapper.go | 33 +------------------------ x/auth/mapper_test.go | 22 ++++++----------- x/ibc/ibc_test.go | 7 +++--- x/simplestake/keeper.go | 1 + x/simplestake/keeper_test.go | 5 +++- x/stake/test_common.go | 6 +++-- 17 files changed, 87 insertions(+), 87 deletions(-) diff --git a/Makefile b/Makefile index b5177621a..8d6fb9952 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PACKAGES=$(shell go list ./... | grep -v '/vendor/') +PACKAGES=$(shell go list ./... | grep -v '/vendor/' | grep -v 'client/lcd') # XXX COMMIT_HASH := $(shell git rev-parse --short HEAD) BUILD_FLAGS = -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=${COMMIT_HASH}" diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index e6623329d..15a4f1f19 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -39,23 +39,28 @@ type BasecoinApp struct { } func NewBasecoinApp(logger log.Logger, dbs map[string]dbm.DB) *BasecoinApp { - // create your application object + + // Create app-level codec for txs and accounts. + var cdc = MakeCodec() + + // Create your application object. var app = &BasecoinApp{ BaseApp: bam.NewBaseApp(appName, logger, dbs["main"]), - cdc: MakeCodec(), + cdc: cdc, capKeyMainStore: sdk.NewKVStoreKey("main"), capKeyAccountStore: sdk.NewKVStoreKey("acc"), capKeyIBCStore: sdk.NewKVStoreKey("ibc"), capKeyStakingStore: sdk.NewKVStoreKey("stake"), } - // define the accountMapper - app.accountMapper = auth.NewAccountMapperSealed( + // Define the accountMapper. + app.accountMapper = auth.NewAccountMapper( + cdc, app.capKeyMainStore, // target store &types.AppAccount{}, // prototype - ) + ).Seal() - // add handlers + // Add handlers. coinKeeper := bank.NewCoinKeeper(app.accountMapper) ibcMapper := ibc.NewIBCMapper(app.cdc, app.capKeyIBCStore) stakeKeeper := simplestake.NewKeeper(app.capKeyStakingStore, coinKeeper) @@ -64,7 +69,7 @@ func NewBasecoinApp(logger log.Logger, dbs map[string]dbm.DB) *BasecoinApp { AddRoute("ibc", ibc.NewHandler(ibcMapper, coinKeeper)). AddRoute("simplestake", simplestake.NewHandler(stakeKeeper)) - // initialize BaseApp + // Initialize BaseApp. app.SetTxDecoder(app.txDecoder) app.SetInitChainer(app.initChainer) app.MountStoreWithDB(app.capKeyMainStore, sdk.StoreTypeIAVL, dbs["main"]) @@ -82,7 +87,7 @@ func NewBasecoinApp(logger log.Logger, dbs map[string]dbm.DB) *BasecoinApp { return app } -// custom tx codec +// Custom tx codec func MakeCodec() *wire.Codec { var cdc = wire.NewCodec() @@ -99,10 +104,13 @@ func MakeCodec() *wire.Codec { cdc.RegisterInterface((*sdk.Account)(nil), nil) cdc.RegisterConcrete(&types.AppAccount{}, "basecoin/Account", nil) + // Register crypto. + wire.RegisterCrypto(cdc) + return cdc } -// custom logic for transaction decoding +// Custom logic for transaction decoding func (app *BasecoinApp) txDecoder(txBytes []byte) (sdk.Tx, sdk.Error) { var tx = sdk.StdTx{} @@ -119,7 +127,7 @@ func (app *BasecoinApp) txDecoder(txBytes []byte) (sdk.Tx, sdk.Error) { return tx, nil } -// custom logic for basecoin initialization +// Custom logic for basecoin initialization func (app *BasecoinApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { stateJSON := req.AppStateBytes diff --git a/examples/basecoin/app/app_test.go b/examples/basecoin/app/app_test.go index 65aff3af9..41c1a6f17 100644 --- a/examples/basecoin/app/app_test.go +++ b/examples/basecoin/app/app_test.go @@ -349,10 +349,9 @@ func TestQuizMsg(t *testing.T) { // Construct genesis state // Construct some genesis bytes to reflect basecoin/types/AppAccount - coins := sdk.Coins{} baseAcc := auth.BaseAccount{ Address: addr1, - Coins: coins, + Coins: nil, } acc1 := &types.AppAccount{baseAcc, "foobart"} diff --git a/examples/democoin/app/app.go b/examples/democoin/app/app.go index 8e7c20515..ad6fd7865 100644 --- a/examples/democoin/app/app.go +++ b/examples/democoin/app/app.go @@ -44,10 +44,13 @@ type DemocoinApp struct { func NewDemocoinApp(logger log.Logger, dbs map[string]dbm.DB) *DemocoinApp { + // Create app-level codec for txs and accounts. + var cdc = MakeCodec() + // Create your application object. var app = &DemocoinApp{ BaseApp: bam.NewBaseApp(appName, logger, dbs["main"]), - cdc: MakeCodec(), + cdc: cdc, capKeyMainStore: sdk.NewKVStoreKey("main"), capKeyAccountStore: sdk.NewKVStoreKey("acc"), capKeyPowStore: sdk.NewKVStoreKey("pow"), @@ -56,10 +59,11 @@ func NewDemocoinApp(logger log.Logger, dbs map[string]dbm.DB) *DemocoinApp { } // Define the accountMapper. - app.accountMapper = auth.NewAccountMapperSealed( + app.accountMapper = auth.NewAccountMapper( + cdc, app.capKeyMainStore, // target store &types.AppAccount{}, // prototype - ) + ).Seal() // Add handlers. coinKeeper := bank.NewCoinKeeper(app.accountMapper) @@ -114,6 +118,9 @@ func MakeCodec() *wire.Codec { cdc.RegisterInterface((*sdk.Account)(nil), nil) cdc.RegisterConcrete(&types.AppAccount{}, "democoin/Account", nil) + // Register crypto. + wire.RegisterCrypto(cdc) + return cdc } diff --git a/examples/democoin/app/app_test.go b/examples/democoin/app/app_test.go index 1cc56bd6b..7047f5d28 100644 --- a/examples/democoin/app/app_test.go +++ b/examples/democoin/app/app_test.go @@ -106,8 +106,7 @@ func TestMsgs(t *testing.T) { }}) // just marshal/unmarshal! - cdc := MakeCodec() - txBytes, err := cdc.MarshalBinary(tx) + txBytes, err := bapp.cdc.MarshalBinary(tx) require.NoError(t, err, "i: %v", i) // Run a Check @@ -245,10 +244,9 @@ func TestMineMsg(t *testing.T) { // Construct genesis state // Construct some genesis bytes to reflect democoin/types/AppAccount - coins := sdk.Coins{} baseAcc := auth.BaseAccount{ Address: addr1, - Coins: coins, + Coins: nil, } acc1 := &types.AppAccount{baseAcc, "foobart"} @@ -297,10 +295,9 @@ func TestQuizMsg(t *testing.T) { // Construct genesis state // Construct some genesis bytes to reflect democoin/types/AppAccount - coins := sdk.Coins{} baseAcc := auth.BaseAccount{ Address: addr1, - Coins: coins, + Coins: nil, } acc1 := &types.AppAccount{baseAcc, "foobart"} diff --git a/examples/democoin/x/pow/handler_test.go b/examples/democoin/x/pow/handler_test.go index 2de285371..a05932780 100644 --- a/examples/democoin/x/pow/handler_test.go +++ b/examples/democoin/x/pow/handler_test.go @@ -8,14 +8,17 @@ import ( abci "github.com/tendermint/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" + wire "github.com/cosmos/cosmos-sdk/wire" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) func TestPowHandler(t *testing.T) { ms, capKey := setupMultiStore() + cdc := wire.NewCodec() + auth.RegisterBaseAccount(cdc) - am := auth.NewAccountMapper(capKey, &auth.BaseAccount{}) + am := auth.NewAccountMapper(cdc, capKey, &auth.BaseAccount{}) ctx := sdk.NewContext(ms, abci.Header{}, false, nil) config := NewPowConfig("pow", int64(1)) ck := bank.NewCoinKeeper(am) diff --git a/examples/democoin/x/pow/keeper_test.go b/examples/democoin/x/pow/keeper_test.go index 6e0d52649..cb3492a86 100644 --- a/examples/democoin/x/pow/keeper_test.go +++ b/examples/democoin/x/pow/keeper_test.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/wire" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -27,8 +28,10 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) { func TestPowKeeperGetSet(t *testing.T) { ms, capKey := setupMultiStore() + cdc := wire.NewCodec() + auth.RegisterBaseAccount(cdc) - am := auth.NewAccountMapper(capKey, &auth.BaseAccount{}) + am := auth.NewAccountMapper(cdc, capKey, &auth.BaseAccount{}) ctx := sdk.NewContext(ms, abci.Header{}, false, nil) config := NewPowConfig("pow", int64(1)) ck := bank.NewCoinKeeper(am) diff --git a/types/coin.go b/types/coin.go index ab7d863c1..8a80bee22 100644 --- a/types/coin.go +++ b/types/coin.go @@ -110,7 +110,7 @@ func (coins Coins) IsValid() bool { // Plus combines two sets of coins // CONTRACT: Plus will never return Coins where one Coin has a 0 amount. func (coins Coins) Plus(coinsB Coins) Coins { - sum := []Coin{} + sum := ([]Coin)(nil) indexA, indexB := 0, 0 lenA, lenB := len(coins), len(coinsB) for { diff --git a/types/coin_test.go b/types/coin_test.go index 19929e8c7..eb9f5e087 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -201,8 +201,8 @@ func TestPlusCoins(t *testing.T) { }{ {Coins{{"A", 1}, {"B", 1}}, Coins{{"A", 1}, {"B", 1}}, Coins{{"A", 2}, {"B", 2}}}, {Coins{{"A", 0}, {"B", 1}}, Coins{{"A", 0}, {"B", 0}}, Coins{{"B", 1}}}, - {Coins{{"A", 0}, {"B", 0}}, Coins{{"A", 0}, {"B", 0}}, Coins{}}, - {Coins{{"A", 1}, {"B", 0}}, Coins{{"A", -1}, {"B", 0}}, Coins{}}, + {Coins{{"A", 0}, {"B", 0}}, Coins{{"A", 0}, {"B", 0}}, Coins(nil)}, + {Coins{{"A", 1}, {"B", 0}}, Coins{{"A", -1}, {"B", 0}}, Coins(nil)}, {Coins{{"A", -1}, {"B", 0}}, Coins{{"A", 0}, {"B", 0}}, Coins{{"A", -1}}}, } diff --git a/x/auth/ante_test.go b/x/auth/ante_test.go index fa545e32b..2f90701e6 100644 --- a/x/auth/ante_test.go +++ b/x/auth/ante_test.go @@ -3,11 +3,13 @@ package auth import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" abci "github.com/tendermint/abci/types" crypto "github.com/tendermint/go-crypto" + + sdk "github.com/cosmos/cosmos-sdk/types" + wire "github.com/cosmos/cosmos-sdk/wire" ) func newTestMsg(addrs ...sdk.Address) *sdk.TestMsg { @@ -67,7 +69,9 @@ func newTestTxWithSignBytes(msg sdk.Msg, privs []crypto.PrivKey, seqs []int64, f func TestAnteHandlerSigErrors(t *testing.T) { // setup ms, capKey := setupMultiStore() - mapper := NewAccountMapper(capKey, &BaseAccount{}) + cdc := wire.NewCodec() + RegisterBaseAccount(cdc) + mapper := NewAccountMapper(cdc, capKey, &BaseAccount{}) anteHandler := NewAnteHandler(mapper) ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil) @@ -106,7 +110,9 @@ func TestAnteHandlerSigErrors(t *testing.T) { func TestAnteHandlerSequences(t *testing.T) { // setup ms, capKey := setupMultiStore() - mapper := NewAccountMapper(capKey, &BaseAccount{}) + cdc := wire.NewCodec() + RegisterBaseAccount(cdc) + mapper := NewAccountMapper(cdc, capKey, &BaseAccount{}) anteHandler := NewAnteHandler(mapper) ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil) @@ -170,7 +176,9 @@ func TestAnteHandlerSequences(t *testing.T) { func TestAnteHandlerFees(t *testing.T) { // setup ms, capKey := setupMultiStore() - mapper := NewAccountMapper(capKey, &BaseAccount{}) + cdc := wire.NewCodec() + RegisterBaseAccount(cdc) + mapper := NewAccountMapper(cdc, capKey, &BaseAccount{}) anteHandler := NewAnteHandler(mapper) ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil) @@ -205,7 +213,9 @@ func TestAnteHandlerFees(t *testing.T) { func TestAnteHandlerBadSignBytes(t *testing.T) { // setup ms, capKey := setupMultiStore() - mapper := NewAccountMapper(capKey, &BaseAccount{}) + cdc := wire.NewCodec() + RegisterBaseAccount(cdc) + mapper := NewAccountMapper(cdc, capKey, &BaseAccount{}) anteHandler := NewAnteHandler(mapper) ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil) @@ -278,7 +288,9 @@ func TestAnteHandlerBadSignBytes(t *testing.T) { func TestAnteHandlerSetPubKey(t *testing.T) { // setup ms, capKey := setupMultiStore() - mapper := NewAccountMapper(capKey, &BaseAccount{}) + cdc := wire.NewCodec() + RegisterBaseAccount(cdc) + mapper := NewAccountMapper(cdc, capKey, &BaseAccount{}) anteHandler := NewAnteHandler(mapper) ctx := sdk.NewContext(ms, abci.Header{ChainID: "mychainid"}, false, nil) diff --git a/x/auth/baseaccount.go b/x/auth/baseaccount.go index 74d8625f0..a5f33c81d 100644 --- a/x/auth/baseaccount.go +++ b/x/auth/baseaccount.go @@ -93,6 +93,9 @@ func (acc *BaseAccount) SetSequence(seq int64) error { //---------------------------------------- // Wire -func RegisterWireBaseAccount(cdc *wire.Codec) { +// Most users shouldn't use this, but this comes handy for tests. +func RegisterBaseAccount(cdc *wire.Codec) { + cdc.RegisterInterface((*sdk.Account)(nil), nil) + cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil) wire.RegisterCrypto(cdc) } diff --git a/x/auth/mapper.go b/x/auth/mapper.go index e07e8fbaa..7bc23aee1 100644 --- a/x/auth/mapper.go +++ b/x/auth/mapper.go @@ -28,8 +28,7 @@ type accountMapper struct { // NewAccountMapper returns a new sdk.AccountMapper that // uses go-amino to (binary) encode and decode concrete sdk.Accounts. -func NewAccountMapper(key sdk.StoreKey, proto sdk.Account) accountMapper { - cdc := wire.NewCodec() +func NewAccountMapper(cdc *wire.Codec, key sdk.StoreKey, proto sdk.Account) accountMapper { return accountMapper{ key: key, proto: proto, @@ -37,20 +36,6 @@ func NewAccountMapper(key sdk.StoreKey, proto sdk.Account) accountMapper { } } -// Create and return a sealed account mapper -func NewAccountMapperSealed(key sdk.StoreKey, proto sdk.Account) sealedAccountMapper { - cdc := wire.NewCodec() - am := accountMapper{ - key: key, - proto: proto, - cdc: cdc, - } - RegisterWireBaseAccount(cdc) - - // make accountMapper's WireCodec() inaccessible, return - return am.Seal() -} - // Returns the go-amino codec. You may need to register interfaces // and concrete types here, if your app's sdk.Account // implementation includes interface fields. @@ -108,22 +93,6 @@ func (sam sealedAccountMapper) WireCodec() *wire.Codec { //---------------------------------------- // misc. -// NOTE: currently unused -func (am accountMapper) clonePrototypePtr() interface{} { - protoRt := reflect.TypeOf(am.proto) - if protoRt.Kind() == reflect.Ptr { - protoErt := protoRt.Elem() - if protoErt.Kind() != reflect.Struct { - panic("accountMapper requires a struct proto sdk.Account, or a pointer to one") - } - protoRv := reflect.New(protoErt) - return protoRv.Interface() - } else { - protoRv := reflect.New(protoRt) - return protoRv.Interface() - } -} - // Creates a new struct (or pointer to struct) from am.proto. func (am accountMapper) clonePrototype() sdk.Account { protoRt := reflect.TypeOf(am.proto) diff --git a/x/auth/mapper_test.go b/x/auth/mapper_test.go index 752c933cc..030207db2 100644 --- a/x/auth/mapper_test.go +++ b/x/auth/mapper_test.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" + wire "github.com/cosmos/cosmos-sdk/wire" ) func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) { @@ -18,24 +19,17 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) { ms := store.NewCommitMultiStore(db) ms.MountStoreWithDB(capKey, sdk.StoreTypeIAVL, db) ms.LoadLatestVersion() - - /* XXX - // wire registration while we're at it ... TODO - var _ = oldwire.RegisterInterface( - struct{ sdk.Account }{}, - oldwire.ConcreteType{&BaseAccount{}, 0x1}, - ) - */ - return ms, capKey } func TestAccountMapperGetSet(t *testing.T) { ms, capKey := setupMultiStore() + cdc := wire.NewCodec() + RegisterBaseAccount(cdc) // make context and mapper ctx := sdk.NewContext(ms, abci.Header{}, false, nil) - mapper := NewAccountMapper(capKey, &BaseAccount{}) + mapper := NewAccountMapper(cdc, capKey, &BaseAccount{}) addr := sdk.Address([]byte("some-address")) @@ -66,16 +60,14 @@ func TestAccountMapperGetSet(t *testing.T) { func TestAccountMapperSealed(t *testing.T) { _, capKey := setupMultiStore() + cdc := wire.NewCodec() + RegisterBaseAccount(cdc) // normal mapper exposes the wire codec - mapper := NewAccountMapper(capKey, &BaseAccount{}) + mapper := NewAccountMapper(cdc, capKey, &BaseAccount{}) assert.NotNil(t, mapper.WireCodec()) // seal mapper, should panic when we try to get the codec mapperSealed := mapper.Seal() assert.Panics(t, func() { mapperSealed.WireCodec() }) - - // another way to get a sealed mapper - mapperSealed = NewAccountMapperSealed(capKey, &BaseAccount{}) - assert.Panics(t, func() { mapperSealed.WireCodec() }) } diff --git a/x/ibc/ibc_test.go b/x/ibc/ibc_test.go index 34f4f6678..db172a5ca 100644 --- a/x/ibc/ibc_test.go +++ b/x/ibc/ibc_test.go @@ -32,7 +32,7 @@ func newAddress() crypto.Address { } func getCoins(ck bank.CoinKeeper, ctx sdk.Context, addr crypto.Address) (sdk.Coins, sdk.Error) { - zero := sdk.Coins{} + zero := sdk.Coins(nil) return ck.AddCoins(ctx, addr, zero) } @@ -49,6 +49,7 @@ func makeCodec() *wire.Codec { // Register AppAccount cdc.RegisterInterface((*sdk.Account)(nil), nil) cdc.RegisterConcrete(&auth.BaseAccount{}, "test/ibc/Account", nil) + wire.RegisterCrypto(cdc) return cdc } @@ -59,13 +60,13 @@ func TestIBC(t *testing.T) { key := sdk.NewKVStoreKey("ibc") ctx := defaultContext(key) - am := auth.NewAccountMapper(key, &auth.BaseAccount{}) + am := auth.NewAccountMapper(cdc, key, &auth.BaseAccount{}) ck := bank.NewCoinKeeper(am) src := newAddress() dest := newAddress() chainid := "ibcchain" - zero := sdk.Coins{} + zero := sdk.Coins(nil) mycoins := sdk.Coins{sdk.Coin{"mycoin", 10}} coins, err := ck.AddCoins(ctx, src, mycoins) diff --git a/x/simplestake/keeper.go b/x/simplestake/keeper.go index 2370a8db3..7dcdbc20f 100644 --- a/x/simplestake/keeper.go +++ b/x/simplestake/keeper.go @@ -21,6 +21,7 @@ type Keeper struct { func NewKeeper(key sdk.StoreKey, coinKeeper bank.CoinKeeper) Keeper { cdc := wire.NewCodec() + wire.RegisterCrypto(cdc) return Keeper{ key: key, cdc: cdc, diff --git a/x/simplestake/keeper_test.go b/x/simplestake/keeper_test.go index 9f2615590..7f9a120b9 100644 --- a/x/simplestake/keeper_test.go +++ b/x/simplestake/keeper_test.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/wire" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -55,10 +56,12 @@ func TestKeeperGetSet(t *testing.T) { func TestBonding(t *testing.T) { ms, authKey, capKey := setupMultiStore() + cdc := wire.NewCodec() + auth.RegisterBaseAccount(cdc) ctx := sdk.NewContext(ms, abci.Header{}, false, nil) - accountMapper := auth.NewAccountMapper(authKey, &auth.BaseAccount{}) + accountMapper := auth.NewAccountMapper(cdc, authKey, &auth.BaseAccount{}) coinKeeper := bank.NewCoinKeeper(accountMapper) stakeKeeper := NewKeeper(capKey, coinKeeper) addr := sdk.Address([]byte("some-address")) diff --git a/x/stake/test_common.go b/x/stake/test_common.go index e116bf705..395a5bce0 100644 --- a/x/stake/test_common.go +++ b/x/stake/test_common.go @@ -97,6 +97,7 @@ func makeTestCodec() *wire.Codec { // Register AppAccount cdc.RegisterInterface((*sdk.Account)(nil), nil) cdc.RegisterConcrete(&auth.BaseAccount{}, "test/stake/Account", nil) + wire.RegisterCrypto(cdc) return cdc } @@ -125,10 +126,11 @@ func createTestInput(t *testing.T, isCheckTx bool, initCoins int64) (sdk.Context ctx := sdk.NewContext(ms, abci.Header{ChainID: "foochainid"}, isCheckTx, nil) cdc := makeTestCodec() - accountMapper := auth.NewAccountMapperSealed( + accountMapper := auth.NewAccountMapper( + cdc, // amino codec keyMain, // target store &auth.BaseAccount{}, // prototype - ) + ).Seal() ck := bank.NewCoinKeeper(accountMapper) keeper := NewKeeper(ctx, cdc, keyStake, ck) keeper.setPool(ctx, initialPool())