diff --git a/.github/scripts/check-compat.sh b/.github/scripts/check-compat.sh deleted file mode 100755 index 24b0efbad255..000000000000 --- a/.github/scripts/check-compat.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -if [ $# -lt 3 ]; then - echo "Usage: check-compat.sh [ ...]" - exit 1 -fi - -dir="tmp" -branch=$1 -simapp_version=$2 -shift 3 -go_mod_names=("$@") - -# clone cosmos-sdk -export FILTER_BRANCH_SQUELCH_WARNING=1 -git clone -b $branch --depth 1 https://github.com/cosmos/cosmos-sdk $dir - -# save last commit branch commit -COMMIT=$(git rev-parse HEAD) -# save the last main commit -latest_commit=$(git ls-remote https://github.com/cosmos/cosmos-sdk.git refs/heads/main | cut -f1 || "main") - -# if simapp_version is v2 then use simapp/v2 -if [ $simapp_version == "v2" ]; then - cd $dir/simapp/v2 -else - cd $dir/simapp -fi - -# bump all cosmos-sdk packages to latest branch commit -VERSIONS=$(go mod edit -json | jq -r '.Replace[].Old.Path') - -# Initialize variables for different types of replaces -BRANCH_REPLACES="" -MAIN_REPLACES="" -REQUIRES="" - -for version in $VERSIONS; do - if [[ " ${go_mod_names[@]} " =~ " ${version} " ]]; then - MAIN_REPLACES+=" -replace $version=$version@$latest_commit" - continue - elif [[ $version == "github.com/cosmos/cosmos-sdk"* || $version == "cosmossdk.io/"* ]]; then - BRANCH_REPLACES+=" -replace $version=$version@$COMMIT" - fi -done - -for mod in ${go_mod_names[@]}; do - REQUIRES+=" -require $mod@$latest_commit" -done - -# Apply the replaces -go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES - -go mod tidy - -# Test SimApp -go test -mod=readonly -v ./... \ No newline at end of file diff --git a/.github/workflows/software-compat-v052.yml b/.github/workflows/software-compat-v052.yml deleted file mode 100644 index 999f3a97a94c..000000000000 --- a/.github/workflows/software-compat-v052.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: SimApp (v2) v0.52 Integration with Main -on: - push: - branches: - - main - workflow_dispatch: -jobs: - compat: - name: Software Compat - runs-on: ubuntu-latest - steps: - - name: Check out source - uses: actions/checkout@v4 - with: - sparse-checkout: | - .github/scripts/check-compat.sh - sparse-checkout-cone-mode: false - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - - name: Test v052 with latest main - run: | - .github/scripts/check-compat.sh $BRANCH $SIMAPP_VERSION cosmossdk.io/runtime/v2 cosmossdk.io/server/v2 cosmossdk.io/store/v2 cosmossdk.io/server/v2/stf cosmossdk.io/server/v2/appmanager cosmossdk.io/api cosmossdk.io/store cosmossdk.io/core cosmossdk.io/core/testing - env: - BRANCH: release/v0.52.x - SIMAPP_VERSION: v1 - - name: Test v052 v2 with latest main - run: | - .github/scripts/check-compat.sh $BRANCH $SIMAPP_VERSION cosmossdk.io/runtime/v2 cosmossdk.io/server/v2 cosmossdk.io/store/v2 cosmossdk.io/server/v2/stf cosmossdk.io/server/v2/appmanager cosmossdk.io/api cosmossdk.io/store cosmossdk.io/core cosmossdk.io/core/testing - env: - BRANCH: release/v0.52.x - SIMAPP_VERSION: v2 - sims-notify-success: - needs: [compat] - runs-on: ubuntu-latest - if: ${{ success() }} - steps: - - uses: actions/checkout@v4 - - name: Get previous workflow status - uses: ./.github/actions/last-workflow-status - id: last_status - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Notify Slack on success - if: ${{ steps.last_status.outputs.last_status == 'failure' }} - uses: rtCamp/action-slack-notify@v2.3.2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: sdk-sims - SLACK_USERNAME: release/v0.52.x x main compat - SLACK_ICON_EMOJI: ":white_check_mark:" - SLACK_COLOR: good - SLACK_MESSAGE: Latest main x v0.52.x is compatible - SLACK_FOOTER: "" - - sims-notify-failure: - permissions: - contents: none - needs: [compat] - runs-on: ubuntu-latest - if: ${{ failure() }} - steps: - - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: sdk-sims - SLACK_USERNAME: release/v0.52.x x main compat - SLACK_ICON_EMOJI: ":skull:" - SLACK_COLOR: danger - SLACK_MESSAGE: Latest main x v0.52.x is breaking - SLACK_FOOTER: "" diff --git a/client/grpc_query_test.go b/client/grpc_query_test.go index d0d43a6d3023..8e32d8221d25 100644 --- a/client/grpc_query_test.go +++ b/client/grpc_query_test.go @@ -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" @@ -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 diff --git a/tests/integration/distribution/migration_v4_test.go b/tests/integration/distribution/migration_v4_test.go index 8da3a416a7aa..32884afcbb3e 100644 --- a/tests/integration/distribution/migration_v4_test.go +++ b/tests/integration/distribution/migration_v4_test.go @@ -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" @@ -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) diff --git a/testutil/integration/helpers.go b/testutil/integration/helpers.go index ea844c17411b..94bbdca35c58 100644 --- a/testutil/integration/helpers.go +++ b/testutil/integration/helpers.go @@ -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 diff --git a/types/module/testutil/codec.go b/types/module/testutil/helpers.go similarity index 81% rename from types/module/testutil/codec.go rename to types/module/testutil/helpers.go index 2250b1208555..3a0d3033579f 100644 --- a/types/module/testutil/codec.go +++ b/types/module/testutil/helpers.go @@ -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" @@ -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 +}