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

refactor: limit breaking changes for next version (backport #22972) #22974

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions client/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/testutil"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil/integration"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
"github.com/cosmos/cosmos-sdk/testutil/x/counter"
counterkeeper "github.com/cosmos/cosmos-sdk/testutil/x/counter/keeper"
Expand All @@ -38,7 +37,7 @@ func (s *IntegrationTestSuite) SetupSuite() {

logger := log.NewNopLogger()
keys := storetypes.NewKVStoreKeys(countertypes.StoreKey)
cms := integration.CreateMultiStore(keys, logger)
cms := moduletestutil.CreateMultiStore(keys, logger)
s.ctx = sdk.NewContext(cms, true, logger)
cfg := moduletestutil.MakeTestEncodingConfig(testutil.CodecOptions{}, counter.AppModule{})
s.cdc = cfg.Codec
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/distribution/migration_v4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/integration"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/auth"
Expand Down Expand Up @@ -75,7 +74,7 @@ func TestFundsMigration(t *testing.T) {
authtypes.StoreKey, banktypes.StoreKey, disttypes.StoreKey,
)
logger := log.NewTestLogger(t)
cms := integration.CreateMultiStore(keys, logger)
cms := moduletestutil.CreateMultiStore(keys, logger)
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, auth.AppModule{}, bank.AppModule{}, distribution.AppModule{})
ctx := sdk.NewContext(cms, true, logger)
addressCodec := addresscodec.NewBech32Codec(sdk.Bech32MainPrefix)
Expand Down
19 changes: 3 additions & 16 deletions testutil/integration/helpers.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
package integration

import (
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
)

// CreateMultiStore is a helper for setting up multiple stores for provided modules.
func CreateMultiStore(keys map[string]*storetypes.KVStoreKey, logger log.Logger) storetypes.CommitMultiStore {
db := coretesting.NewMemDB()
cms := store.NewCommitMultiStore(db, logger, metrics.NewNoOpMetrics())

for key := range keys {
cms.MountStoreWithDB(keys[key], storetypes.StoreTypeIAVL, db)
}

_ = cms.LoadLatestVersion()
return cms
}
// Deprecated: use github.com/cosmos/cosmos-sdk/types/module/testutil.CreateMultiStore instead.
var CreateMultiStore = moduletestutil.CreateMultiStore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package testutil

import (
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/testutil"
Expand Down Expand Up @@ -78,3 +84,16 @@ type TestTxBuilder struct {
func (b *TestTxBuilder) SetExtensionOptions(extOpts ...*types.Any) {
b.ExtOptions = extOpts
}

// CreateMultiStore is a helper for setting up multiple stores for provided modules.
func CreateMultiStore(keys map[string]*storetypes.KVStoreKey, logger log.Logger) storetypes.CommitMultiStore {
db := coretesting.NewMemDB()
cms := store.NewCommitMultiStore(db, logger, metrics.NewNoOpMetrics())

for key := range keys {
cms.MountStoreWithDB(keys[key], storetypes.StoreTypeIAVL, db)
}

_ = cms.LoadLatestVersion()
return cms
}
Loading