Skip to content

Commit

Permalink
test passes
Browse files Browse the repository at this point in the history
  • Loading branch information
mossid committed Sep 16, 2018
1 parent 83a28e6 commit 70c03b3
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 199 deletions.
5 changes: 3 additions & 2 deletions examples/democoin/x/assoc/validator_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/examples/democoin/mock"
"github.com/cosmos/cosmos-sdk/store"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
)

func defaultContext(key sdk.StoreKey) sdk.Context {
db := dbm.NewMemDB()
cms := store.NewCommitMultiStore(db)
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db)
cms.MountStoreWithDB(key, db)
cms.LoadLatestVersion()
ctx := sdk.NewContext(cms, abci.Header{}, false, nil)
return ctx
Expand All @@ -36,7 +37,7 @@ func TestValidatorSet(t *testing.T) {
{addr2, sdk.NewDec(2)},
}}

valset := NewValidatorSet(codec.New(), ctx.KVStore(key).Prefix([]byte("assoc")), base, 1, 5)
valset := NewValidatorSet(codec.New(), prefix.NewStore(ctx.KVStore(key), []byte("assoc")), base, 1, 5)

require.Equal(t, base.Validator(ctx, addr1), valset.Validator(ctx, addr1))
require.Equal(t, base.Validator(ctx, addr2), valset.Validator(ctx, addr2))
Expand Down
2 changes: 1 addition & 1 deletion examples/democoin/x/cool/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) {
db := dbm.NewMemDB()
capKey := sdk.NewKVStoreKey("capkey")
ms := store.NewCommitMultiStore(db)
ms.MountStoreWithDB(capKey, sdk.StoreTypeIAVL, db)
ms.MountStoreWithDB(capKey, db)
ms.LoadLatestVersion()
return ms, capKey
}
Expand Down
2 changes: 1 addition & 1 deletion examples/democoin/x/oracle/oracle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func defaultContext(keys ...sdk.StoreKey) sdk.Context {
db := dbm.NewMemDB()
cms := store.NewCommitMultiStore(db)
for _, key := range keys {
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db)
cms.MountStoreWithDB(key, db)
}
cms.LoadLatestVersion()
ctx := sdk.NewContext(cms, abci.Header{}, false, nil)
Expand Down
2 changes: 1 addition & 1 deletion examples/democoin/x/pow/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) {
db := dbm.NewMemDB()
capKey := sdk.NewKVStoreKey("capkey")
ms := store.NewCommitMultiStore(db)
ms.MountStoreWithDB(capKey, sdk.StoreTypeIAVL, db)
ms.MountStoreWithDB(capKey, db)
ms.LoadLatestVersion()

return ms, capKey
Expand Down
4 changes: 2 additions & 2 deletions examples/democoin/x/simplestake/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey, *sdk.KVStoreKey) {
authKey := sdk.NewKVStoreKey("authkey")
capKey := sdk.NewKVStoreKey("capkey")
ms := store.NewCommitMultiStore(db)
ms.MountStoreWithDB(capKey, sdk.StoreTypeIAVL, db)
ms.MountStoreWithDB(authKey, sdk.StoreTypeIAVL, db)
ms.MountStoreWithDB(capKey, db)
ms.MountStoreWithDB(authKey, db)
ms.LoadLatestVersion()
return ms, authKey, capKey
}
Expand Down
154 changes: 0 additions & 154 deletions server/mock/store.go

This file was deleted.

33 changes: 0 additions & 33 deletions server/mock/store_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion store/gas/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func newGasTank(limit types.Gas) *types.GasTank {
return types.NewGasTank(limit, types.DefaultGasConfig())
return types.NewGasTank(limit, types.DefaultKVGasConfig())
}

func newGasKVStore() types.KVStore {
Expand Down
8 changes: 7 additions & 1 deletion store/transient/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cosmos/cosmos-sdk/store/dbadapter"
)

var _ types.KVStore = (*Store)(nil)
var _ types.CommitKVStore = (*Store)(nil)

// transientStore is a wrapper for a MemDB with Commiter implementation
type Store struct {
Expand All @@ -21,6 +21,12 @@ func NewStore() *Store {
return &Store{dbadapter.Store{dbm.NewMemDB()}, new(types.GasTank)}
}

// Implements CommitKVStore
func (ts *Store) LoadKVStoreVersion(db dbm.DB, id types.CommitID) error {
*ts = *NewStore()
return nil
}

// Implements CommitStore
// Commit cleans up transientStore.
func (ts *Store) Commit() (id types.CommitID) {
Expand Down
2 changes: 1 addition & 1 deletion types/lib/linear_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type S struct {
func defaultComponents(key sdk.StoreKey) (sdk.Context, *codec.Codec) {
db := dbm.NewMemDB()
cms := store.NewCommitMultiStore(db)
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db)
cms.MountStoreWithDB(key, db)
cms.LoadLatestVersion()
ctx := sdk.NewContext(cms, abci.Header{}, false, log.NewNopLogger())
cdc := codec.New()
Expand Down
2 changes: 1 addition & 1 deletion x/bank/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) {
db := dbm.NewMemDB()
authKey := sdk.NewKVStoreKey("authkey")
ms := store.NewCommitMultiStore(db)
ms.MountStoreWithDB(authKey, sdk.StoreTypeIAVL, db)
ms.MountStoreWithDB(authKey, db)
ms.LoadLatestVersion()
return ms, authKey
}
Expand Down
2 changes: 1 addition & 1 deletion x/ibc/ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
func defaultContext(key sdk.StoreKey) sdk.Context {
db := dbm.NewMemDB()
cms := store.NewCommitMultiStore(db)
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db)
cms.MountStoreWithDB(key, db)
cms.LoadLatestVersion()
ctx := sdk.NewContext(cms, abci.Header{}, false, log.NewNopLogger())
return ctx
Expand Down

0 comments on commit 70c03b3

Please sign in to comment.