Skip to content

Commit

Permalink
testutil changess
Browse files Browse the repository at this point in the history
  • Loading branch information
vishal-kanna committed Nov 22, 2023
1 parent fa89e26 commit 72d82ba
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 41 deletions.
262 changes: 262 additions & 0 deletions go.sum

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions testutil/keeper/concensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package keeper
import (
"testing"

tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"cosmossdk.io/store"
dbm "github.com/cosmos/cosmos-db"

"cosmossdk.io/log"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/palomachain/paloma/x/consensus/keeper"
Expand All @@ -20,11 +22,11 @@ import (
func ConsensusKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
logger := log.NewNopLogger()

storeKey := sdk.NewKVStoreKey(types.StoreKey)
storeKey := storetypes.NewKVStoreKey(types.StoreKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)

db := tmdb.NewMemDB()
stateStore := store.NewCommitMultiStore(db)
db := dbm.NewMemDB()
stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
require.NoError(t, stateStore.LoadLatestVersion())
Expand Down
15 changes: 8 additions & 7 deletions testutil/keeper/evm.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package keeper

import (
tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/palomachain/paloma/x/evm/keeper"
Expand All @@ -16,11 +17,11 @@ import (
)

func EvmKeeper(t require.TestingT) (*keeper.Keeper, sdk.Context) {
storeKey := sdk.NewKVStoreKey(types.StoreKey)
storeKey := storetypes.NewKVStoreKey(types.StoreKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)

db := tmdb.NewMemDB()
stateStore := store.NewCommitMultiStore(db)
db := dbm.NewMemDB()
stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
require.NoError(t, stateStore.LoadLatestVersion())
Expand Down
13 changes: 7 additions & 6 deletions testutil/keeper/paloma.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package keeper
import (
"testing"

tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmdb "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/palomachain/paloma/x/paloma/keeper"
Expand All @@ -19,11 +20,11 @@ import (
)

func PalomaKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
storeKey := sdk.NewKVStoreKey(types.StoreKey)
storeKey := storetypes.NewKVStoreKey(types.StoreKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)

db := tmdb.NewMemDB()
stateStore := store.NewCommitMultiStore(db)
stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
require.NoError(t, stateStore.LoadLatestVersion())
Expand Down
13 changes: 7 additions & 6 deletions testutil/keeper/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package keeper
import (
"testing"

tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmdb "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/palomachain/paloma/x/scheduler/keeper"
Expand All @@ -20,11 +21,11 @@ import (
func SchedulerKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
logger := log.NewNopLogger()

storeKey := sdk.NewKVStoreKey(types.StoreKey)
storeKey := storetypes.NewKVStoreKey(types.StoreKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)

db := tmdb.NewMemDB()
stateStore := store.NewCommitMultiStore(db)
stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
require.NoError(t, stateStore.LoadLatestVersion())
Expand Down
13 changes: 7 additions & 6 deletions testutil/keeper/treasury.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package keeper
import (
"testing"

tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmdb "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/palomachain/paloma/x/treasury/keeper"
Expand All @@ -18,11 +19,11 @@ import (
)

func TreasuryKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
storeKey := sdk.NewKVStoreKey(types.StoreKey)
storeKey := storetypes.NewKVStoreKey(types.StoreKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)

db := tmdb.NewMemDB()
stateStore := store.NewCommitMultiStore(db)
stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
require.NoError(t, stateStore.LoadLatestVersion())
Expand Down
13 changes: 7 additions & 6 deletions testutil/keeper/valset.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package keeper
import (
"testing"

tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmdb "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/palomachain/paloma/x/valset/keeper"
Expand All @@ -19,11 +20,11 @@ import (
)

func ValsetKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
storeKey := sdk.NewKVStoreKey(types.StoreKey)
storeKey := storetypes.NewKVStoreKey(types.StoreKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)

db := tmdb.NewMemDB()
stateStore := store.NewCommitMultiStore(db)
stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
require.NoError(t, stateStore.LoadLatestVersion())
Expand Down
6 changes: 3 additions & 3 deletions testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"testing"
"time"

tmdb "github.com/cometbft/cometbft-db"
pruningtypes "cosmossdk.io/store/pruning/types"
tmrand "github.com/cometbft/cometbft/libs/rand"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types"
"github.com/cosmos/cosmos-sdk/testutil/network"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -58,7 +58,7 @@ func DefaultConfig() network.Config {
AppConstructor: func(val network.ValidatorI) servertypes.Application {
return app.New(
val.GetCtx().Logger,
tmdb.NewMemDB(),
dbm.NewMemDB(),
nil,
true,
encoding,
Expand Down

0 comments on commit 72d82ba

Please sign in to comment.