diff --git a/client/v2/go.mod b/client/v2/go.mod index d10e4f61e9b5..84c95f8ba246 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -35,7 +35,7 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v1.1.0 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.5.0 // indirect cosmossdk.io/math v1.5.0 @@ -164,10 +164,7 @@ require ( pgregory.net/rapid v1.1.0 // indirect ) -replace ( - cosmossdk.io/core/testing => ../../core/testing - github.com/cosmos/cosmos-sdk => ./../../ -) +replace github.com/cosmos/cosmos-sdk => ./../../ // TODO remove post spinning out all modules replace ( diff --git a/client/v2/go.sum b/client/v2/go.sum index 39e65f25d3bf..b1844b1cda4a 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/core/testing/CHANGELOG.md b/core/testing/CHANGELOG.md index 6c22238dae05..dd81668215fc 100644 --- a/core/testing/CHANGELOG.md +++ b/core/testing/CHANGELOG.md @@ -38,6 +38,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ > Testing suite for the core module. Should stay in 0ver. +## [v0.0.2](https://github.com/cosmos/cosmos-sdk/releases/tag/core/testing%2Fv0.0.2) + +* [#23396](https://github.com/cosmos/cosmos-sdk/pull/23396) Add branch service mock. + ## [v0.0.1](https://github.com/cosmos/cosmos-sdk/releases/tag/core/testing%2Fv0.0.1) * Initial tag. diff --git a/core/testing/branch.go b/core/testing/branch.go new file mode 100644 index 000000000000..68cdefac0e6b --- /dev/null +++ b/core/testing/branch.go @@ -0,0 +1,25 @@ +package coretesting + +import ( + "context" + + "cosmossdk.io/core/branch" +) + +var _ branch.Service = &TestBranchService{} + +type TestBranchService struct{} + +func (bs TestBranchService) Execute(ctx context.Context, f func(ctx context.Context) error) error { + unwrap(ctx) // check that this is a testing context + return f(ctx) +} + +func (bs TestBranchService) ExecuteWithGasLimit( + ctx context.Context, + gasLimit uint64, + f func(ctx context.Context) error, +) (gasUsed uint64, err error) { + unwrap(ctx) // check that this is a testing context + return gasLimit, f(ctx) +} diff --git a/core/testing/environment.go b/core/testing/environment.go index a89bbdb78f2d..ec4b56f83c42 100644 --- a/core/testing/environment.go +++ b/core/testing/environment.go @@ -33,7 +33,7 @@ func NewTestEnvironment(cfg TestEnvironmentConfig) (TestContext, TestEnvironment env := TestEnvironment{ Environment: appmodulev2.Environment{ Logger: cfg.Logger, - BranchService: nil, + BranchService: TestBranchService{}, EventService: testEventService, GasService: TestGasService{}, HeaderService: testHeaderService, diff --git a/go.mod b/go.mod index 4da146df09ce..1b14fc5e0330 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.5.0 diff --git a/go.sum b/go.sum index 110d587effd3..e0667e18ddfc 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index baa78b683483..7d6a9d7ffac4 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -41,7 +41,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/depinject v1.1.0 // indirect cosmossdk.io/math v1.5.0 // indirect cosmossdk.io/store v1.10.0-rc.1 // indirect diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index ae4f5077ed14..435c3aea7938 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index b2ecc18d3ba2..8bfdf237da67 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -63,7 +63,7 @@ require ( cloud.google.com/go/iam v1.3.1 // indirect cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/collections v1.1.0 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/errors/v2 v2.0.0 // indirect cosmossdk.io/server/v2/stf v1.0.0-beta.2 // indirect @@ -297,7 +297,6 @@ replace ( // server v2 integration replace ( - cosmossdk.io/core/testing => ../../core/testing cosmossdk.io/indexer/postgres => ../../indexer/postgres cosmossdk.io/runtime/v2 => ../../runtime/v2 cosmossdk.io/server/v2 => ../../server/v2 diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index 66d1d15a9b6e..2260e27da70b 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -616,6 +616,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/tests/go.mod b/tests/go.mod index 082c15e14f3e..61ca864a6275 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/log v1.5.0 cosmossdk.io/math v1.5.0 diff --git a/tests/integration/bank/app_test.go b/tests/integration/bank/app_test.go index bc6cbf6d8a5c..c531a3901fab 100644 --- a/tests/integration/bank/app_test.go +++ b/tests/integration/bank/app_test.go @@ -106,9 +106,16 @@ func createTestSuite(t *testing.T, genesisAccounts []authtypes.GenesisAccount) s ), depinject.Supply(log.NewNopLogger()), ), - startupCfg, &res.BankKeeper, &res.AccountKeeper, &res.DistributionKeeper, &res.TxConfig) + startupCfg, + &res.BankKeeper, + &res.AccountKeeper, + &res.DistributionKeeper, + &res.TxConfig, + ) res.App = app + res.App.SetTxEncoder(res.TxConfig.TxEncoder()) + res.App.SetTxDecoder(res.TxConfig.TxDecoder()) require.NoError(t, err) return res diff --git a/tests/integration/baseapp/block_gas_test.go b/tests/integration/baseapp/block_gas_test.go index e5ba5bf55e2a..4ceb23a97cbc 100644 --- a/tests/integration/baseapp/block_gas_test.go +++ b/tests/integration/baseapp/block_gas_test.go @@ -103,6 +103,9 @@ func TestBaseApp_BlockGas(t *testing.T) { require.NoError(t, err) bapp := appBuilder.Build(coretesting.NewMemDB(), nil) + bapp.SetTxEncoder(txConfig.TxEncoder()) + bapp.SetTxDecoder(txConfig.TxDecoder()) + err = bapp.Load(true) require.NoError(t, err) diff --git a/tools/benchmark/go.mod b/tools/benchmark/go.mod index c1570ddb2997..fa34b466d731 100644 --- a/tools/benchmark/go.mod +++ b/tools/benchmark/go.mod @@ -20,7 +20,7 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v1.1.0 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/math v1.5.0 // indirect cosmossdk.io/schema v1.0.0 // indirect diff --git a/tools/benchmark/go.sum b/tools/benchmark/go.sum index 2602ee2f1105..dc3a2d3abac7 100644 --- a/tools/benchmark/go.sum +++ b/tools/benchmark/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index ab121334b292..6f505f8bc60d 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -19,7 +19,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.5.0 // indirect cosmossdk.io/math v1.5.0 // indirect diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index fdbe2f6eb865..1b067811e84a 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -28,7 +28,7 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/api v0.8.2 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/depinject v1.1.0 // indirect cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.5.0 diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 2602ee2f1105..dc3a2d3abac7 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 0194c0bea59c..63d2798a9600 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -19,7 +19,7 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/api v0.8.2 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/depinject v1.1.0 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.5.0 // indirect diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index b9620a21680d..6c14e72b5ebf 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/tx v1.1.0 @@ -164,10 +164,7 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -replace ( - cosmossdk.io/core/testing => ../../core/testing - github.com/cosmos/cosmos-sdk => ../../. -) +replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( diff --git a/x/accounts/go.sum b/x/accounts/go.sum index ae06fa5ddae6..582b1a6652fe 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/auth/ante/testutil_test.go b/x/auth/ante/testutil_test.go index b9af2bb77694..954fa5c78fda 100644 --- a/x/auth/ante/testutil_test.go +++ b/x/auth/ante/testutil_test.go @@ -20,7 +20,6 @@ import ( storetypes "cosmossdk.io/store/types" txsigning "cosmossdk.io/x/tx/signing" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" @@ -99,14 +98,11 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite { "random": {"random"}, } - msgRouter := baseapp.NewMsgServiceRouter() - grpcQueryRouter := baseapp.NewGRPCQueryRouter() - grpcQueryRouter.SetInterfaceRegistry(suite.encCfg.InterfaceRegistry) - suite.consensusKeeper = antetestutil.NewMockConsensusKeeper(ctrl) suite.consensusKeeper.EXPECT().BlockParams(gomock.Any()).Return(uint64(simtestutil.DefaultConsensusParams.Block.MaxGas), uint64(simtestutil.DefaultConsensusParams.Block.MaxBytes), nil).AnyTimes() - suite.env = runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger(), runtime.EnvWithQueryRouterService(grpcQueryRouter), runtime.EnvWithMsgRouterService(msgRouter)) + suite.env = runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) + suite.accountKeeper = keeper.NewAccountKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()), suite.encCfg.Codec, types.ProtoBaseAccount, suite.acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"), sdk.Bech32MainPrefix, types.NewModuleAddress("gov").String(), diff --git a/x/auth/keeper/deterministic_test.go b/x/auth/keeper/deterministic_test.go index 6bf1a034b0f7..526979861540 100644 --- a/x/auth/keeper/deterministic_test.go +++ b/x/auth/keeper/deterministic_test.go @@ -14,9 +14,10 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/core/testing/queryclient" storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/runtime" @@ -36,7 +37,6 @@ type DeterministicTestSuite struct { accountNumberLanes uint64 - key *storetypes.KVStoreKey environment appmodule.Environment ctx sdk.Context queryClient types.QueryClient @@ -97,11 +97,10 @@ func (suite *DeterministicTestSuite) SetupTest() { types.NewModuleAddress("gov").String(), ) - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.encCfg.InterfaceRegistry) + queryHelper := queryclient.NewQueryHelper(codec.NewProtoCodec(suite.encCfg.InterfaceRegistry).GRPCCodec()) types.RegisterQueryServer(queryHelper, keeper.NewQueryServer(suite.accountKeeper)) suite.queryClient = types.NewQueryClient(queryHelper) - suite.key = key suite.environment = env suite.maccPerms = maccPerms suite.accountNumberLanes = 1 @@ -261,13 +260,13 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccountInfo() { } func (suite *DeterministicTestSuite) createAndReturnQueryClient(ak keeper.AccountKeeper) types.QueryClient { - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.encCfg.InterfaceRegistry) + queryHelper := queryclient.NewQueryHelper(codec.NewProtoCodec(suite.encCfg.InterfaceRegistry).GRPCCodec()) types.RegisterQueryServer(queryHelper, keeper.NewQueryServer(ak)) return types.NewQueryClient(queryHelper) } func (suite *DeterministicTestSuite) setModuleAccounts( - ctx sdk.Context, ak keeper.AccountKeeper, maccs []string, + ctx context.Context, ak keeper.AccountKeeper, maccs []string, ) []sdk.AccountI { sort.Strings(maccs) moduleAccounts := make([]sdk.AccountI, 0, len(maccs)) diff --git a/x/auth/keeper/grpc_query_test.go b/x/auth/keeper/grpc_query_test.go index f2f820dc96cf..ba9adb740332 100644 --- a/x/auth/keeper/grpc_query_test.go +++ b/x/auth/keeper/grpc_query_test.go @@ -509,7 +509,7 @@ func (suite *KeeperTestSuite) TestQueryAccountInfo() { suite.Require().NoError(acc.SetSequence(10)) suite.accountKeeper.SetAccount(suite.ctx, acc) - res, err := suite.queryClient.AccountInfo(context.Background(), &types.QueryAccountInfoRequest{ + res, err := suite.queryClient.AccountInfo(suite.ctx, &types.QueryAccountInfoRequest{ Address: addr.String(), }) @@ -528,7 +528,7 @@ func (suite *KeeperTestSuite) TestQueryAccountInfoWithoutPubKey() { acc := suite.accountKeeper.NewAccountWithAddress(suite.ctx, addr) suite.accountKeeper.SetAccount(suite.ctx, acc) - res, err := suite.queryClient.AccountInfo(context.Background(), &types.QueryAccountInfoRequest{ + res, err := suite.queryClient.AccountInfo(suite.ctx, &types.QueryAccountInfoRequest{ Address: addr.String(), }) diff --git a/x/auth/keeper/keeper_test.go b/x/auth/keeper/keeper_test.go index 0aa0a51c7dd2..3998c8974bc0 100644 --- a/x/auth/keeper/keeper_test.go +++ b/x/auth/keeper/keeper_test.go @@ -9,16 +9,13 @@ import ( "github.com/stretchr/testify/suite" "go.uber.org/mock/gomock" - "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" - storetypes "cosmossdk.io/store/types" + "cosmossdk.io/core/testing/queryclient" - "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/x/auth" @@ -42,7 +39,7 @@ var ( type KeeperTestSuite struct { suite.Suite - ctx sdk.Context + ctx context.Context queryClient types.QueryClient accountKeeper keeper.AccountKeeper @@ -54,11 +51,11 @@ type KeeperTestSuite struct { func (suite *KeeperTestSuite) SetupTest() { suite.encCfg = moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, auth.AppModule{}) - key := storetypes.NewKVStoreKey(types.StoreKey) - storeService := runtime.NewKVStoreService(key) - env := runtime.NewEnvironment(storeService, coretesting.NewNopLogger()) - testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) - suite.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{}) + ctx, env := coretesting.NewTestEnvironment(coretesting.TestEnvironmentConfig{ + ModuleName: types.ModuleName, + Logger: coretesting.NewNopLogger(), + }) + suite.ctx = ctx // gomock initializations ctrl := gomock.NewController(suite.T()) @@ -81,7 +78,7 @@ func (suite *KeeperTestSuite) SetupTest() { } suite.accountKeeper = keeper.NewAccountKeeper( - env, + env.Environment, suite.encCfg.Codec, types.ProtoBaseAccount, acctsModKeeper, @@ -91,7 +88,7 @@ func (suite *KeeperTestSuite) SetupTest() { types.NewModuleAddress("gov").String(), ) suite.msgServer = keeper.NewMsgServerImpl(suite.accountKeeper) - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.encCfg.InterfaceRegistry) + queryHelper := queryclient.NewQueryHelper(codec.NewProtoCodec(suite.encCfg.InterfaceRegistry).GRPCCodec()) types.RegisterQueryServer(queryHelper, keeper.NewQueryServer(suite.accountKeeper)) suite.queryClient = types.NewQueryClient(queryHelper) } diff --git a/x/authz/go.mod b/x/authz/go.mod index ff9c685e97dd..2ba22d7bfdf9 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -149,7 +149,7 @@ require ( ) require ( - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 ) @@ -167,10 +167,7 @@ require ( golang.org/x/arch v0.13.0 // indirect ) -replace ( - cosmossdk.io/core/testing => ../../core/testing - github.com/cosmos/cosmos-sdk => ../../ -) +replace github.com/cosmos/cosmos-sdk => ../../ // TODO remove post spinning out all modules replace ( diff --git a/x/authz/go.sum b/x/authz/go.sum index ae06fa5ddae6..582b1a6652fe 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/bank/go.mod b/x/bank/go.mod index 1e5113a25d43..7014bf8dc287 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -30,7 +30,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v1.1.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect @@ -164,10 +164,7 @@ require ( golang.org/x/arch v0.13.0 // indirect ) -replace ( - cosmossdk.io/core/testing => ../../core/testing - github.com/cosmos/cosmos-sdk => ../../. -) +replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace cosmossdk.io/x/staking => ../staking diff --git a/x/bank/go.sum b/x/bank/go.sum index ae06fa5ddae6..582b1a6652fe 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 5ce8e9984674..6abd90b0b3cc 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/schema v1.0.0 diff --git a/x/circuit/go.sum b/x/circuit/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/consensus/go.mod b/x/consensus/go.mod index f364bfd5e578..474b302c188a 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/schema v1.0.0 cosmossdk.io/store v1.10.0-rc.1 diff --git a/x/consensus/go.sum b/x/consensus/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 5f11324ef310..396e34d20dd7 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.5.0 diff --git a/x/distribution/go.sum b/x/distribution/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/epochs/go.mod b/x/epochs/go.mod index 142334b31c58..9eb4c2d9b7e0 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/store v1.10.0-rc.1 diff --git a/x/epochs/go.sum b/x/epochs/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index e26afef26c6b..ffa2995dbaca 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.5.0 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index e9500bfc8777..9e0f0a4a15cb 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.5.0 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 9b324eef02da..b1844b1cda4a 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/gov/go.mod b/x/gov/go.mod index 0d909088f34b..65f8608a2b69 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/client/v2 v2.0.0-beta.6 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.5.0 @@ -171,10 +171,7 @@ require ( golang.org/x/arch v0.13.0 // indirect ) -replace ( - cosmossdk.io/core/testing => ../../core/testing - github.com/cosmos/cosmos-sdk => ../../ -) +replace github.com/cosmos/cosmos-sdk => ../../ // TODO remove post spinning out all modules replace ( diff --git a/x/gov/go.sum b/x/gov/go.sum index 39e65f25d3bf..b1844b1cda4a 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/group/go.mod b/x/group/go.mod index 6b5c49aa998f..42fc642114cf 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -32,7 +32,7 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v1.1.0 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/schema v1.0.0 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v1.1.0 // indirect @@ -165,10 +165,7 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -replace ( - cosmossdk.io/core/testing => ../../core/testing - github.com/cosmos/cosmos-sdk => ../../ -) +replace github.com/cosmos/cosmos-sdk => ../../ // TODO remove post spinning out all modules replace ( diff --git a/x/group/go.sum b/x/group/go.sum index 1c0845a6c2ba..a8026766da39 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/mint/go.mod b/x/mint/go.mod index 1bed67e78d92..d63b5c465fb2 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.5.0 diff --git a/x/mint/go.sum b/x/mint/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/nft/go.mod b/x/nft/go.mod index 41e5630574eb..29e7a8d6082d 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -25,7 +25,7 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v1.1.0 // indirect - cosmossdk.io/core/testing v0.0.1 // indirect + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 // indirect cosmossdk.io/schema v1.0.0 // indirect cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index d30252385fcc..f415bbc55c7f 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.5.0 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 9c4373a19575..b1ffe2a1d04e 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.5.0 diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 78e0e028c00f..1987adecaa0e 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/staking/go.mod b/x/staking/go.mod index 72180a1704ef..279e0251387b 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.8.2 cosmossdk.io/collections v1.1.0 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.5.0 diff --git a/x/staking/go.sum b/x/staking/go.sum index e2f6d5f653c0..582b1a6652fe 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -10,8 +10,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index e9eb31a8214d..6c8e31b9c006 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -5,7 +5,7 @@ go 1.23.5 require ( cosmossdk.io/api v0.8.2 cosmossdk.io/core v1.0.0 - cosmossdk.io/core/testing v0.0.1 + cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.5.0 @@ -13,7 +13,6 @@ require ( cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a cosmossdk.io/x/tx v1.1.0 github.com/cometbft/cometbft v1.0.1 - github.com/cometbft/cometbft/api v1.0.0 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 @@ -70,6 +69,7 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v1.0.1 // indirect + github.com/cometbft/cometbft/api v1.0.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/iavl v1.3.4 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 13fc335e07c8..145bea234276 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -616,8 +616,8 @@ cosmossdk.io/collections v1.1.0 h1:UgfDUtQbRcA6uTrwd4Z6lhxMWhHPUTneXCHkWztyvMM= cosmossdk.io/collections v1.1.0/go.mod h1:D2iuLsFTDseILML+2rCnWIRFyFgl5cyveZ6kNTQALd4= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47 h1:JTOj8GWWGSYeNMFFi2K4muXsZjAUZ2G5JxxEL+rX2WA= +cosmossdk.io/core/testing v0.0.2-0.20250203133933-bc60d1009f47/go.mod h1:6Y3QaoNXsgeHiV4+9oYF/IqMFqCK5cJClonw/OXxHlY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/upgrade/keeper/abci_test.go b/x/upgrade/keeper/abci_test.go index 41cf9ebe94ed..69589d264ec7 100644 --- a/x/upgrade/keeper/abci_test.go +++ b/x/upgrade/keeper/abci_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" @@ -15,19 +14,13 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/core/server" coretesting "cosmossdk.io/core/testing" - "cosmossdk.io/log" - storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/upgrade" "cosmossdk.io/x/upgrade/keeper" upgradetestutil "cosmossdk.io/x/upgrade/testutil" "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/baseapp" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -38,21 +31,68 @@ const govModuleName = "gov" type TestSuite struct { preModule appmodule.HasPreBlocker keeper *keeper.Keeper - ctx sdk.Context - baseApp *baseapp.BaseApp encCfg moduletestutil.TestEncodingConfig - key storetypes.StoreKey - env appmodule.Environment + ctx coretesting.TestContext + env coretesting.TestEnvironment +} + +func setupTest(t *testing.T, height int64, skip map[int64]bool) *TestSuite { + t.Helper() + s := TestSuite{} + s.encCfg = moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, upgrade.AppModule{}) + + ctx, env := coretesting.NewTestEnvironment(coretesting.TestEnvironmentConfig{ + ModuleName: types.ModuleName, + Logger: coretesting.NewNopLogger(), + }) + + s.ctx = ctx.WithHeaderInfo(header.Info{Time: time.Now(), Height: height}) + s.env = env + + authority, err := addresscodec.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(govModuleName)) + require.NoError(t, err) + + ctrl := gomock.NewController(t) + ck := upgradetestutil.NewMockConsensusKeeper(ctrl) + s.keeper = keeper.NewKeeper( + s.env.Environment, + skip, + s.encCfg.Codec, + t.TempDir(), + newMockedVersionModifier(1), + authority, + ck) + + s.preModule = upgrade.NewAppModule(s.keeper) + return &s +} + +func newMockedVersionModifier(startingVersion uint64) server.VersionModifier { + return &mockedVersionModifier{version: startingVersion} +} + +type mockedVersionModifier struct { + version uint64 +} + +func (m *mockedVersionModifier) SetAppVersion(_ context.Context, u uint64) error { + m.version = u + return nil +} + +func (m *mockedVersionModifier) AppVersion(_ context.Context) (uint64, error) { + return m.version, nil } func (s *TestSuite) VerifyDoUpgrade(t *testing.T) { t.Helper() t.Log("Verify that a panic happens at the upgrade height") - newCtx := s.ctx.WithHeaderInfo(header.Info{Height: s.ctx.HeaderInfo().Height + 1, Time: time.Now()}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + newCtx := s.ctx.WithHeaderInfo(header.Info{Height: height + 1, Time: time.Now()}) err := s.preModule.PreBlock(newCtx) - require.ErrorContains(t, err, "UPGRADE \"test\" NEEDED at height: 11: ") + require.ErrorContains(t, err, "UPGRADE \"test\" NEEDED at height:") t.Log("Verify that the upgrade can be successfully applied with a handler") s.keeper.SetUpgradeHandler("test", func(ctx context.Context, plan types.Plan, vm appmodule.VersionMap) (appmodule.VersionMap, error) { @@ -65,7 +105,7 @@ func (s *TestSuite) VerifyDoUpgrade(t *testing.T) { s.VerifyCleared(t, newCtx) } -func (s *TestSuite) VerifyDoUpgradeWithCtx(t *testing.T, newCtx sdk.Context, proposalName string) { +func (s *TestSuite) VerifyDoUpgradeWithCtx(t *testing.T, newCtx context.Context, proposalName string) { t.Helper() t.Log("Verify that a panic happens at the upgrade height") @@ -83,14 +123,14 @@ func (s *TestSuite) VerifyDoUpgradeWithCtx(t *testing.T, newCtx sdk.Context, pro s.VerifyCleared(t, newCtx) } -func (s *TestSuite) VerifyCleared(t *testing.T, newCtx sdk.Context) { +func (s *TestSuite) VerifyCleared(t *testing.T, newCtx context.Context) { t.Helper() t.Log("Verify that the upgrade plan has been cleared") _, err := s.keeper.GetUpgradePlan(newCtx) require.ErrorIs(t, err, types.ErrNoUpgradePlanFound) } -func (s *TestSuite) VerifyNotDone(t *testing.T, newCtx sdk.Context, name string) { +func (s *TestSuite) VerifyNotDone(t *testing.T, newCtx context.Context, name string) { t.Helper() t.Log("Verify that upgrade was not done") height, err := s.keeper.GetDoneHeight(newCtx, name) @@ -98,7 +138,7 @@ func (s *TestSuite) VerifyNotDone(t *testing.T, newCtx sdk.Context, name string) require.NoError(t, err) } -func (s *TestSuite) VerifyDone(t *testing.T, newCtx sdk.Context, name string) { +func (s *TestSuite) VerifyDone(t *testing.T, newCtx context.Context, name string) { t.Helper() t.Log("Verify that the upgrade plan has been executed") height, err := s.keeper.GetDoneHeight(newCtx, name) @@ -115,61 +155,10 @@ func (s *TestSuite) VerifySet(t *testing.T, skipUpgradeHeights map[int64]bool) { } } -func setupTest(t *testing.T, height int64, skip map[int64]bool) *TestSuite { - t.Helper() - key := storetypes.NewKVStoreKey(types.StoreKey) - s := TestSuite{ - key: key, - } - s.encCfg = moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, upgrade.AppModule{}) - - testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) - s.baseApp = baseapp.NewBaseApp( - "upgrade", - log.NewNopLogger(), - testCtx.DB, - s.encCfg.TxConfig.TxDecoder(), - ) - - storeService := runtime.NewKVStoreService(key) - s.env = runtime.NewEnvironment(storeService, coretesting.NewNopLogger(), runtime.EnvWithMsgRouterService(s.baseApp.MsgServiceRouter()), runtime.EnvWithQueryRouterService(s.baseApp.GRPCQueryRouter())) - - s.baseApp.SetParamStore(¶mStore{params: cmtproto.ConsensusParams{Version: &cmtproto.VersionParams{App: 1}}}) - s.baseApp.SetVersionModifier(newMockedVersionModifier(1)) - - authority, err := addresscodec.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(govModuleName)) - require.NoError(t, err) - - ctrl := gomock.NewController(t) - ck := upgradetestutil.NewMockConsensusKeeper(ctrl) - s.keeper = keeper.NewKeeper(s.env, skip, s.encCfg.Codec, t.TempDir(), s.baseApp, authority, ck) - - s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now(), Height: height}) - - s.preModule = upgrade.NewAppModule(s.keeper) - return &s -} - -func newMockedVersionModifier(startingVersion uint64) server.VersionModifier { - return &mockedVersionModifier{version: startingVersion} -} - -type mockedVersionModifier struct { - version uint64 -} - -func (m *mockedVersionModifier) SetAppVersion(ctx context.Context, u uint64) error { - m.version = u - return nil -} - -func (m *mockedVersionModifier) AppVersion(ctx context.Context) (uint64, error) { - return m.version, nil -} - func TestRequireFutureBlock(t *testing.T) { s := setupTest(t, 10, map[int64]bool{}) - err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: s.ctx.HeaderInfo().Height - 1}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: height - 1}) require.Error(t, err) require.True(t, errors.Is(err, sdkerrors.ErrInvalidRequest), err) } @@ -177,7 +166,8 @@ func TestRequireFutureBlock(t *testing.T) { func TestDoHeightUpgrade(t *testing.T) { s := setupTest(t, 10, map[int64]bool{}) t.Log("Verify can schedule an upgrade") - err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: s.ctx.HeaderInfo().Height + 1}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: height + 1}) require.NoError(t, err) s.VerifyDoUpgrade(t) @@ -186,9 +176,10 @@ func TestDoHeightUpgrade(t *testing.T) { func TestCanOverwriteScheduleUpgrade(t *testing.T) { s := setupTest(t, 10, map[int64]bool{}) t.Log("Can overwrite plan") - err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "bad_test", Height: s.ctx.HeaderInfo().Height + 10}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "bad_test", Height: height + 10}) require.NoError(t, err) - err = s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: s.ctx.HeaderInfo().Height + 1}) + err = s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: height + 1}) require.NoError(t, err) s.VerifyDoUpgrade(t) @@ -203,13 +194,14 @@ func TestHaltIfTooNew(t *testing.T) { return vm, nil }) - newCtx := s.ctx.WithHeaderInfo(header.Info{Height: s.ctx.HeaderInfo().Height + 1, Time: time.Now()}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + newCtx := s.ctx.WithHeaderInfo(header.Info{Height: height + 1, Time: time.Now()}) err := s.preModule.PreBlock(newCtx) require.NoError(t, err) require.Equal(t, 0, called) t.Log("Verify we error if we have a registered handler ahead of time") - err = s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "future", Height: s.ctx.HeaderInfo().Height + 3}) + err = s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "future", Height: height + 3}) require.NoError(t, err) err = s.preModule.PreBlock(newCtx) require.EqualError(t, err, "BINARY UPDATED BEFORE TRIGGER! UPGRADE \"future\" - in binary but not executed on chain. Downgrade your binary") @@ -217,7 +209,7 @@ func TestHaltIfTooNew(t *testing.T) { t.Log("Verify we no longer panic if the plan is on time") - futCtx := s.ctx.WithHeaderInfo(header.Info{Height: s.ctx.HeaderInfo().Height + 3, Time: time.Now()}) + futCtx := s.ctx.WithHeaderInfo(header.Info{Height: height + 3, Time: time.Now()}) err = s.preModule.PreBlock(futCtx) require.NoError(t, err) require.Equal(t, 1, called) @@ -228,7 +220,8 @@ func TestHaltIfTooNew(t *testing.T) { func TestCanClear(t *testing.T) { s := setupTest(t, 10, map[int64]bool{}) t.Log("Verify upgrade is scheduled") - err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: s.ctx.HeaderInfo().Height + 100}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: height + 100}) require.NoError(t, err) err = s.keeper.ClearUpgradePlan(s.ctx) @@ -239,7 +232,7 @@ func TestCanClear(t *testing.T) { func TestCantApplySameUpgradeTwice(t *testing.T) { s := setupTest(t, 10, map[int64]bool{}) - height := s.ctx.HeaderInfo().Height + 1 + height := s.env.HeaderService().HeaderInfo(s.ctx).Height err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: height}) require.NoError(t, err) s.VerifyDoUpgrade(t) @@ -382,8 +375,9 @@ func TestUpgradeSkippingOnlyTwo(t *testing.T) { func TestUpgradeWithoutSkip(t *testing.T) { s := setupTest(t, 10, map[int64]bool{}) - newCtx := s.ctx.WithHeaderInfo(header.Info{Height: s.ctx.HeaderInfo().Height + 1, Time: time.Now()}) - err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: s.ctx.HeaderInfo().Height + 1}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + newCtx := s.ctx.WithHeaderInfo(header.Info{Height: height + 1, Time: time.Now()}) + err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test", Height: height + 1}) require.NoError(t, err) t.Log("Verify if upgrade happens without skip upgrade") err = s.preModule.PreBlock(newCtx) @@ -395,33 +389,33 @@ func TestUpgradeWithoutSkip(t *testing.T) { func TestDumpUpgradeInfoToFile(t *testing.T) { s := setupTest(t, 10, map[int64]bool{}) - require := require.New(t) // require no error when the upgrade info file does not exist _, err := s.keeper.ReadUpgradeInfoFromDisk() - require.NoError(err) + require.NoError(t, err) - planHeight := s.ctx.HeaderInfo().Height + 1 + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + planHeight := height + 1 plan := types.Plan{ Name: "test", Height: 0, // this should be overwritten by DumpUpgradeInfoToFile } t.Log("verify if upgrade height is dumped to file") err = s.keeper.DumpUpgradeInfoToDisk(planHeight, plan) - require.Nil(err) + require.Nil(t, err) upgradeInfo, err := s.keeper.ReadUpgradeInfoFromDisk() - require.NoError(err) + require.NoError(t, err) t.Log("Verify upgrade height from file matches ") - require.Equal(upgradeInfo.Height, planHeight) - require.Equal(upgradeInfo.Name, plan.Name) + require.Equal(t, upgradeInfo.Height, planHeight) + require.Equal(t, upgradeInfo.Name, plan.Name) // clear the test file upgradeInfoFilePath, err := s.keeper.GetUpgradeInfoPath() - require.Nil(err) + require.Nil(t, err) err = os.Remove(upgradeInfoFilePath) - require.Nil(err) + require.Nil(t, err) } // TODO: add testcase to for `no upgrade handler is present for last applied upgrade`. @@ -431,24 +425,25 @@ func TestBinaryVersion(t *testing.T) { testCases := []struct { name string - preRun func() sdk.Context + preRun func() context.Context expectError bool }{ { "test not panic: no scheduled upgrade or applied upgrade is present", - func() sdk.Context { + func() context.Context { return s.ctx }, false, }, { "test not panic: upgrade handler is present for last applied upgrade", - func() sdk.Context { + func() context.Context { s.keeper.SetUpgradeHandler("test0", func(_ context.Context, _ types.Plan, vm appmodule.VersionMap) (appmodule.VersionMap, error) { return vm, nil }) - err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test0", Height: s.ctx.HeaderInfo().Height + 2}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test0", Height: height + 2}) require.NoError(t, err) newCtx := s.ctx.WithHeaderInfo(header.Info{Height: 12}) @@ -463,7 +458,7 @@ func TestBinaryVersion(t *testing.T) { }, { "test panic: upgrade needed", - func() sdk.Context { + func() context.Context { err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: "test2", Height: 13}) require.NoError(t, err) @@ -490,9 +485,10 @@ func TestDowngradeVerification(t *testing.T) { // submit a plan. planName := "downgrade" - err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: planName, Height: s.ctx.HeaderInfo().Height + 1}) + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + err := s.keeper.ScheduleUpgrade(s.ctx, types.Plan{Name: planName, Height: height + 1}) require.NoError(t, err) - s.ctx = s.ctx.WithHeaderInfo(header.Info{Height: s.ctx.HeaderInfo().Height + 1}) + s.ctx = s.ctx.WithHeaderInfo(header.Info{Height: height + 1}) // set the handler. s.keeper.SetUpgradeHandler(planName, func(_ context.Context, _ types.Plan, vm appmodule.VersionMap) (appmodule.VersionMap, error) { @@ -502,22 +498,25 @@ func TestDowngradeVerification(t *testing.T) { // successful upgrade. err = s.preModule.PreBlock(s.ctx) require.NoError(t, err) - s.ctx = s.ctx.WithHeaderInfo(header.Info{Height: s.ctx.HeaderInfo().Height + 1}) + + height = s.env.HeaderService().HeaderInfo(s.ctx).Height + s.ctx = s.ctx.WithHeaderInfo(header.Info{Height: height + 1}) testCases := map[string]struct { - preRun func(*keeper.Keeper, sdk.Context, string) + preRun func(*keeper.Keeper, context.Context, string) expectError bool }{ "valid binary": { - preRun: func(k *keeper.Keeper, ctx sdk.Context, name string) { + preRun: func(k *keeper.Keeper, ctx context.Context, name string) { k.SetUpgradeHandler(planName, func(ctx context.Context, plan types.Plan, vm appmodule.VersionMap) (appmodule.VersionMap, error) { return vm, nil }) }, }, "downgrade with an active plan": { - preRun: func(k *keeper.Keeper, ctx sdk.Context, name string) { - err := k.ScheduleUpgrade(ctx, types.Plan{Name: "another" + planName, Height: ctx.HeaderInfo().Height + 1}) + preRun: func(k *keeper.Keeper, ctx context.Context, name string) { + height := s.env.HeaderService().HeaderInfo(s.ctx).Height + err := k.ScheduleUpgrade(ctx, types.Plan{Name: "another" + planName, Height: height + 1}) require.NoError(t, err, name) }, expectError: true, @@ -528,7 +527,7 @@ func TestDowngradeVerification(t *testing.T) { } for name, tc := range testCases { - ctx, _ := s.ctx.CacheContext() + ctx := s.ctx authority, err := addresscodec.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(govModuleName)) require.NoError(t, err) @@ -537,7 +536,7 @@ func TestDowngradeVerification(t *testing.T) { // downgrade. now keeper does not have the handler. ck := upgradetestutil.NewMockConsensusKeeper(ctrl) ck.EXPECT().AppVersion(gomock.Any()).Return(uint64(0), nil).AnyTimes() - k := keeper.NewKeeper(s.env, map[int64]bool{}, s.encCfg.Codec, t.TempDir(), nil, authority, ck) + k := keeper.NewKeeper(s.env.Environment, map[int64]bool{}, s.encCfg.Codec, t.TempDir(), nil, authority, ck) m := upgrade.NewAppModule(k) // assertions diff --git a/x/upgrade/keeper/grpc_query_test.go b/x/upgrade/keeper/grpc_query_test.go index 2f6b2e4b301d..cb0fd2efce6f 100644 --- a/x/upgrade/keeper/grpc_query_test.go +++ b/x/upgrade/keeper/grpc_query_test.go @@ -11,18 +11,15 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" - storetypes "cosmossdk.io/store/types" + "cosmossdk.io/core/testing/queryclient" "cosmossdk.io/x/upgrade" "cosmossdk.io/x/upgrade/keeper" upgradetestutil "cosmossdk.io/x/upgrade/testutil" "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -31,7 +28,8 @@ type UpgradeTestSuite struct { suite.Suite upgradeKeeper *keeper.Keeper - ctx sdk.Context + ctx coretesting.TestContext + env coretesting.TestEnvironment queryClient types.QueryClient encCfg moduletestutil.TestEncodingConfig encodedAuthority string @@ -39,11 +37,14 @@ type UpgradeTestSuite struct { func (suite *UpgradeTestSuite) SetupTest() { suite.encCfg = moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, upgrade.AppModule{}) - key := storetypes.NewKVStoreKey(types.StoreKey) - storeService := runtime.NewKVStoreService(key) - env := runtime.NewEnvironment(storeService, coretesting.NewNopLogger()) - testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) - suite.ctx = testCtx.Ctx + + ctx, env := coretesting.NewTestEnvironment(coretesting.TestEnvironmentConfig{ + ModuleName: types.ModuleName, + Logger: coretesting.NewNopLogger(), + }) + + suite.ctx = ctx + suite.env = env skipUpgradeHeights := make(map[int64]bool) authority, err := addresscodec.NewBech32Codec("cosmos").BytesToString(authtypes.NewModuleAddress(types.GovModuleName)) @@ -51,12 +52,12 @@ func (suite *UpgradeTestSuite) SetupTest() { suite.encodedAuthority = authority ctrl := gomock.NewController(suite.T()) ck := upgradetestutil.NewMockConsensusKeeper(ctrl) - suite.upgradeKeeper = keeper.NewKeeper(env, skipUpgradeHeights, suite.encCfg.Codec, suite.T().TempDir(), nil, authority, ck) + suite.upgradeKeeper = keeper.NewKeeper(suite.env.Environment, skipUpgradeHeights, suite.encCfg.Codec, suite.T().TempDir(), nil, authority, ck) err = suite.upgradeKeeper.SetModuleVersionMap(suite.ctx, appmodule.VersionMap{ "bank": 0, }) suite.Require().NoError(err) - queryHelper := baseapp.NewQueryServerTestHelper(testCtx.Ctx, suite.encCfg.InterfaceRegistry) + queryHelper := queryclient.NewQueryHelper(codec.NewProtoCodec(suite.encCfg.InterfaceRegistry).GRPCCodec()) types.RegisterQueryServer(queryHelper, suite.upgradeKeeper) suite.queryClient = types.NewQueryClient(queryHelper) } @@ -99,7 +100,7 @@ func (suite *UpgradeTestSuite) TestQueryCurrentPlan() { tc.malleate() - res, err := suite.queryClient.CurrentPlan(context.Background(), req) + res, err := suite.queryClient.CurrentPlan(suite.ctx, req) if tc.expPass { suite.Require().NoError(err) @@ -157,7 +158,7 @@ func (suite *UpgradeTestSuite) TestAppliedCurrentPlan() { tc.malleate() - res, err := suite.queryClient.AppliedPlan(context.Background(), req) + res, err := suite.queryClient.AppliedPlan(suite.ctx, req) if tc.expPass { suite.Require().NoError(err) @@ -207,7 +208,7 @@ func (suite *UpgradeTestSuite) TestModuleVersions() { suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { suite.SetupTest() // reset - res, err := suite.queryClient.ModuleVersions(context.Background(), &tc.req) + res, err := suite.queryClient.ModuleVersions(suite.ctx, &tc.req) if tc.expPass { suite.Require().NoError(err) diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 8d18641789f0..bc7311ebd0d8 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -5,26 +5,22 @@ import ( "path/filepath" "testing" - cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - cmttypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/suite" "go.uber.org/mock/gomock" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" + "cosmossdk.io/core/server" coretesting "cosmossdk.io/core/testing" - "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/upgrade" "cosmossdk.io/x/upgrade/keeper" upgradetestutil "cosmossdk.io/x/upgrade/testutil" "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/baseapp" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" @@ -34,11 +30,13 @@ import ( type KeeperTestSuite struct { suite.Suite + ctx coretesting.TestContext + env coretesting.TestEnvironment + key *storetypes.KVStoreKey - baseApp *baseapp.BaseApp + versionModifier server.VersionModifier upgradeKeeper *keeper.Keeper homeDir string - ctx sdk.Context msgSrvr types.MsgServer addrs []sdk.AccAddress encodedAddrs []string @@ -48,25 +46,14 @@ type KeeperTestSuite struct { func (s *KeeperTestSuite) SetupTest() { s.encCfg = moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, upgrade.AppModule{}) - key := storetypes.NewKVStoreKey(types.StoreKey) - storeService := runtime.NewKVStoreService(key) - env := runtime.NewEnvironment(storeService, coretesting.NewNopLogger()) - s.key = key - testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) - s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Height: 10}) - - s.baseApp = baseapp.NewBaseApp( - "upgrade", - log.NewNopLogger(), - testCtx.DB, - s.encCfg.TxConfig.TxDecoder(), - ) - s.baseApp.SetParamStore(¶mStore{params: cmttypes.DefaultConsensusParams().ToProto()}) - s.baseApp.SetVersionModifier(newMockedVersionModifier(0)) - appVersion, err := s.baseApp.AppVersion(context.Background()) - s.Require().NoError(err) - s.Require().Equal(uint64(0), appVersion) + ctx, env := coretesting.NewTestEnvironment(coretesting.TestEnvironmentConfig{ + ModuleName: types.ModuleName, + Logger: coretesting.NewNopLogger(), + }) + + s.ctx = ctx.WithHeaderInfo(header.Info{Height: 10}) + s.env = env skipUpgradeHeights := make(map[int64]bool) @@ -75,9 +62,18 @@ func (s *KeeperTestSuite) SetupTest() { authority, err := ac.BytesToString(authtypes.NewModuleAddress(types.GovModuleName)) s.Require().NoError(err) s.encodedAuthority = authority + s.versionModifier = newMockedVersionModifier(0) ctrl := gomock.NewController(s.T()) - s.upgradeKeeper = keeper.NewKeeper(env, skipUpgradeHeights, s.encCfg.Codec, homeDir, s.baseApp, authority, upgradetestutil.NewMockConsensusKeeper(ctrl)) + s.upgradeKeeper = keeper.NewKeeper( + env.Environment, + skipUpgradeHeights, + s.encCfg.Codec, + homeDir, + s.versionModifier, + authority, + upgradetestutil.NewMockConsensusKeeper(ctrl), + ) s.T().Log("home dir:", homeDir) s.homeDir = homeDir @@ -260,7 +256,15 @@ func (s *KeeperTestSuite) TestIsSkipHeight() { storeService := runtime.NewKVStoreService(s.key) env := runtime.NewEnvironment(storeService, coretesting.NewNopLogger()) ctrl := gomock.NewController(s.T()) - upgradeKeeper := keeper.NewKeeper(env, skip, s.encCfg.Codec, s.T().TempDir(), s.baseApp, s.encodedAuthority, upgradetestutil.NewMockConsensusKeeper(ctrl)) + upgradeKeeper := keeper.NewKeeper( + env, + skip, + s.encCfg.Codec, + s.T().TempDir(), + s.versionModifier, + s.encodedAuthority, + upgradetestutil.NewMockConsensusKeeper(ctrl), + ) s.Require().True(upgradeKeeper.IsSkipHeight(9)) s.Require().False(upgradeKeeper.IsSkipHeight(10)) } @@ -280,9 +284,9 @@ func (s *KeeperTestSuite) TestDowngradeVerified() { } // Test that the protocol version successfully increments after an -// upgrade and is successfully set on BaseApp's appVersion. +// upgrade and is successfully set on application's appVersion. func (s *KeeperTestSuite) TestIncrementProtocolVersion() { - oldProtocolVersion, err := s.baseApp.AppVersion(context.Background()) + oldProtocolVersion, err := s.versionModifier.AppVersion(context.Background()) s.Require().NoError(err) res := s.upgradeKeeper.HasHandler("dummy") s.Require().False(res) @@ -300,7 +304,7 @@ func (s *KeeperTestSuite) TestIncrementProtocolVersion() { }) err = s.upgradeKeeper.ApplyUpgrade(s.ctx, dummyPlan) s.Require().NoError(err) - upgradedProtocolVersion, err := s.baseApp.AppVersion(s.ctx) + upgradedProtocolVersion, err := s.versionModifier.AppVersion(s.ctx) s.Require().NoError(err) s.Require().Equal(oldProtocolVersion+1, upgradedProtocolVersion) @@ -420,22 +424,3 @@ func (s *KeeperTestSuite) TestLastCompletedUpgradeOrdering() { func TestKeeperTestSuite(t *testing.T) { suite.Run(t, new(KeeperTestSuite)) } - -type paramStore struct { - params cmtproto.ConsensusParams -} - -var _ baseapp.ParamStore = (*paramStore)(nil) - -func (ps *paramStore) Set(_ context.Context, value cmtproto.ConsensusParams) error { - ps.params = value - return nil -} - -func (ps paramStore) Has(_ context.Context) (bool, error) { - return true, nil -} - -func (ps paramStore) Get(_ context.Context) (cmtproto.ConsensusParams, error) { - return ps.params, nil -}