Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(integration): port x/bank tests to server/v2 app #21912

Merged
merged 84 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
da84451
audit NewIntegrationApp usages
kocubinski Sep 3, 2024
eb347f6
Update v2-audit.md
kocubinski Sep 3, 2024
2e9835c
very basic port
kocubinski Sep 6, 2024
b0cc5a5
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Sep 6, 2024
14686ba
merge fix
kocubinski Sep 6, 2024
74358ca
basic construction seems to be working
kocubinski Sep 10, 2024
ba91038
refactor: remove viper as a direct dependency
kocubinski Sep 10, 2024
c4d0834
remove unused interface
kocubinski Sep 10, 2024
a080b2e
not sure how this ended up so big
kocubinski Sep 11, 2024
f09a8fe
clean up
kocubinski Sep 11, 2024
ce51d9e
go mod tidy all
kocubinski Sep 11, 2024
441423d
lint fix
kocubinski Sep 11, 2024
7e508c3
fix simapp v1 build with core replace
kocubinski Sep 11, 2024
99c2a5c
add comment
kocubinski Sep 11, 2024
a6e0c1f
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/app-v2-…
kocubinski Sep 11, 2024
e0c9e3d
go mod tidy all
kocubinski Sep 11, 2024
8c4d79d
Merge branch 'kocu/app-v2-config' into kocu/v2-integration-tests
kocubinski Sep 11, 2024
2d28d64
wip
kocubinski Sep 11, 2024
0e71ce3
fix(runtime/v2): provide default factory options if unset in app builder
kocubinski Sep 12, 2024
3ad2a6e
fix simapp/v2 usage
kocubinski Sep 12, 2024
d8a6ed7
whitespace?
kocubinski Sep 12, 2024
de2a723
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Sep 12, 2024
a47a286
tidy
kocubinski Sep 12, 2024
c8ea058
fix test
kocubinski Sep 12, 2024
2410c04
Merge branch 'kocu/default-factory-opts' into kocu/v2-integration-tests
kocubinski Sep 12, 2024
8d3698f
config fix
kocubinski Sep 12, 2024
57040e2
need comet service bindings
kocubinski Sep 13, 2024
995974c
looks like a valid construction
kocubinski Sep 13, 2024
69598d4
genesis service
kocubinski Sep 15, 2024
29b0ebe
genesis working
kocubinski Sep 15, 2024
a977338
refactor(stf): rm RunWithCtx
kocubinski Sep 15, 2024
30814ac
migrate export genesis and remove stf.RunWithCtx
kocubinski Sep 15, 2024
ef50b4f
revert line wrapping
kocubinski Sep 16, 2024
177a0da
small refactor move genesis services
kocubinski Sep 16, 2024
25f0244
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/rm-stf-…
kocubinski Sep 16, 2024
45ff83a
go mod tidy all
kocubinski Sep 16, 2024
16a0e99
revert vscode change
kocubinski Sep 16, 2024
8d1014e
Merge branch 'main' into kocu/rm-stf-run-with-ctx
kocubinski Sep 16, 2024
9fe1020
update genesis service
kocubinski Sep 16, 2024
80db042
clean up
kocubinski Sep 16, 2024
57ec239
fix typo
kocubinski Sep 16, 2024
c20649d
fix test
kocubinski Sep 16, 2024
ea930ac
fix test
kocubinski Sep 16, 2024
c508350
Merge branch 'kocu/rm-stf-run-with-ctx' into kocu/v2-integration-tests
kocubinski Sep 16, 2024
8b9b66c
fix merge badness
kocubinski Sep 16, 2024
e0eb0ef
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Sep 20, 2024
b6d6f75
kinda working
kocubinski Sep 20, 2024
d8fc366
passin with lots of debug printlns
kocubinski Sep 23, 2024
00dd82a
working integration test!
kocubinski Sep 24, 2024
74e8eed
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Sep 24, 2024
710a1aa
clean up
kocubinski Sep 24, 2024
ae35d88
port another test
kocubinski Sep 24, 2024
eb1f49e
port remaining bank tests
kocubinski Sep 25, 2024
e37ff14
revert whitespace changes
kocubinski Sep 25, 2024
7e6b4db
moar whitespace
kocubinski Sep 25, 2024
d3e474c
why did x/upgrade get touched?
kocubinski Sep 25, 2024
8292c98
godocs
kocubinski Sep 25, 2024
de81b74
Merge branch 'main' into kocu/v2-integration-tests
kocubinski Sep 25, 2024
706a591
more cleanup but stuck on gas service
kocubinski Sep 27, 2024
9e42ec8
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Sep 27, 2024
db41984
tests passing
kocubinski Sep 27, 2024
869a492
rever gas addition to stf query return
kocubinski Sep 27, 2024
a8f7d8e
clean up
kocubinski Sep 27, 2024
6a9e803
revert whitespace
kocubinski Sep 27, 2024
9cf71f4
godocs
kocubinski Sep 30, 2024
47136de
runtime/v2 clean up
kocubinski Sep 30, 2024
52c502a
add comment
kocubinski Sep 30, 2024
8d34c75
clean up
kocubinski Sep 30, 2024
55e77a5
linting
kocubinski Sep 30, 2024
4c9de97
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Sep 30, 2024
2e26e66
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Oct 29, 2024
1d58116
clean up
kocubinski Oct 29, 2024
862b351
go mod tidy
kocubinski Oct 29, 2024
17c1bf2
fixes
kocubinski Oct 29, 2024
002b46a
use codec.DefaultProviders
kocubinski Oct 29, 2024
89c5fc7
rm core go.mod replaces
kocubinski Oct 29, 2024
9c15e0a
minor cleanup
kocubinski Oct 29, 2024
6c41076
lint fix
kocubinski Oct 29, 2024
bd69e6d
revert
kocubinski Oct 29, 2024
859b6ac
fix simapp/v2 config
kocubinski Oct 29, 2024
83333fa
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski Nov 1, 2024
c768f5c
Merge branch 'main' into kocu/v2-integration-tests
kocubinski Nov 6, 2024
7c32d2f
simple fix?
kocubinski Nov 6, 2024
7e5f838
add Close() call
kocubinski Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions codec/depinject.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import (
"github.com/cosmos/cosmos-sdk/codec/types"
)

var DefaultProviders = depinject.Provide(
kocubinski marked this conversation as resolved.
Show resolved Hide resolved
ProvideInterfaceRegistry,
ProvideLegacyAmino,
ProvideProtoCodec,
ProvideAddressCodec,
)

func ProvideInterfaceRegistry(
addressCodec address.Codec,
validatorAddressCodec address.ValidatorAddressCodec,
Expand Down
15 changes: 7 additions & 8 deletions server/v2/appmanager/appmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,16 @@ func (a appManager[T]) SimulateWithState(ctx context.Context, state corestore.Re
// Query queries the application at the provided version.
// CONTRACT: Version must always be provided, if 0, get latest
func (a appManager[T]) Query(ctx context.Context, version uint64, request transaction.Msg) (transaction.Msg, error) {
var (
queryState corestore.ReaderMap
err error
)
// if version is provided attempt to do a height query.
if version != 0 {
queryState, err := a.db.StateAt(version)
if err != nil {
return nil, err
}
return a.stf.Query(ctx, queryState, a.config.QueryGasLimit, request)
queryState, err = a.db.StateAt(version)
} else { // otherwise rely on latest available state.
_, queryState, err = a.db.StateLatest()
}

// otherwise rely on latest available state.
_, queryState, err := a.db.StateLatest()
if err != nil {
return nil, err
}
Expand Down
2 changes: 0 additions & 2 deletions server/v2/stf/core_header_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const headerInfoPrefix = 0x37

// setHeaderInfo sets the header info in the state to be used by queries in the future.
func (s STF[T]) setHeaderInfo(state store.WriterMap, headerInfo header.Info) error {
// TODO storing header info is too low level here, stf should be stateless.
// We should have a keeper that does this.
runtimeStore, err := state.GetWriter(Identity)
if err != nil {
return err
Expand Down
5 changes: 1 addition & 4 deletions simapp/v2/app_di.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ func AppConfig() depinject.Config {
return depinject.Configs(
ModuleConfig, // Alternatively use appconfig.LoadYAML(AppConfigYAML)
runtime.DefaultServiceBindings(),
codec.DefaultProviders,
depinject.Provide(
codec.ProvideInterfaceRegistry,
codec.ProvideAddressCodec,
codec.ProvideProtoCodec,
codec.ProvideLegacyAmino,
ProvideRootStoreConfig,
// inject desired account types:
multisigdepinject.ProvideAccount,
Expand Down
12 changes: 11 additions & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ require (

require (
cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29
cosmossdk.io/runtime/v2 v2.0.0-20240911143651-72620a577660
cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000
cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000
cosmossdk.io/x/accounts v0.0.0-20240913065641-0064ccbce64e
cosmossdk.io/x/accounts/defaults/base v0.0.0-00010101000000-000000000000
cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5
Expand All @@ -52,6 +55,7 @@ require (
github.com/jhump/protoreflect v1.17.0
github.com/rs/zerolog v1.33.0
github.com/spf13/viper v1.19.0
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b
)

require (
Expand All @@ -65,7 +69,9 @@ require (
cloud.google.com/go/storage v1.43.0 // indirect
cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac // indirect
cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 // indirect
cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f // indirect
cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
Expand Down Expand Up @@ -162,6 +168,7 @@ require (
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/minio/highwayhash v1.0.3 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
Expand Down Expand Up @@ -196,7 +203,6 @@ require (
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
go.opencensus.io v0.24.0 // indirect
Expand Down Expand Up @@ -237,7 +243,11 @@ replace (
cosmossdk.io/api => ../api
cosmossdk.io/client/v2 => ../client/v2
cosmossdk.io/collections => ../collections
cosmossdk.io/runtime/v2 => ../runtime/v2
cosmossdk.io/server/v2/appmanager => ../server/v2/appmanager
cosmossdk.io/server/v2/stf => ../server/v2/stf
cosmossdk.io/store => ../store
cosmossdk.io/store/v2 => ../store/v2
Copy link
Contributor

@cool-develope cool-develope Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store/v2 changes look no relation to this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously store/v2 was not used in tests/integration. now it is. I'm not sure which version of store/v2 to use for tests, so I'm pinning to latest for now. That's probably fair for integration tests?

cosmossdk.io/x/accounts => ../x/accounts
cosmossdk.io/x/accounts/defaults/base => ../x/accounts/defaults/base
cosmossdk.io/x/accounts/defaults/lockup => ../x/accounts/defaults/lockup
Expand Down
4 changes: 4 additions & 0 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050=
cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8=
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U=
cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqFG1+UgeU1JzZrWtwuWzI3ZfwA=
cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc=
cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM=
cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU=
cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
Expand Down Expand Up @@ -646,6 +648,8 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q=
github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=
Expand Down
Loading
Loading