chore: remove baseapp and sdk.Context fully from x/upgrade (#23396)

Co-authored-by: aljo242 <alex@skip.money>
Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
Alex | Interchain Labs 2025-02-05 07:30:18 -05:00 committed by GitHub
parent fe1c8af22a
commit 9ea03a3c4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
63 changed files with 295 additions and 284 deletions

View File

@ -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 (

View File

@ -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=

View File

@ -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.

25
core/testing/branch.go Normal file
View File

@ -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)
}

View File

@ -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,

2
go.mod
View File

@ -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

4
go.sum
View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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 (

View File

@ -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=

View File

@ -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(),

View File

@ -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))

View File

@ -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(),
})

View File

@ -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)
}

View File

@ -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 (

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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 (

View File

@ -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=

View File

@ -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 (

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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(&paramStore{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

View File

@ -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)

View File

@ -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(&paramStore{params: cmttypes.DefaultConsensusParams().ToProto()})
s.baseApp.SetVersionModifier(newMockedVersionModifier(0))
ctx, env := coretesting.NewTestEnvironment(coretesting.TestEnvironmentConfig{
ModuleName: types.ModuleName,
Logger: coretesting.NewNopLogger(),
})
appVersion, err := s.baseApp.AppVersion(context.Background())
s.Require().NoError(err)
s.Require().Equal(uint64(0), appVersion)
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
}